Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15457 | Rev 16766 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15457 Rev 15461
Línea 14... Línea 14...
14
use LeadersLinked\Library\Functions;
14
use LeadersLinked\Library\Functions;
15
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
15
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
16
use LeadersLinked\Model\RecruitmentSelectionVacancy;
16
use LeadersLinked\Model\RecruitmentSelectionVacancy;
17
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
17
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
18
use LeadersLinked\Model\Location;
18
use LeadersLinked\Model\Location;
-
 
19
use LeadersLinked\Mapper\BehaviorMapper;
-
 
20
use LeadersLinked\Mapper\CompetencyMapper;
-
 
21
use LeadersLinked\Mapper\CompetencyTypeMapper;
-
 
22
use LeadersLinked\Mapper\JobDescriptionCompetencyBehaviorMapper;
-
 
23
use LeadersLinked\Mapper\JobDescriptionCompetencyMapper;
-
 
24
use LeadersLinked\Mapper\JobDescriptionSubordinateMapper;
19
use LeadersLinked\Mapper\LocationMapper;
25
use LeadersLinked\Mapper\LocationMapper;
20
use LeadersLinked\Mapper\IndustryMapper;
26
use LeadersLinked\Mapper\IndustryMapper;
21
use LeadersLinked\Mapper\JobDescriptionMapper;
27
use LeadersLinked\Mapper\JobDescriptionMapper;
22
use LeadersLinked\Mapper\JobCategoryMapper;
28
use LeadersLinked\Mapper\JobCategoryMapper;
23
use Laminas\Paginator\Adapter\DbSelect;
29
use Laminas\Paginator\Adapter\DbSelect;
Línea 158... Línea 164...
158
                $records = $paginator->getCurrentItems();
164
                $records = $paginator->getCurrentItems();
Línea 159... Línea 165...
159
 
165
 
