Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
1384 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Controller;
6
 
7
use Laminas\Db\Adapter\AdapterInterface;
8
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
9
use Laminas\Mvc\Controller\AbstractActionController;
10
use Laminas\Log\LoggerInterface;
11
use Laminas\View\Model\ViewModel;
12
use Laminas\View\Model\JsonModel;
1455 eleazar 13
use LeadersLinked\Form\RecruitmentSelectionVacancyForm;
1384 efrain 14
use LeadersLinked\Library\Functions;
1386 eleazar 15
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
1387 eleazar 16
use LeadersLinked\Model\RecruitmentSelectionVacancy;
1384 efrain 17
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
18
use LeadersLinked\Model\Location;
19
use LeadersLinked\Mapper\LocationMapper;
20
use LeadersLinked\Mapper\IndustryMapper;
21
use LeadersLinked\Mapper\JobDescriptionMapper;
22
use LeadersLinked\Mapper\BehaviorMapper;
23
use LeadersLinked\Mapper\JobDescriptionBehaviorCompetencyMapper;
24
use LeadersLinked\Mapper\CompanyMapper;
25
use LeadersLinked\Model\Company;
26
use LeadersLinked\Mapper\JobCategoryMapper;
27
 
28
class RecruitmentSelectionVacancyController extends AbstractActionController {
29
 
30
    /**
31
     *
32
     * @var AdapterInterface
33
     */
34
    private $adapter;
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
     * @param AdapterInterface $adapter
57
     * @param AbstractAdapter $cache
58
     * @param LoggerInterface $logger
59
     * @param array $config
60
     */
61
    public function __construct($adapter, $cache, $logger, $config) {
62
        $this->adapter = $adapter;
63
        $this->cache = $cache;
64
        $this->logger = $logger;
65
        $this->config = $config;
66
    }
67
 
68
    public function indexAction() {
69
        $request = $this->getRequest();
70
        $currentUserPlugin = $this->plugin('currentUserPlugin');
71
        $currentCompany = $currentUserPlugin->getCompany();
72
        $currentUser = $currentUserPlugin->getUser();
73
 
74
 
75
        $request = $this->getRequest();
76
        if ($request->isGet()) {
77
            $sandbox = $this->config['leaderslinked.runmode.sandbox'];
78
            if($sandbox) {
79
                $google_map_key  = $this->config['leaderslinked.google_map.sandbox_api_key'];
80
            } else {
81
                $google_map_key  = $this->config['leaderslinked.google_map.production_api_key'];
82
            }
83
 
84
 
85
            $headers = $request->getHeaders();
86
 
87
            $isJson = false;
88
            if ($headers->has('Accept')) {
89
                $accept = $headers->get('Accept');
90
 
91
                $prioritized = $accept->getPrioritized();
92
 
93
                foreach ($prioritized as $key => $value) {
94
                    $raw = trim($value->getRaw());
95
 
96
                    if (!$isJson) {
97
                        $isJson = strpos($raw, 'json');
98
                    }
99
                }
100
            }
101
 
102
            //$isJson = true;
103
            if ($isJson) {
10093 stevensc 104
                $search = $this->params()->fromQuery('search');
105
                $search = empty($search) ? '' : filter_var($search, FILTER_SANITIZE_STRING);
1384 efrain 106
 
107
                $page = intval($this->params()->fromQuery('start', 1), 10);
108
                $records_x_page = intval($this->params()->fromQuery('length', 10), 10);
109
                $order = $this->params()->fromQuery('order', []);
110
                $order_field = empty($order[0]['column']) ? 99 : intval($order[0]['column'], 10);
111
                $order_direction = empty($order[0]['dir']) ? 'ASC' : strtoupper(filter_var($order[0]['dir'], FILTER_SANITIZE_STRING));
112
 
113
                $fields = ['name'];
114
                $order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'name';
115
 
116
                if (!in_array($order_direction, ['ASC', 'DESC'])) {
117
                    $order_direction = 'ASC';
118
                }
119
 
1434 eleazar 120
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
1477 efrain 121
                $allowDelete = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/delete');
1434 eleazar 122
 
1477 efrain 123
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/edit');
10102 stevensc 124
 
1434 eleazar 125
 
1386 eleazar 126
                $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
1544 eleazar 127
                $paginator = $recruitmentSelectionVacancyMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
1384 efrain 128
 
10100 stevensc 129
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
130
                $industryMapper = IndustryMapper::getInstance($this->adapter);
131
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
1384 efrain 132
 
133
                $items = [];
134
                $records = $paginator->getCurrentItems();
1449 eleazar 135
 
1384 efrain 136
                foreach ($records as $record) {
137
                    $jobDescription = $jobDescriptionMapper->fetchOne($record->job_description_id);
138
                    if ($jobDescription) {
139
 
140
                        $item = [
141
                            'id' => $record->id,
142
                            'name' => $record->name,
143
                            'job_description' => $jobDescription->name,
144
                            'status' => $record->status,
145
                            'actions' => [
1477 efrain 146
                                'link_edit' => $this->url()->fromRoute('recruitment-and-selection/vacancies/edit', ['id' => $record->uuid]),
147
                                'link_delete' => $this->url()->fromRoute('recruitment-and-selection/vacancies/delete', ['id' => $record->uuid])
1384 efrain 148
                            ]
149
                        ];
150
                    }
151
 
152
                    array_push($items, $item);
153
                }
154
 
155
                return new JsonModel([
156
                    'success' => true,
157
                    'data' => [
158
                        'items' => $items,
159
                        'total' => $paginator->getTotalItemCount(),
160
                    ]
161
                ]);
162
            } else {
163
 
1544 eleazar 164
                $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
1384 efrain 165
 
1549 eleazar 166
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
167
                $industryMapper = industryMapper::getInstance($this->adapter);
10112 stevensc 168
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
1549 eleazar 169
 
1384 efrain 170
                $this->layout()->setTemplate('layout/layout-backend');
171
                $viewModel = new ViewModel();
1396 eleazar 172
                $viewModel->setTemplate('leaders-linked/recruitment-and-selection-vacancies/index.phtml');
1384 efrain 173
                $viewModel->setVariable('form', $form);
10112 stevensc 174
                $viewModel->setVariable('google_map_key', $google_map_key);
1561 efrain 175
 
1553 eleazar 176
 
1384 efrain 177
                return $viewModel;
178
            }
179
        } else {
180
            return new JsonModel([
181
                'success' => false,
182
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
183
            ]);
184
            ;
185
        }
186
    }
187
 
188
    public function addAction() {
189
        $request = $this->getRequest();
190
        $currentUserPlugin = $this->plugin('currentUserPlugin');
191
        $currentCompany = $currentUserPlugin->getCompany();
192
        $currentUser = $currentUserPlugin->getUser();
193
 
194
        $request = $this->getRequest();
195
 
196
 
197
        if ($request->isPost()) {
1544 eleazar 198
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
1384 efrain 199
            $dataPost = $request->getPost()->toArray();
12052 eleazar 200
            $actual_date = time();
12161 eleazar 201
            $last_dt = date('Y-d-m', strtotime($dataPost['last_date']));
12146 eleazar 202
            $actual_dt = date('Y-m-d', $actual_date);
12162 eleazar 203
            //return new JsonModel([
204
            //    'success'   => false,
205
            //    'data' => [
206
            //     'last' =>  $last_dt,
207
            //     'actual' => $actual_dt
208
            //    ]
209
            //]);
210
            if($actual_dt > $last_dt){
211
                 return new JsonModel([
212
                     'success' => false,
213
                     'data' => 'ERROR_UNAUTHORIZED'
214
                ]);
215
            }
1387 eleazar 216
            $dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : RecruitmentSelectionVacancy::STATUS_INACTIVE;
1384 efrain 217
 
218
            $form->setData($dataPost);
219
 
220
            if ($form->isValid()) {
221
                $dataPost = (array) $form->getData();
222
 
223
                $hydrator = new ObjectPropertyHydrator();
224
 
1417 eleazar 225
                $location = new Location();
226
                $hydrator->hydrate($dataPost, $location);
1452 eleazar 227
 
228
                $locationMapper= LocationMapper::getInstance($this->adapter);
229
                $result = $locationMapper->insert($location);
1451 eleazar 230
 
1417 eleazar 231
 
1418 eleazar 232
                if (!$result) {
233
                    return new JsonModel([
234
                        'success'   => false,
1575 eleazar 235
                        'data' => 'ERROR_THERE_WAS_AN_ERROR'
1418 eleazar 236
                    ]);
237
                }
1417 eleazar 238
 
1539 eleazar 239
                $vacancy = new RecruitmentSelectionVacancy();
240
                $hydrator->hydrate($dataPost, $vacancy);
1427 eleazar 241
 
1539 eleazar 242
                $vacancy->location_id = $location->id;
1544 eleazar 243
                $vacancy->company_id = $currentCompany->id;
1384 efrain 244
 
1427 eleazar 245
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
246
                $jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
1539 eleazar 247
                $vacancy->job_description_id = $jobDescription->id;
1427 eleazar 248
 
249
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
250
                $jobCategory = $jobCategoryMapper->fetchOneByUuid( $dataPost['job_category_id']);
1539 eleazar 251
                $vacancy->job_category_id = $jobCategory->id;
1427 eleazar 252
 
1428 eleazar 253
                $industryMapper = IndustryMapper::getInstance($this->adapter);
254
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
1539 eleazar 255
                $vacancy->industry_id = $industry->id;
1425 eleazar 256
 
1539 eleazar 257
                $vacancy->description = $dataPost['description'];
258
                $vacancy->last_date = $dataPost['last_date'];
1433 eleazar 259
 
1539 eleazar 260
                $dt = \DateTime::createFromFormat('d/m/Y', $vacancy->last_date);
1433 eleazar 261
                if($dt) {
1539 eleazar 262
                    $vacancy->last_date = $dt->format('Y-m-d');
1433 eleazar 263
                }
1428 eleazar 264
 
1427 eleazar 265
                $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
1430 eleazar 266
 
1539 eleazar 267
                $result = $recruitmentSelectionVacancyMapper->insert($vacancy);
1384 efrain 268
 
269
                if ($result) {
1539 eleazar 270
                    $this->logger->info('Se agrego el proceso de reclutamiento' . $vacancy->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
1384 efrain 271
 
272
                    $data = [
273
                        'success' => true,
274
                        'data' => 'LABEL_RECORD_ADDED'
275
                    ];
276
 
277
                } else {
278
                    $data = [
279
                        'success' => false,
1412 eleazar 280
                        'data' => $recruitmentSelectionVacancyMapper->getError()
1384 efrain 281
                    ];
282
                }
283
 
284
                return new JsonModel($data);
285
            } else {
286
                $messages = [];
287
                $form_messages = (array) $form->getMessages();
288
                foreach ($form_messages as $fieldname => $field_messages) {
289
 
290
                    $messages[$fieldname] = array_values($field_messages);
291
                }
292
 
293
                return new JsonModel([
294
                    'success' => false,
295
                    'data' => $messages
296
                ]);
297
            }
298
        } else {
299
            $data = [
300
                'success' => false,
1575 eleazar 301
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
1384 efrain 302
            ];
303
 
304
            return new JsonModel($data);
305
        }
306
 
307
        return new JsonModel($data);
308
    }
309
 
310
    public function editAction() {
311
        $request = $this->getRequest();
312
        $currentUserPlugin = $this->plugin('currentUserPlugin');
313
        $currentCompany = $currentUserPlugin->getCompany();
314
        $currentUser = $currentUserPlugin->getUser();
315
 
316
        $request = $this->getRequest();
317
        $uuid = $this->params()->fromRoute('id');
318
 
319
 
320
        if (!$uuid) {
321
            $data = [
322
                'success' => false,
323
                'data' => 'ERROR_INVALID_PARAMETER'
324
            ];
325
 
326
            return new JsonModel($data);
327
        }
328
 
1386 eleazar 329
        $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
1575 eleazar 330
        $vacancy = $recruitmentSelectionVacancyMapper->fetchOneByUuid($uuid);
331
        if (!$vacancy) {
1384 efrain 332
            $data = [
333
                'success' => false,
334
                'data' => 'ERROR_RECORD_NOT_FOUND'
335
            ];
336
 
337
            return new JsonModel($data);
338
        }
339
 
1575 eleazar 340
        if ($vacancy->company_id != $currentCompany->id) {
1384 efrain 341
            return new JsonModel([
342
                'success' => false,
343
                'data' => 'ERROR_UNAUTHORIZED'
344
            ]);
345
        }
346
 
347
 
348
        if ($request->isPost()) {
1544 eleazar 349
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
1384 efrain 350
            $dataPost = $request->getPost()->toArray();
1387 eleazar 351
            $dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : RecruitmentSelectionVacancy::STATUS_INACTIVE;
1384 efrain 352
 
353
            $form->setData($dataPost);
354
 
355
            if ($form->isValid()) {
356
                $dataPost = (array) $form->getData();
357
 
358
                $hydrator = new ObjectPropertyHydrator();
1575 eleazar 359
                $hydrator->hydrate($dataPost, $vacancy);
1384 efrain 360
 
1575 eleazar 361
                if (!$vacancy->status) {
362
                    $vacancy->status = RecruitmentSelectionVacancy::STATUS_INACTIVE;
1384 efrain 363
                }
364
 
1578 eleazar 365
                $locationMapper = LocationMapper::getInstance($this->adapter);
366
                $location = $locationMapper->fetchOne($vacancy->location_id);
367
                $hydrator->hydrate($dataPost, $location);
368
                $locationMapper->update($location);
369
 
1384 efrain 370
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
371
                $jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
1575 eleazar 372
                $vacancy->job_description_id = $jobDescription->id;
1384 efrain 373
 
1439 eleazar 374
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
375
                $jobCategory = $jobCategoryMapper->fetchOneByUuid( $dataPost['job_category_id']);
1575 eleazar 376
                $vacancy->job_category_id = $jobCategory->id;
1384 efrain 377
 
1439 eleazar 378
                $industryMapper = IndustryMapper::getInstance($this->adapter);
379
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
1575 eleazar 380
                $vacancy->industry_id = $industry->id;
1439 eleazar 381
 
1575 eleazar 382
                $vacancy->job_description_id = $jobDescription->id;
383
                $vacancy->job_category_id = $jobCategory->id;
1578 eleazar 384
                $vacancy->industry_id = $industry->id;
1577 eleazar 385
 
386
                $result = $recruitmentSelectionVacancyMapper->update($vacancy);
1578 eleazar 387
 
1439 eleazar 388
 
1384 efrain 389
                if ($result) {
1575 eleazar 390
                    $this->logger->info('Se agrego el proceso de reclutamiento' . $vacancy->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
1384 efrain 391
                    $data = [
392
                        'success' => true,
393
                        'data' => 'LABEL_RECORD_UPDATED'
394
                    ];
395
                } else {
396
                    $data = [
397
                        'success' => false,
1386 eleazar 398
                        'data' => $recruitmentSelectionVacancyMapper->getError()
1384 efrain 399
                    ];
400
                }
401
 
402
                return new JsonModel($data);
403
            } else {
404
                $messages = [];
405
                $form_messages = (array) $form->getMessages();
406
                foreach ($form_messages as $fieldname => $field_messages) {
407
                    $messages[$fieldname] = array_values($field_messages);
408
                }
409
 
410
                return new JsonModel([
411
                    'success' => false,
412
                    'data' => $messages
413
                ]);
414
            }
415
        } else if ($request->isGet()) {
416
            $hydrator = new ObjectPropertyHydrator();
417
 
1441 eleazar 418
            $locationMapper = LocationMapper::getInstance($this->adapter);
1575 eleazar 419
            $location = $locationMapper->fetchOne($vacancy->location_id);
1441 eleazar 420
 
1384 efrain 421
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
1575 eleazar 422
            $jobDescription = $jobDescriptionMapper->fetchOne($vacancy->job_description_id);
10258 stevensc 423
            $jobDescritions = [];
1445 eleazar 424
 
10258 stevensc 425
            $records = $currentCompany ?
426
                    $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany->id) :
427
                    $jobDescriptionMapper->fetchAllByDefault();
428
 
429
            foreach ($records as $record)
430
            {
431
                $jobDescritions[$record->uuid] = $record->name;
432
            }
433
 
1445 eleazar 434
            $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
1575 eleazar 435
            $jobCategory = $jobCategoryMapper->fetchOne($vacancy->job_category_id);
10254 stevensc 436
            $jobCategories = [];
1445 eleazar 437
 
10256 stevensc 438
            $records = $jobCategoryMapper->fetchAllActives();
10112 stevensc 439
 
440
            foreach ($records as $record)
441
            {
10254 stevensc 442
                $jobCategories[$record->uuid] = $record->name;
10112 stevensc 443
            }
444
 
1445 eleazar 445
            $industryMapper = IndustryMapper::getInstance($this->adapter);
1575 eleazar 446
            $industry = $industryMapper->fetchOne($vacancy->industry_id);
10254 stevensc 447
            $industries = [];
1445 eleazar 448
 
10254 stevensc 449
            $records = $industryMapper->fetchAllActives();
1445 eleazar 450
 
10254 stevensc 451
            foreach ($records as $record)
452
            {
453
                $industries[$record->uuid] = $record->name;
454
            }
455
 
456
 
1384 efrain 457
            if (!$jobDescription) {
458
                $data = [
459
                    'success' => false,
460
                    'data' => 'ERROR_METHOD_NOT_ALLOWED'
461
                ];
462
 
463
                return new JsonModel($data);
464
            }
465
 
466
            $data = [
467
                'success' => true,
468
                'data' => [
1575 eleazar 469
                    'id' => $vacancy->uuid,
470
                    'name' => $vacancy->name,
10258 stevensc 471
                    'job_description' => [
472
                        'description_options' => $jobDescritions,
473
                        'current_description' => [
474
                            'description_id' => $jobDescription->uuid,
475
                            'description_name' => $jobDescription->name
476
                        ]
477
                    ],
1572 eleazar 478
                    'location_search' => $location->formatted_address,
1570 eleazar 479
                    'formatted_address' => $location->formatted_address,
1572 eleazar 480
                    'address1' => $location->address1,
481
                    'address2' => $location->address2,
1568 eleazar 482
                    'country' => $location->country,
483
                    'state' => $location->state,
484
                    'city1'=> $location->city1,
485
                    'city2' => $location->city2,
486
                    'postal_code' => $location->postal_code,
487
                    'latitude' => $location->latitude,
488
                    'longitude' => $location->longitude,
10112 stevensc 489
                    'job_category' => [
10254 stevensc 490
                        'category_options' => $jobCategories,
491
                        'current_category' => [
10112 stevensc 492
                            'job_category_id' => $jobCategory->uuid,
493
                            'job_category_name' => $jobCategory->name,
494
                        ]
495
                    ],
1575 eleazar 496
                    'description' => $vacancy->description,
10254 stevensc 497
                    'industry' => [
498
                        'industry_options' => $industries,
499
                        'current_industry' => [
500
                            'industry_id' => $industry->uuid,
501
                            'industry_name' => $industry->name,
502
                        ]
503
                    ],
1575 eleazar 504
                    'last_date' => $vacancy->last_date,
505
                    'status' => $vacancy->status,
506
                   // 'content' => $vacancy->content ? json_decode($vacancy->content) : [],
1384 efrain 507
                ]
508
            ];
509
 
510
            return new JsonModel($data);
511
        } else {
512
            $data = [
513
                'success' => false,
1574 eleazar 514
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
1384 efrain 515
            ];
516
 
517
            return new JsonModel($data);
518
        }
519
 
520
        return new JsonModel($data);
521
    }
522
 
523
    public function deleteAction() {
524
        $request = $this->getRequest();
525
        $currentUserPlugin = $this->plugin('currentUserPlugin');
526
        $currentCompany = $currentUserPlugin->getCompany();
527
        $currentUser = $currentUserPlugin->getUser();
528
 
529
        $request = $this->getRequest();
530
        $uuid = $this->params()->fromRoute('id');
531
 
532
        if (!$uuid) {
533
            $data = [
534
                'success' => false,
535
                'data' => 'ERROR_INVALID_PARAMETER'
536
            ];
537
 
538
            return new JsonModel($data);
539
        }
540
 
1386 eleazar 541
        $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
1539 eleazar 542
        $vacancyMapper = $recruitmentSelectionVacancyMapper->fetchOneByUuid($uuid);
543
        if (!$vacancyMapper) {
1384 efrain 544
            $data = [
545
                'success' => false,
546
                'data' => 'ERROR_RECORD_NOT_FOUND'
547
            ];
548
 
549
            return new JsonModel($data);
550
        }
551
 
1544 eleazar 552
        if ($vacancyMapper->company_id != $currentCompany->id) {
1384 efrain 553
            return new JsonModel([
554
                'success' => false,
555
                'data' => 'ERROR_UNAUTHORIZED'
556
            ]);
557
        }
558
 
559
        if ($request->isPost()) {
560
 
561
 
1539 eleazar 562
            $result = $recruitmentSelectionVacancyMapper->delete($vacancyMapper->id);
1384 efrain 563
            if ($result) {
1539 eleazar 564
                $this->logger->info('Se borro el formulario de reclutamiento ' . $vacancyMapper->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
1384 efrain 565
 
566
                $data = [
567
                    'success' => true,
568
                    'data' => 'LABEL_RECORD_DELETED'
569
                ];
570
            } else {
571
 
572
                $data = [
573
                    'success' => false,
1386 eleazar 574
                    'data' => $recruitmentSelectionVacancyMapper->getError()
1384 efrain 575
                ];
576
 
577
                return new JsonModel($data);
578
            }
579
        } else {
580
            $data = [
581
                'success' => false,
582
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
583
            ];
584
 
585
            return new JsonModel($data);
586
        }
587
 
588
        return new JsonModel($data);
589
    }
590
 
591
 
592
 
593
}