Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2516 nelberth 1
<?php
2
declare(strict_types=1);
3
 
4
namespace LeadersLinked\Controller;
5
 
6
use Laminas\Authentication\AuthenticationService;
7
use Laminas\Authentication\Result as AuthResult;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
10
use Laminas\Mvc\Controller\AbstractActionController;
11
use Laminas\Mvc\I18n\Translator;
12
use Laminas\Log\LoggerInterface;
13
use Laminas\View\Model\ViewModel;
14
use Laminas\View\Model\JsonModel;
15
use LeadersLinked\Model\PlanningObjectivesAndGoalsTask;
16
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
17
use LeadersLinked\Form\PlanningObjectivesAndGoalsTaskForm;
18
 
19
use LeadersLinked\Library\Functions;
20
 
21
use LeadersLinked\Mapper\PlanningObjectivesAndGoalsTaskMapper;
2565 nelberth 22
use LeadersLinked\Mapper\PlanningObjectivesAndGoalsGoalsMapper;
2516 nelberth 23
use LeadersLinked\Mapper\PlanningObjectivesAndGoalsObjectivesMapper;
3398 nelberth 24
use LeadersLinked\Mapper\CompanyUserMapper;
3401 nelberth 25
use LeadersLinked\Mapper\userMapper;
2516 nelberth 26
 