160
                foreach ($records as $record) {
166
                foreach ($records as $record) {
Línea -... Línea 167...
-
 
167
                    $dt = \DateTime::createFromFormat('Y-m-d', $record['last_date']);
-
 
168
                    
161
                    $dt = \DateTime::createFromFormat('Y-m-d', $record['last_date']);
169
                    
162
                    
170
                    
163
                    switch($record['status'])
171
                    switch($record['status'])
164
                    {
172
                    {
165
                        case RecruitmentSelectionVacancy::STATUS_ACTIVE : 
173
                        case RecruitmentSelectionVacancy::STATUS_ACTIVE : 
Línea 182... Línea 190...
182
                            $status = 'LABEL_UNKNOWN';
190
                            $status = 'LABEL_UNKNOWN';
183
                            break;
191
                            break;
Línea 184... Línea 192...
184
                            
192
                            
Línea -... Línea 193...
-
 
193
                    }
-
 
194
                    
-
 
195
                    
-
 
196
                    if($record['status'] == RecruitmentSelectionVacancy::STATUS_ACTIVE || $record['status'] ==  RecruitmentSelectionVacancy::STATUS_INACTIVE) {
-
 
197
                        $actions = [
-
 
198
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('recruitment-and-selection/vacancies/edit', ['id' => $record['uuid']]) : '',
-
 
199
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('recruitment-and-selection/vacancies/delete', ['id' => $record['uuid']]) : ''
-
 
200
                        ];
-
 
201
                    } else {
-
 
202
                        
-
 
203
                        $actions = [
-
 
204
                            'link_edit' => '',
-
 
205
                            'link_delete' => '',
-
 
206
                        ]; 
185
                    }
207
                    }
186
                    
208
                    
187
                    $item = [
209
                    $item = [
188
                      'name' => $record['name'],
210
                      'name' => $record['name'],
189
                      'job_description' => $record['job_description'],
211
                      'job_description' => $record['job_description'],
190
                      'last_date' => $dt->format('d/m/Y'),
212
                      'last_date' => $dt->format('d/m/Y'),
191
                      'status' => $record->status,
-
 
192
                      'actions' => [
-
 
193
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('recruitment-and-selection/vacancies/edit', ['id' => $record['uuid']]) : '',
-
 
194
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('recruitment-and-selection/vacancies/delete', ['id' => $record['uuid']]) : ''
213
                      'status' => $status,
Línea 195... Línea 214...
195
                       ]
214
                      'actions' =>  $actions,
196
                    ];
215
                    ];
Línea 273... Línea 292...
273
        if ($request->isPost()) {
292
        if ($request->isPost()) {
274
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
293
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
275
            $dataPost = $request->getPost()->toArray();
294
            $dataPost = $request->getPost()->toArray();
Línea -... Línea 295...
-
 
295
 
-
 
296
            
-
 
297
            if(!empty($dataPost['last_date'])) {
-
 
298
                $dt = \DateTime::createFromFormat('d/m/Y', $dataPost['last_date']);
-
 
299
                if($dt) {
-
 
300
                    $dataPost['last_date'] = $dt->format('Y-m-d');
-
 
301
                } else {
-
 
302
                    $dataPost['last_date'] = date('Y-m-d');
-
 
303
                }
Línea 276... Línea 304...
276
 
304
            }
Línea 277... Línea 305...
277
            
305
            
Línea 295... Línea 323...
295
 
323
 
296
 
324
 
297
                if (!$result) {
325
                if (!$result) {
298
                    return new JsonModel([
326
                    return new JsonModel([
299
                        'success'   => false,
327
                        'success'   => false,
300
                        'data' => 'ERROR_THERE_WAS_AN_ERROR'
328
                        'data' => $locationMapper->getError()
Línea 301... Línea 329...
301
                    ]);
329
                    ]);
302
                }
330
                }
Línea 308... Línea 336...
308
                $vacancy->company_id = $currentCompany->id;
336
                $vacancy->company_id = $currentCompany->id;
Línea 309... Línea 337...
309
 
337
 
310
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
338
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
311
                $jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
339
                $jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
-
 
340
                $vacancy->job_description_id = $jobDescription->id;
Línea 312... Línea 341...
312
                $vacancy->job_description_id = $jobDescription->id;
341
                $vacancy->content =  $this->serialize($jobDescription);
313
 
342
 
314
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
343
                $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
Línea 315... Línea 344...
315
                $jobCategory = $jobCategoryMapper->fetchOneByUuid($dataPost['job_category_id']);
344
                $jobCategory = $jobCategoryMapper->fetchOneByUuid($dataPost['job_category_id']);
316
                $vacancy->job_category_id = $jobCategory->id;
345
                $vacancy->job_category_id = $jobCategory->id;
317
 
346
 
Línea 318... Línea 347...
318
                $industryMapper = IndustryMapper::getInstance($this->adapter);
347
                $industryMapper = IndustryMapper::getInstance($this->adapter);
319
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
-
 
Línea 320... Línea -...
320
                $vacancy->industry_id = $industry->id;
-
 
321
 
-
 
322
                $vacancy->description = $dataPost['description'];
-
 
323
                $vacancy->last_date = $dataPost['last_date'];
-
 
324
 
-
 
325
                $dt = \DateTime::createFromFormat('m/d/Y', $vacancy->last_date);
-
 
326
                if ($dt) {
-
 
Línea 327... Línea 348...
327
                    $vacancy->last_date = $dt->format('Y-m-d');
348
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
328
                    
-
 
329
                    
349
                $vacancy->industry_id = $industry->id;
Línea 330... Línea 350...
330
                    
350
 
331
                }
351
                $vacancy->description = $dataPost['description'];
Línea 332... Línea 352...
332
 
352
 
333
 
353
 
334
                $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
354
 
335
 
355
                $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
Línea 415... Línea 435...
415
 
435
 
416
 
436
 
417
        if ($request->isPost()) {
437
        if ($request->isPost()) {
-
 
438
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
-
 
439
            $dataPost = $request->getPost()->toArray();
-
 
440
            
-
 
441
            if(!empty($dataPost['last_date'])) {
-
 
442
                $dt = \DateTime::createFromFormat('d/m/Y', $dataPost['last_date']);
-
 
443
                if($dt) {
-
 
444
                    $dataPost['last_date'] = $dt->format('Y-m-d');
-
 
445
                } else {
-
 
446
                    $dataPost['last_date'] = date('Y-m-d');
-
 
447
                }
418
            $form = new RecruitmentSelectionVacancyForm($this->adapter, $currentCompany->id);
448
            }
Línea 419... Línea 449...
419
            $dataPost = $request->getPost()->toArray();
449
            
Línea 420... Línea 450...
420
            $dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : RecruitmentSelectionVacancy::STATUS_INACTIVE;
450
            $dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : RecruitmentSelectionVacancy::STATUS_INACTIVE;
Línea 429... Línea 459...
429
 
459
 
430
                if (!$vacancy->status) {
460
                if (!$vacancy->status) {
431
                    $vacancy->status = RecruitmentSelectionVacancy::STATUS_INACTIVE;
461
                    $vacancy->status = RecruitmentSelectionVacancy::STATUS_INACTIVE;
Línea 432... Línea -...
432
                }
-
 
433
                
-
 
434
                $dt = \DateTime::createFromFormat('m/d/Y', $vacancy->last_date);
-
 
435
                if ($dt) {
-
 
436
                    $vacancy->last_date = $dt->format('Y-m-d');
-
 
437
                }
462
                }
438
 
463
                
439
                $locationMapper = LocationMapper::getInstance($this->adapter);
464
                $locationMapper = LocationMapper::getInstance($this->adapter);
440
                $location = $locationMapper->fetchOne($vacancy->location_id);
465
                $location = $locationMapper->fetchOne($vacancy->location_id);
Línea 450... Línea 475...
450
                $vacancy->job_category_id = $jobCategory->id;
475
                $vacancy->job_category_id = $jobCategory->id;
Línea 451... Línea 476...
451
 
476
 
452
                $industryMapper = IndustryMapper::getInstance($this->adapter);
477
                $industryMapper = IndustryMapper::getInstance($this->adapter);
453
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
478
                $industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
454
                $vacancy->industry_id = $industry->id;
479
                $vacancy->industry_id = $industry->id;
455
 
-
 
456
                $vacancy->job_description_id = $jobDescription->id;
-
 
457
                $vacancy->job_category_id = $jobCategory->id;
-
 
Línea 458... Línea 480...
458
                $vacancy->industry_id = $industry->id;
480
    
Línea 459... Línea 481...
459
 
481
 
460
                $result = $recruitmentSelectionVacancyMapper->update($vacancy);
482
                $result = $recruitmentSelectionVacancyMapper->update($vacancy);
461
 
483
 
462
 
484
 
463
                if ($result) {
485
                if ($result) {
464
                    $this->logger->info('Se agrego el proceso de reclutamiento' . $vacancy->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
486
                    $this->logger->info('Se actualizo la vancante : ' . $vacancy->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
465
                    $data = [
487
                    $data = [
Línea 492... Línea 514...
492
            $locationMapper = LocationMapper::getInstance($this->adapter);
514
            $locationMapper = LocationMapper::getInstance($this->adapter);
493
            $location = $locationMapper->fetchOne($vacancy->location_id);
515
            $location = $locationMapper->fetchOne($vacancy->location_id);
Línea 494... Línea 516...
494
 
516
 
495
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
517
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
496
            $jobDescription = $jobDescriptionMapper->fetchOne($vacancy->job_description_id);
-
 
497
            $jobDescritions = [];
518
            $jobDescription = $jobDescriptionMapper->fetchOne($vacancy->job_description_id);
498
 
-
 
499
            $records = $currentCompany ?
-
 
500
                $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany->id) :
-
 
501
                $jobDescriptionMapper->fetchAllByDefault();
-
 
502
 
-
 
503
            foreach ($records as $record) {
-
 
504
                $jobDescritions[$record->uuid] = $record->name;
-
 
505
            }
-
 
506
 
519
            
507
            $jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
520
            $jobCategoryMapper =  JobCategoryMapper::getInstance($this->adapter);
508
            $jobCategory = $jobCategoryMapper->fetchOne($vacancy->job_category_id);
-
 
509
            $jobCategories = [];
521
            $jobCategory = $jobCategoryMapper->fetchOne($vacancy->job_category_id);
510
 
-
 
511
            $records = $jobCategoryMapper->fetchAllActive();
-
 
512
 
-
 
513
            foreach ($records as $record) {
-
 
514
                $jobCategories[$record->uuid] = $record->name;
-
 
515
            }
-
 
516
 
522
            
517
            $industryMapper = IndustryMapper::getInstance($this->adapter);
523
            $industryMapper = IndustryMapper::getInstance($this->adapter);
518
            $industry = $industryMapper->fetchOne($vacancy->industry_id);
-
 
519
            $industries = [];
-
 
520
 
-
 
521
            $records = $industryMapper->fetchAllActive();
-
 
522
 
-
 
523
            foreach ($records as $record) {
-
 
524
                $industries[$record->uuid] = $record->name;
-
 
525
            }
-
 
526
 
-
 
527
 
-
 
528
            if (!$jobDescription) {
-
 
529
                $data = [
-
 
530
                    'success' => false,
-
 
531
                    'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
532
                ];
-
 
533
 
-
 
534
                return new JsonModel($data);
-
 
Línea 535... Línea 524...
535
            }
524
            $industry = $industryMapper->fetchOne($vacancy->industry_id);
536
            
525
            
537
 
526
            
Línea 538... Línea 527...
538
            $dt = \DateTime::createFromFormat('Y-m-d', $vacancy->last_date);
527
            $dt = \DateTime::createFromFormat('Y-m-d', $vacancy->last_date);
539
            $last_date = $dt->format('m/d/Y');
528
            $last_date = $dt->format('d/m/Y');
540
 
529
 
541
            $data = [
-
 
542
                'success' => true,
530
            $data = [
543
                'data' => [
-
 
544
                    'id' => $vacancy->uuid,
531
                'success' => true,
545
                    'name' => $vacancy->name,
-
 
546
                    'job_description' => [
532
                'data' => [
547
                        'description_options' => $jobDescritions,
533
                    'name' => $vacancy->name,
548
                        'current_description' => [
-
 
549
                            'description_id' => $jobDescription->uuid,
-
 
550
                            'description_name' => $jobDescription->name
534
                    'job_description_id' =>  $jobDescription->uuid,
551
                        ]
535
                    'job_category_id' => $jobCategory->uuid,
552
                    ],
536
                    'industry_id' => $industry->uuid,
553
                    'location_search' => $location->formatted_address,
537
                    'location_search' => $location->formatted_address,
554
                    'formatted_address' => $location->formatted_address,
538
                    'formatted_address' => $location->formatted_address,
Línea 559... Línea 543...
559
                    'city1' => $location->city1,
543
                    'city1' => $location->city1,
560
                    'city2' => $location->city2,
544
                    'city2' => $location->city2,
561
                    'postal_code' => $location->postal_code,
545
                    'postal_code' => $location->postal_code,
562
                    'latitude' => $location->latitude,
546
                    'latitude' => $location->latitude,
563
                    'longitude' => $location->longitude,
547
                    'longitude' => $location->longitude,
564
                    'job_category' => [
-
 
565
                        'category_options' => $jobCategories,
-
 
566
                        'current_category' => [
-
 
567
                            'job_category_id' => $jobCategory->uuid,
-
 
568
                            'job_category_name' => $jobCategory->name,
-
 
569
                        ]
-
 
570
                    ],
-
 
571
                    'description' => $vacancy->description,
548
                    'description' => $vacancy->description,
572
                    'industry' => [
-
 
573
                        'industry_options' => $industries,
-
 
574
                        'current_industry' => [
-
 
575
                            'industry_id' => $industry->uuid,
-
 
576
                            'industry_name' => $industry->name,
-
 
577
                        ]
-
 
578
                    ],
-
 
579
                    'last_date' => $last_date,
549
                    'last_date' => $last_date,
580
                    'status' => $vacancy->status,
550
                    'status' => $vacancy->status,
581
                    // 'content' => $vacancy->content ? json_decode($vacancy->content) : [],
-
 
-
 
551
 
582
                ]
552
                ]
583
            ];
553
            ];
Línea 584... Línea -...
584
 
-
 
-
 
554
 
585
            return new JsonModel($data);
555
 
586
        } else {
556
        } else {
587
            $data = [
557
            $data = [
588
                'success' => false,
558
                'success' => false,
589
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
559
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
Línea 590... Línea -...
590
            ];
-
 
-
 
560
            ];
591
 
561
 
Línea 592... Línea 562...
592
            return new JsonModel($data);
562
 
593
        }
563
        }
Línea 661... Línea 631...
661
            return new JsonModel($data);
631
            return new JsonModel($data);
662
        }
632
        }
Línea 663... Línea 633...
663
 
633
 
664
        return new JsonModel($data);
634
        return new JsonModel($data);
-
 
635
    }
-
 
636
    
-
 
637
    
-
 
638
    
-
 
639
    public function serialize($jobDescription)
-
 
640
    {
-
 
641
        
-
 
642
        
-
 
643
        
-
 
644
        
-
 
645
        $behaviorMapper = BehaviorMapper::getInstance($this->adapter);
-
 
646
        $competencyMapper = CompetencyMapper::getInstance($this->adapter);
-
 
647
        $competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
-
 
648
        
-
 
649
        $competencyTypes = [];
-
 
650
        $competencies = [];
-
 
651
        $behaviors = [];
-
 
652
        $competencies_selected = [];
-
 
653
        $subordinates_selected = [];
-
 
654
        
-
 
655
        $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
-
 
656
        $jobDescriptionCompetencyBehaviorMapper = JobDescriptionCompetencyBehaviorMapper::getInstance($this->adapter);
-
 
657
        
-
 
658
        $jobDescriptionCompetencies = $jobDescriptionCompetencyMapper->fetchAllByJobDescriptionId($jobDescription->id);
-
 
659
        foreach($jobDescriptionCompetencies as $jobDescriptionCompetency)
-
 
660
        {
-
 
661
            
-
 
662
            if(isset($competencies[$jobDescriptionCompetency->competency_id])) {
-
 
663
                $competency = $competencies[$jobDescriptionCompetency->competency_id];
-
 
664
            } else {
-
 
665
                
-
 
666
                $competency = $competencyMapper->fetchOne($jobDescriptionCompetency->competency_id);
-
 
667
                if(!$competency) {
-
 
668
                    continue;
-
 
669
                }
-
 
670
                
-
 
671
                
-
 
672
                
-
 
673
                $competencies[$jobDescriptionCompetency->competency_id] = new \stdClass();
-
 
674
                $competencies[$jobDescriptionCompetency->competency_id]->uuid = $competency->uuid;
-
 
675
                $competencies[$jobDescriptionCompetency->competency_id]->name = $competency->name;
-
 
676
                $competencies[$jobDescriptionCompetency->competency_id]->description = $competency->description;
-
 
677
                
-
 
678
            }
-
 
679
            
-
 
680
            
-
 
681
            if(isset($competencyTypes[$competency->competency_type_id])) {
-
 
682
                $competencyType = $competencyTypes[$competency->competency_type_id];
-
 
683
            } else {
-
 
684
                
-
 
685
                $competencyType = $competencyTypeMapper->fetchOne($competency->competency_type_id);
-
 
686
                if(!$competencyType) {
-
 
687
                    continue;
-
 
688
                }
-
 
689
                
-
 
690
                $competencyTypes[$competency->competency_type_id] = new \stdClass();
-
 
691
                $competencyTypes[$competency->competency_type_id]->uuid = $competencyType->uuid;
-
 
692
                $competencyTypes[$competency->competency_type_id]->name = $competencyType->name;
-
 
693
                $competencyTypes[$competency->competency_type_id]->description = $competencyType->description;
-
 
694
                
-
 
695
            }
-
 
696
            
-
 
697
            $competency_selected = [
-
 
698
                'uuid' => $competency->uuid,
-
 
699
                'competency_type_uuid' => $competencyType->uuid,
-
 
700
                'behaviors' => []
-
 
701
            ];
-
 
702
            
-
 
703
            
-
 
704
            $jobDescriptionCompetencyBehaviors = $jobDescriptionCompetencyBehaviorMapper->fetchAllByJobDescriptionIdAndCompetencyId($jobDescriptionCompetency->job_description_id, $jobDescriptionCompetency->competency_id);
-
 
705
            foreach($jobDescriptionCompetencyBehaviors as $jobDescriptionCompetencyBehavior)
-
 
706
            {
-
 
707
                
-
 
708
                
-
 
709
                if(isset($behaviors[$jobDescriptionCompetencyBehavior->behavior_id])) {
-
 
710
                    $behavior = $behaviors[$jobDescriptionCompetencyBehavior->behavior_id];
-
 
711
                } else {
-
 
712
                    
-
 
713
                    $behavior = $behaviorMapper->fetchOne($jobDescriptionCompetencyBehavior->behavior_id);
-
 
714
                    if(!$behavior) {
-
 
715
                        
-
 
716
                        continue;
-
 
717
                    }
-
 
718
                    
-
 
719
                    $behaviors[$jobDescriptionCompetencyBehavior->behavior_id] = new \stdClass();
-
 
720
                    $behaviors[$jobDescriptionCompetencyBehavior->behavior_id]->uuid = $behavior->uuid;
-
 
721
                    $behaviors[$jobDescriptionCompetencyBehavior->behavior_id]->description = $behavior->description;
-
 
722
                    
-
 
723
                }
-
 
724
                
-
 
725
                
-
 
726
                
-
 
727
                
-
 
728
                array_push($competency_selected['behaviors'], ['uuid' => $behavior->uuid, 'level' => $jobDescriptionCompetencyBehavior->level]);
-
 
729
                
-
 
730
                
-
 
731
            }
-
 
732
            
-
 
733
            array_push($competencies_selected, $competency_selected);
-
 
734
            
-
 
735
            
-
 
736
            
-
 
737
        }
-
 
738
        
-
 
739
        
-
 
740
        $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
-
 
741
        
-
 
742
        $jobDescriptionSubordinateMapper = JobDescriptionSubordinateMapper::getInstance($this->adapter);
-
 
743
        $jobDescriptionSubordinates = $jobDescriptionSubordinateMapper->fetchAllByJobDescriptionIdTopLevel($jobDescription->id);
-
 
744
        
-
 
745
        foreach($jobDescriptionSubordinates as $jobDescriptionSubordinate)
-
 
746
        {
-
 
747
            $jobDescriptionForSubordinate = $jobDescriptionMapper->fetchOne($jobDescriptionSubordinate->job_description_id_low_level);
-
 
748
            if($jobDescriptionForSubordinate) {
-
 
749
                array_push($subordinates_selected, ['uuid' => $jobDescriptionForSubordinate->uuid ]);
-
 
750
            }
-
 
751
            
-
 
752
            
-
 
753
            
-
 
754
        }
-
 
755
        
-
 
756
        if($jobDescription->job_description_id_boss) {
-
 
757
            
-
 
758
            $jobDescriptionBoss = $jobDescriptionMapper->fetchOne($jobDescription->job_description_id_boss);
-
 
759
            if($jobDescriptionBoss) {
-
 
760
                $job_description_id_boss = $jobDescriptionBoss->uuid;
-
 
761
            }
-
 
762
        } else {
-
 
763
            $job_description_id_boss = '';
-
 
764
        }
-
 
765
        
-
 
766
        $content = [
-
 
767
            'uuid' => $jobDescription->uuid,
-
 
768
            'name' => $jobDescription->name,
-
 
769
            'functions' => $jobDescription->functions,
-
 
770
            'objectives' => $jobDescription->objectives,
-
 
771
            'job_description_id_boss' => $job_description_id_boss,
-
 
772
            'competency_types' => $competencyTypes,
-
 
773
            'competencies' => $competencies,
-
 
774
            'behaviors' => $behaviors,
-
 
775
            'competencies_selected' => $competencies_selected,
-
 
776
            'subordinates_selected' => $subordinates_selected,
-
 
777
            
-
 
778
        ];
-
 
779
        
-
 
780
        return json_encode($content);
665
    }
781
    }