Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16768 | Rev 16785 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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