27
class PlanningObjectivesAndGoalsTaskController extends AbstractActionController
28
{
29
    /**
30
     *
31
     * @var AdapterInterface
32
     */
33
    private $adapter;
34
 
35
 
36
    /**
37
     *
38
     * @var AbstractAdapter
39
     */
40
    private $cache;
41
 
42
    /**
43
     *
44
     * @var  LoggerInterface
45
     */
46
    private $logger;
47
 
48
    /**
49
     *
50
     * @var array
51
     */
52
    private $config;
53
 
54
 
55
 
56
    /**
57
     *
58
     * @param AdapterInterface $adapter
59
     * @param AbstractAdapter $cache
60
     * @param LoggerInterface $logger
61
     * @param array $config
62
     */
63
    public function __construct($adapter, $cache , $logger, $config)
64
    {
65
        $this->adapter      = $adapter;
66
        $this->cache        = $cache;
67
        $this->logger       = $logger;
68
        $this->config       = $config;
69
 
70
 
71
    }
72
 
2565 nelberth 73
 
2516 nelberth 74
 
75
    public function indexAction()
76
    {
2781 nelberth 77
        $uuidObjective = $this->params()->fromRoute('uuid_objective');
78
        $uuidGoals= $this->params()->fromRoute('uuid_goals');
2516 nelberth 79
        $request = $this->getRequest();
80
 
81
        if($request->isGet()) {
82
 
83
 
84
            $headers  = $request->getHeaders();
85
 
86
            $isJson = false;
87
            if($headers->has('Accept')) {
88
                $accept = $headers->get('Accept');
89
 
90
                $prioritized = $accept->getPrioritized();
91
 
92
                foreach($prioritized as $key => $value) {
93
                    $raw = trim($value->getRaw());
94
 
95
                    if(!$isJson) {
96
                        $isJson = strpos($raw, 'json');
97
                    }
98
 
99
                }
100
            }
101
 
102
            if($isJson) {
2826 nelberth 103
                $currentUserPlugin = $this->plugin('currentUserPlugin');
104
                $currentUser = $currentUserPlugin->getUser();
2825 nelberth 105
                $currentCompany = $currentUserPlugin->getCompany();
2824 nelberth 106
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
2823 nelberth 107
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'planning-objectives-and-goals/objectives/goals/task/edit');
108
                $allowDelete = $acl->isAllowed($currentUser->usertype_id, 'planning-objectives-and-goals/objectives/goals/task/delete');
109
                $allowView = $acl->isAllowed($currentUser->usertype_id, 'planning-objectives-and-goals/objectives/goals/task/view');
2516 nelberth 110
 
111
                $search = $this->params()->fromQuery('search', []);
112
                $search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
113
 
114
                $records_x_page     = intval($this->params()->fromQuery('length', 10), 10);
3335 nelberth 115
                $page               = (intval($this->params()->fromQuery('start', 1), 10)/$records_x_page)+1;
2516 nelberth 116
                $order =  $this->params()->fromQuery('order', []);
117
                $order_field        = empty($order[0]['column']) ? 99 :  intval($order[0]['column'], 10);
118
                $order_direction    = empty($order[0]['dir']) ? 'ASC' : strtoupper(filter_var( $order[0]['dir'], FILTER_SANITIZE_STRING));
119
 
120
                $fields =  ['title'];
121
                $order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'title';
122
 
123
                if(!in_array($order_direction, ['ASC', 'DESC'])) {
124
                    $order_direction = 'ASC';
125
                }
2825 nelberth 126
 
2781 nelberth 127
                $planningObjectivesAndGoalsObjectivesMapper = PlanningObjectivesAndGoalsObjectivesMapper::getInstance($this->adapter);
128
                $objective = $planningObjectivesAndGoalsObjectivesMapper->fetchOneByUuid($uuidObjective);
129
 
130
                if (!$objective) {
2516 nelberth 131
                    $data = [
132
                        'success' => false,
2781 nelberth 133
                        'data' => 'ERROR_RECORD_NOT_FOUND'
2516 nelberth 134
                    ];
2781 nelberth 135
 
2516 nelberth 136
 
137
                        return new JsonModel($data);
2781 nelberth 138
 
139
                }else{
140
                    if($objective->id_company==$currentCompany->id){
141
                        $planningObjectivesAndGoalsGoalsMapper = PlanningObjectivesAndGoalsGoalsMapper::getInstance($this->adapter);
142
                        $goals = $planningObjectivesAndGoalsGoalsMapper->fetchOneByUuid($uuidGoals);
143
 
144
                        if(!$goals){
145
                            $data = [
146
                                'success' => false,
147
                                'data' => 'ERROR_RECORD_NOT_FOUND'
148
                            ];
149
 
150
 
151
                                return new JsonModel($data);
152
                        }
153
                    }else{
154
                        $data = [
155
                            'success' => false,
156
                            'data' => 'ERROR_UNAUTHORIZED',
157
                        ];
158
 
159
                            return new JsonModel($data);
160
                    }
161
 
162
 
163
 
2516 nelberth 164
                }
2781 nelberth 165
 
2516 nelberth 166
 
167
                $planningObjectivesAndGoalsTaskMapper = PlanningObjectivesAndGoalsTaskMapper::getInstance($this->adapter);
2565 nelberth 168
                $paginator = $planningObjectivesAndGoalsTaskMapper->fetchAllDataTable($search, $page, $records_x_page, $order_field, $order_direction, $goals->id);
2516 nelberth 169
 
170
                $items = [];
171
 
172
                $records = $paginator->getCurrentItems();
3030 nelberth 173
 
3058 nelberth 174
 
2516 nelberth 175
                foreach($records as $record)
176
                {
177
 
178
                    $item = [
179
                        'title' => $record->title,
180
                        'description' => $record->description,
2884 nelberth 181
                        'progress'=> $record->indicator,
2846 nelberth 182
                        'cost'=> $record->cost,
3045 nelberth 183
                        'status' => $record->status,
2516 nelberth 184
                        'actions' => [
2828 nelberth 185
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('planning-objectives-and-goals/objectives/goals/task/edit', ['uuid_objective' => $uuidObjective,'uuid_goals' => $uuidGoals,'id' => $record->uuid]) : '',
3003 nelberth 186
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('planning-objectives-and-goals/objectives/goals/task/delete', ['uuid_objective' => $uuidObjective,'uuid_goals' => $uuidGoals,'id' => $record->uuid]) : ''
187
                            ]
2516 nelberth 188
 
189
                    ];
3058 nelberth 190
                    array_push($items, $item);
191
                }
3065 nelberth 192
 
3303 nelberth 193
                $recordsTask = $planningObjectivesAndGoalsTaskMapper->fetchAll($goals->id);
194
 
3070 nelberth 195
 
3058 nelberth 196
                $costGoals=0;
197
                $indicatorGoals=0;
3311 nelberth 198
 
3171 nelberth 199
                foreach($recordsTask as $record)
3058 nelberth 200
                {
3030 nelberth 201
                    $indicatorGoals=$indicatorGoals+$record->indicator;
202
                    $costGoals=$costGoals+$record->cost;
2516 nelberth 203
                }
3317 nelberth 204
                $countRecordsTask = count($recordsTask);
205
                if($countRecordsTask >0){
3301 nelberth 206
 
3333 nelberth 207
                    $indicatorGoals=round($indicatorGoals/$countRecordsTask, 2);
3193 nelberth 208
                }else{
209
                    $indicatorGoals=-1;
210
                }
3407 nelberth 211
 
212
 
3400 nelberth 213
 
2516 nelberth 214
                return new JsonModel([
215
                    'success' => true,
216
                    'data' => [
217
                        'items' => $items,
218
                        'total' => $paginator->getTotalItemCount(),
3030 nelberth 219
                        'goals' => [
220
                            'titleGoals' =>$goals->title,
221
                            'descriptionGoals' =>$goals->description,
222
                            'costGoals'=>'$'.$costGoals,
3193 nelberth 223
                            'indicatorGoals'=> $indicatorGoals,
3049 nelberth 224
                            'statusGoals'=> $goals->status=='a'?'LABEL_ACTIVE':'LABEL_INACTIVE',
2516 nelberth 225
 
226
                        ]
227
                    ]
228
                ]);
229
            } else  {
230
                $formAdd = new PlanningObjectivesAndGoalsTaskForm();
231
                $this->layout()->setTemplate('layout/layout-backend');
232
                $viewModel = new ViewModel();
2547 nelberth 233
                $viewModel->setTemplate('leaders-linked/planning-objectives-and-goals-task/index.phtml');
2516 nelberth 234
                $viewModel->setVariables([
235
                    'formAdd' => $formAdd,
2781 nelberth 236
                    'uuid_objective'=> $uuidObjective,
237
                    'uuid_goals'=> $uuidGoals,
2516 nelberth 238
 
2530 nelberth 239
 
2516 nelberth 240
                ]);
241
                return $viewModel ;
242
            }
243
        } else {
244
            return new JsonModel([
245
                'success' => false,
246
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
247
            ]);
248
        }
249
    }
250
    public function addAction()
251
    {
252
      $currentUserPlugin = $this->plugin('currentUserPlugin');
253
        $currentUser = $currentUserPlugin->getUser();
254
        $currentCompany = $currentUserPlugin->getCompany();
2781 nelberth 255
        $uuidObjective = $this->params()->fromRoute('uuid_objective');
256
        $uuidGoals = $this->params()->fromRoute('uuid_goals');
2516 nelberth 257
        $request = $this->getRequest();
3411 nelberth 258
        $planningObjectivesAndGoalsObjectivesMapper = PlanningObjectivesAndGoalsObjectivesMapper::getInstance($this->adapter);
3407 nelberth 259
        $objective = $planningObjectivesAndGoalsObjectivesMapper->fetchOneByUuid($uuidObjective);
260
 
261
        if (!$objective) {
262
            $data = [
263
                'success' => false,
264
                'data' => 'ERROR_RECORD_NOT_FOUND'
265
            ];
266
 
267
 
268
                return new JsonModel($data);
269
 
270
        }else{
271
            if($objective->id_company==$currentCompany->id){
272
                $planningObjectivesAndGoalsGoalsMapper = PlanningObjectivesAndGoalsGoalsMapper::getInstance($this->adapter);
273
                $goals = $planningObjectivesAndGoalsGoalsMapper->fetchOneByUuid($uuidGoals);
274
 
275
                if(!$goals){
276
                    $data = [
277
                        'success' => false,
278
                        'data' => 'ERROR_RECORD_NOT_FOUND'
279
                    ];
280
 
281
 
282
                        return new JsonModel($data);
283
                }
284
            }else{
285
                $data = [
286
                    'success' => false,
287
                    'data' => 'ERROR_UNAUTHORIZED',
288
                ];
289
 
290
                    return new JsonModel($data);
291
            }
292
 
293
        }
2516 nelberth 294
        if($request->isPost()) {
295
            $form = new  PlanningObjectivesAndGoalsTaskForm();
296
            $dataPost = $request->getPost()->toArray();
2981 nelberth 297
            $dataPost['status'] =  isset($dataPost['status']) ? $dataPost['status'] : PlanningObjectivesAndGoalsTask::STATUS_INACTIVE;
3024 nelberth 298
            if($dataPost['indicator']!=100){
299
                $dataPost['evaluation']='';
300
                $dataPost['detour']='';
301
            }
2516 nelberth 302
            $form->setData($dataPost);
303
 
304
            if($form->isValid()) {
3407 nelberth 305
 
3411 nelberth 306
 
2516 nelberth 307
 
308
                $dataPost = (array) $form->getData();
2776 nelberth 309
                $dataPost['id_goals']=$goals->id;
2516 nelberth 310
 
311
                $hydrator = new ObjectPropertyHydrator();
312
                $planningObjectivesAndGoalsTask = new PlanningObjectivesAndGoalsTask();
313
                $hydrator->hydrate($dataPost, $planningObjectivesAndGoalsTask);
314
 
315
                $planningObjectivesAndGoalsTaskMapper = PlanningObjectivesAndGoalsTaskMapper::getInstance($this->adapter);
316
                $result = $planningObjectivesAndGoalsTaskMapper->insert($planningObjectivesAndGoalsTask);
317
 
318
                if($result) {
2776 nelberth 319
                    $this->logger->info('Se agrego la tarea ' . $planningObjectivesAndGoalsTask->title, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
2516 nelberth 320
 
321
                    $data = [
322
                        'success'   => true,
323
                        'data'   => 'LABEL_RECORD_ADDED'
324
                    ];
325
                } else {
326
                    $data = [
327
                        'success'   => false,
328
                        'data'      => $planningObjectivesAndGoalsTaskMapper->getError()
329
                    ];
330
 
331
                }
332
 
333
                return new JsonModel($data);
334
 
335
            } else {
336
                $messages = [];
337
                $form_messages = (array) $form->getMessages();
338
                foreach($form_messages  as $fieldname => $field_messages)
339
                {
340
 
341
                    $messages[$fieldname] = array_values($field_messages);
342
                }
343
 
344
                return new JsonModel([
345
                    'success'   => false,
346
                    'data'   => $messages
347
                ]);
348
            }
349
 
3407 nelberth 350
        }else if ($request->isGet()) {
351
            $companyUserMapper = CompanyUserMapper::getInstance($this->adapter);
352
            $userMapper = UserMapper::getInstance($this->adapter);
353
            $datosCompanyUser = $companyUserMapper->fetchAllByCompanyId($currentCompany->id);
354
 
355
            $users=[];
356
 
357
            foreach($datosCompanyUser as $record){
358
                $datosUser = $userMapper->fetchOne($record->user_id);
3417 nelberth 359
 
3415 nelberth 360
                    $user=[
3417 nelberth 361
                        'uuid'=>$datosUser->uuid,
3418 nelberth 362
                        'email'=>$datosUser->email
3415 nelberth 363
                    ];
364
                    array_push($users, $user);
3417 nelberth 365
 
3407 nelberth 366
            }
367
 
368
            return new JsonModel([
369
                'success' => true,
3415 nelberth 370
                'data' => $users
371
 
3407 nelberth 372
            ]);
2516 nelberth 373
        } else {
374
            $data = [
375
                'success' => false,
376
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
377
            ];
378
 
379
            return new JsonModel($data);
380
        }
381
 
382
        return new JsonModel($data);
383
 
384
 
385
    }
386
 
387
 
388
 
389
     public function editAction(){
390
 
2783 nelberth 391
 
2516 nelberth 392
        $currentUserPlugin = $this->plugin('currentUserPlugin');
393
        $currentUser = $currentUserPlugin->getUser();
394
        $currentCompany = $currentUserPlugin->getCompany();
395
        $request = $this->getRequest();
396
        $uuid = $this->params()->fromRoute('id');
3000 nelberth 397
 
2516 nelberth 398
 
399
        if(!$uuid) {
400
            $data = [
401
                'success'   => false,
402
                'data'   => 'ERROR_INVALID_PARAMETER'
403
            ];
404
 
405
            return new JsonModel($data);
406
        }
407
 
2781 nelberth 408
        $uuidObjective = $this->params()->fromRoute('uuid_objective');
2783 nelberth 409
        $uuidGoals = $this->params()->fromRoute('uuid_goals');
2782 nelberth 410
        $currentUserPlugin = $this->plugin('currentUserPlugin');
411
        $currentCompany = $currentUserPlugin->getCompany();
412
        $planningObjectivesAndGoalsObjectivesMapper = PlanningObjectivesAndGoalsObjectivesMapper::getInstance($this->adapter);
413
        $objective = $planningObjectivesAndGoalsObjectivesMapper->fetchOneByUuid($uuidObjective);
414
 
415
        if (!$objective) {
2516 nelberth 416
            $data = [
417
                'success' => false,
2782 nelberth 418
                'data' => 'ERROR_RECORD_NOT_FOUND'
2516 nelberth 419
            ];
2782 nelberth 420
 
2516 nelberth 421
 
422
                return new JsonModel($data);
2782 nelberth 423
 
424
        }else{
425
            if($objective->id_company==$currentCompany->id){
426
                $planningObjectivesAndGoalsGoalsMapper = PlanningObjectivesAndGoalsGoalsMapper::getInstance($this->adapter);
427
                $goals = $planningObjectivesAndGoalsGoalsMapper->fetchOneByUuid($uuidGoals);
428
 
429
                if(!$goals){
430
                    $data = [
431
                        'success' => false,
432
                        'data' => 'ERROR_RECORD_NOT_FOUND'
433
                    ];
434
 
435
 
436
                        return new JsonModel($data);
437
                }
438
            }else{
439
                $data = [
440
                    'success' => false,
441
                    'data' => 'ERROR_UNAUTHORIZED',
442
                ];
443
 
444
                    return new JsonModel($data);
445
            }
446
 
447
 
448
 
2516 nelberth 449
        }
450
        $planningObjectivesAndGoalsTaskMapper = PlanningObjectivesAndGoalsTaskMapper::getInstance($this->adapter);
2782 nelberth 451
        $task = $planningObjectivesAndGoalsTaskMapper->fetchOneByUuid($uuid);
2516 nelberth 452
 
2782 nelberth 453
        if (!$task) {
2516 nelberth 454
            $data = [
455
                'success' => false,
456
                'data' => 'ERROR_RECORD_NOT_FOUND'
457
            ];
458
 
459
            return new JsonModel($data);
460
        }
461
 
462
 
463
        if($request->isPost()) {
3000 nelberth 464
            $form = new  PlanningObjectivesAndGoalsTaskForm();
465
            $dataPost = $request->getPost()->toArray();
466
            $dataPost['status'] =  isset($dataPost['status']) ? $dataPost['status'] : PlanningObjectivesAndGoalsTask::STATUS_INACTIVE;
2516 nelberth 467
            $form->setData($dataPost);
468
 
469
            if($form->isValid()) {
470
                $dataPost = (array) $form->getData();
471
 
472
                $hydrator = new ObjectPropertyHydrator();
2782 nelberth 473
                $hydrator->hydrate($dataPost, $task);
474
                $result = $planningObjectivesAndGoalsTaskMapper->update($task);
2516 nelberth 475
 
476
                if($result) {
2782 nelberth 477
                    $this->logger->info('Se actualizo la tarea ' . $task->title, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
2516 nelberth 478
 
479
                    $data = [
480
                        'success' => true,
481
                        'data' => 'LABEL_RECORD_UPDATED'
482
                    ];
483
                } else {
484
                    $data = [
485
                        'success'   => false,
486
                        'data'      => $planningObjectivesAndGoalsTaskMapper->getError()
487
                    ];
488
                }
489
 
490
                return new JsonModel($data);
491
 
492
            } else {
493
                $messages = [];
494
                $form_messages = (array) $form->getMessages();
495
                foreach($form_messages  as $fieldname => $field_messages)
496
                {
497
                    $messages[$fieldname] = array_values($field_messages);
498
                }
499
 
500
                return new JsonModel([
501
                    'success'   => false,
502
                    'data'   => $messages
503
                ]);
504
            }
505
        }else if ($request->isGet()) {
506
            $hydrator = new ObjectPropertyHydrator();
507
 
508
            $data = [
509
                'success' => true,
2782 nelberth 510
                'data' => $hydrator->extract($task)
2516 nelberth 511
            ];
512
 
513
            return new JsonModel($data);
514
        } else {
515
            $data = [
516
                'success' => false,
517
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
518
            ];
519
 
520
            return new JsonModel($data);
521
        }
522
 
523
        return new JsonModel($data);
524
 
525
    }
526
 
527
 
528
 
529
 
530
    public function deleteAction(){
531
        $currentUserPlugin = $this->plugin('currentUserPlugin');
532
        $currentCompany = $currentUserPlugin->getCompany();
533
        $currentUser = $currentUserPlugin->getUser();
534
 
535
        $request = $this->getRequest();
536
        $uuid = $this->params()->fromRoute('id');
537
 
538
 
539
        if (!$uuid) {
540
            $data = [
541
                'success' => false,
542
                'data' => 'ERROR_INVALID_PARAMETER'
543
            ];
544
 
545
            return new JsonModel($data);
546
        }
2787 nelberth 547
        $uuidObjective = $this->params()->fromRoute('uuid_objective');
548
        $uuidGoals = $this->params()->fromRoute('uuid_goals');
2782 nelberth 549
        $currentUserPlugin = $this->plugin('currentUserPlugin');
550
        $currentCompany = $currentUserPlugin->getCompany();
551
        $planningObjectivesAndGoalsObjectivesMapper = PlanningObjectivesAndGoalsObjectivesMapper::getInstance($this->adapter);
552
        $objective = $planningObjectivesAndGoalsObjectivesMapper->fetchOneByUuid($uuidObjective);
553
 
554
        if (!$objective) {
2516 nelberth 555
            $data = [
556
                'success' => false,
2782 nelberth 557
                'data' => 'ERROR_RECORD_NOT_FOUND'
2516 nelberth 558
            ];
559
                return new JsonModel($data);
2782 nelberth 560
 
561
        }else{
562
            if($objective->id_company==$currentCompany->id){
563
                $planningObjectivesAndGoalsGoalsMapper = PlanningObjectivesAndGoalsGoalsMapper::getInstance($this->adapter);
564
                $goals = $planningObjectivesAndGoalsGoalsMapper->fetchOneByUuid($uuidGoals);
565
 
566
                if(!$goals){
567
                    $data = [
568
                        'success' => false,
569
                        'data' => 'ERROR_RECORD_NOT_FOUND'
570
                    ];
571
 
572
 
573
                        return new JsonModel($data);
574
                }
575
            }else{
576
                $data = [
577
                    'success' => false,
578
                    'data' => 'ERROR_UNAUTHORIZED',
579
                ];
580
 
581
                    return new JsonModel($data);
3024 nelberth 582
            }
2782 nelberth 583
 
2516 nelberth 584
        }
585
        $planningObjectivesAndGoalsTaskMapper = PlanningObjectivesAndGoalsTaskMapper::getInstance($this->adapter);
2782 nelberth 586
        $task = $planningObjectivesAndGoalsTaskMapper->fetchOneByUuid($uuid);
2516 nelberth 587
 
2782 nelberth 588
        if (!$task) {
2516 nelberth 589
            $data = [
590
                'success' => false,
591
                'data' => 'ERROR_RECORD_NOT_FOUND'
592
            ];
593
 
594
            return new JsonModel($data);
595
        }
596
 
597
 
598
        if ($request->isPost()) {
599
 
600
 
2782 nelberth 601
            $result = $planningObjectivesAndGoalsTaskMapper->delete($task->id);
2516 nelberth 602
            if ($result) {
2782 nelberth 603
                $this->logger->info('Se borro la tarea con el titulo ' . $task->title, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
2516 nelberth 604
 
605
                $data = [
606
                    'success' => true,
607
                    'data' => 'LABEL_RECORD_DELETED'
608
                ];
609
            } else {
610
 
611
                $data = [
612
                    'success' => false,
613
                    'data' => $planningObjectivesAndGoalsTaskMapper->getError()
614
                ];
615
 
616
                return new JsonModel($data);
617
            }
618
        } else {
619
            $data = [
620
                'success' => false,
621
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
622
            ];
623
 
624
            return new JsonModel($data);
625
        }
626
 
627
        return new JsonModel($data);
628
    }
629
 
630
 
631
 
632
 
633
}