Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 846 Rev 847
Línea 144... Línea 144...
144
                        'total' => $paginator->getTotalItemCount(),
144
                        'total' => $paginator->getTotalItemCount(),
145
                    ]
145
                    ]
146
                ]);
146
                ]);
147
            } else {
147
            } else {
Línea 148... Línea 148...
148
 
148
 
Línea 149... Línea 149...
149
                $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id : 0);
149
                $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id : null);
150
 
150
 
151
                $this->layout()->setTemplate('layout/layout-backend');
151
                $this->layout()->setTemplate('layout/layout-backend');
152
                $viewModel = new ViewModel();
152
                $viewModel = new ViewModel();
Línea 232... Línea 232...
232
            ];
232
            ];
Línea 233... Línea 233...
233
 
233
 
234
 
234
 
235
            return new JsonModel($data);
235
            return new JsonModel($data);
236
        } else if ($request->isPost()) {
236
        } else if ($request->isPost()) {
Línea 237... Línea 237...
237
            $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id : 0);
237
            $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id : null );
Línea 249... Línea 249...
249
 
249
 
Línea 250... Línea 250...
250
                if (!empty($dataPost['job_description_id_boss'])) {
250
                if (!empty($dataPost['job_description_id_boss'])) {
251
 
251
 
252
                    $jobDescriptionBoss = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id_boss']);
252
                    $jobDescriptionBoss = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id_boss']);
253
                    if ($jobDescriptionBoss) {
253
                    if ($jobDescriptionBoss) {
254
                        if ($jobDescriptionBoss->company_id == $currentCompany->id) {
254
                        if ($jobDescriptionBoss->company_id == $currentCompany ? $currentCompany->id : null) {
255
                            $dataPost['job_description_id_boss'] = $jobDescriptionBoss->id;
255
                            $dataPost['job_description_id_boss'] = $jobDescriptionBoss->id;
256
                        } else {
256
                        } else {
257
                            $dataPost['job_description_id_boss'] = null;
257
                            $dataPost['job_description_id_boss'] = null;
Línea 267... Línea 267...
267
                $jobDescription = new JobDescription();
267
                $jobDescription = new JobDescription();
Línea 268... Línea 268...
268
 
268
 
Línea 269... Línea 269...
269
                $hydrator->hydrate($dataPost, $jobDescription);
269
                $hydrator->hydrate($dataPost, $jobDescription);
270
 
270
 
271
                if ($currentCompany) {
271
                if ($currentCompany) {
Línea 272... Línea 272...
272
                    $jobDescription->company_id = $currentCompany->id;
272
                    $jobDescription->company_id = $currentCompany ? $currentCompany->id : null;
273
                }
273
                }
Línea 284... Línea 284...
284
                    $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
284
                    $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
285
                    $jobDescriptionCompetencyMapper->deleteAllBJobDescriptionId($jobDescription->id);
285
                    $jobDescriptionCompetencyMapper->deleteAllBJobDescriptionId($jobDescription->id);
Línea 286... Línea 286...
286
 
286
 
287
 
287
 
Línea 288... Línea 288...
288
                    $competencyMapper = CompetencyMapper::getInstance($this->adapter);
288
                    $competencyMapper = CompetencyMapper::getInstance($this->adapter);
289
                    $competencies = $competencyMapper->fetchAllActiveByCompanyId($currentCompany->id);
289
                    $competencies = $competencyMapper->fetchAllActiveByCompanyId($currentCompany ? $currentCompany->id : null);
290
 
290
 
Línea 380... Línea 380...
380
            ];
380
            ];
Línea 381... Línea 381...
381
 
381
 
382
            return new JsonModel($data);
382
            return new JsonModel($data);
Línea 383... Línea 383...
383
        }
383
        }
384
 
384
 
385
        if ($jobDescription->company_id != $currentCompany->id) {
385
        if ($jobDescription->company_id != $currentCompany ? $currentCompany->id : null) {
386
            $data = [
386
            $data = [
387
                'success' => false,
387
                'success' => false,
Línea 388... Línea 388...
388
                'data' => 'ERROR_UNAUTHORIZED'
388
                'data' => 'ERROR_UNAUTHORIZED'
389
            ];
389
            ];
Línea 390... Línea 390...
390
 
390
 
391
            return new JsonModel($data);
391
            return new JsonModel($data);
392
        }
392
        }
Línea 393... Línea 393...
393
 
393
 
Línea 433... Línea 433...
433
                    $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
433
                    $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
434
                    $jobDescriptionCompetencyMapper->deleteAllBJobDescriptionId($jobDescription->id);
434
                    $jobDescriptionCompetencyMapper->deleteAllBJobDescriptionId($jobDescription->id);
Línea 435... Línea 435...
435
 
435
 
436
 
436
 
Línea 437... Línea 437...
437
                    $competencyMapper = CompetencyMapper::getInstance($this->adapter);
437
                    $competencyMapper = CompetencyMapper::getInstance($this->adapter);
438
                    $competencies = $competencyMapper->fetchAllActiveByCompanyId($currentCompany->id);
438
                    $competencies = $competencyMapper->fetchAllActiveByCompanyId($currentCompany ? $currentCompany->id : null);
439
 
439
 
Línea 448... Línea 448...
448
                            $jobDescriptionCompetencyMapper->insert($jobDescriptionCompetency);
448
                            $jobDescriptionCompetencyMapper->insert($jobDescriptionCompetency);
449
                        }
449
                        }
450
                    }
450
                    }
Línea 451... Línea 451...
451
 
451
 
452
 
452
 
453
                    $jobsDescriptionListingSubordinate = $jobDescriptionMapper->fetchAllActiveByCompanyIdWhereIdNotEqual($currentCompany->id, $jobDescription->id);
453
                    $jobsDescriptionListingSubordinate = $jobDescriptionMapper->fetchAllActiveByCompanyIdWhereIdNotEqual($currentCompany ? $currentCompany->id : null, $jobDescription->id);
454
                    foreach ($jobsDescriptionListingSubordinate as $jobDescriptionListingSubordinate) {
454
                    foreach ($jobsDescriptionListingSubordinate as $jobDescriptionListingSubordinate) {
455
                        $job_description_subordinate = filter_var($this->params()->fromPost('job_description_id_subordinate' . $jobDescriptionListingSubordinate->uuid, ''), FILTER_SANITIZE_STRING);
455
                        $job_description_subordinate = filter_var($this->params()->fromPost('job_description_id_subordinate' . $jobDescriptionListingSubordinate->uuid, ''), FILTER_SANITIZE_STRING);
456
                        if ($job_description_subordinate) {
456
                        if ($job_description_subordinate) {
Línea 508... Línea 508...
508
 
508
 
Línea 509... Línea 509...
509
 
509
 
510
            $data['competency_types'] = [];
510
            $data['competency_types'] = [];
Línea 511... Línea 511...
511
 
511
 
512
            $competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
512
            $competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
513
            $records = $competencyTypeMapper->fetchAllByCompanyId($currentCompany->id);
513
            $records = $competencyTypeMapper->fetchAllByCompanyId($currentCompany ? $currentCompany->id : null);
514
 
514
 
Línea 526... Línea 526...
526
 
526
 
Línea 527... Línea 527...
527
 
527
 
528
            $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
528
            $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
Línea 529... Línea 529...
529
 
529
 
530
            $competencyMapper = CompetencyMapper::getInstance($this->adapter);
530
            $competencyMapper = CompetencyMapper::getInstance($this->adapter);
Línea 553... Línea 553...
553
 
553
 
Línea 554... Línea 554...
554
            $data['jobs_description'] = [];
554
            $data['jobs_description'] = [];
555
 
555
 
556
            $jobsDescriptionUUID = [];
556
            $jobsDescriptionUUID = [];
Línea 557... Línea 557...
557
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
557
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
558
            $records = $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany->id);
558
            $records = $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany ? $currentCompany->id : null);
559
 
559
 
560
            foreach ($records as $record) {
560
            foreach ($records as $record) {
Línea 632... Línea 632...
632
            ];
632
            ];
Línea 633... Línea 633...
633
 
633
 
634
            return new JsonModel($data);
634
            return new JsonModel($data);
Línea 635... Línea 635...
635
        }
635
        }
636
 
636
 
637
        if ($jobDescription->company_id != $currentCompany->id) {
637
        if ($jobDescription->company_id != $currentCompany ? $currentCompany->id : null) {
638
            $data = [
638
            $data = [
639
                'success' => false,
639
                'success' => false,
Línea 701... Línea 701...
701
            ];
701
            ];
Línea 702... Línea 702...
702
 
702
 
703
            return new JsonModel($data);
703
            return new JsonModel($data);
Línea 704... Línea 704...
704
        }
704
        }
705
 
705
 
706
        if ($jobDescription->company_id != $currentCompany->id) {
706
        if ($jobDescription->company_id != $currentCompany ? $currentCompany->id : null) {
707
            $data = [
707
            $data = [
708
                'success' => false,
708
                'success' => false,
Línea 737... Línea 737...
737
    public function renderPDF($currentCompany, $jobDescription) {
737
    public function renderPDF($currentCompany, $jobDescription) {
Línea 738... Línea 738...
738
 
738
 
739
        //Generate New PDF
739
        //Generate New PDF
Línea 740... Línea 740...
740
        $pdf = new JobPDF();
740
        $pdf = new JobPDF();
-
 
741
 
741
 
742
        
742
 
743
        if($currentCompany){
743
        //get company Data
744
        //get company Data
Línea 744... Línea 745...
744
        $companyMapper = CompanyMapper::getInstance($this->adapter);
745
        $companyMapper = CompanyMapper::getInstance($this->adapter);
Línea 745... Línea 746...
745
        $company = $companyMapper->fetchOne($currentCompany->id);
746
        $company = $companyMapper->fetchOne($currentCompany->id);
746
 
747
 
Línea -... Línea 748...
-
 
748
        $target_path = $this->config['leaderslinked.fullpath.company'] . DIRECTORY_SEPARATOR . $company->uuid;
-
 
749
 
747
        $target_path = $this->config['leaderslinked.fullpath.company'] . DIRECTORY_SEPARATOR . $company->uuid;
750
        $pdf->header = $company->header ? $target_path . DIRECTORY_SEPARATOR . $company->header : '';
Línea 748... Línea 751...
748
 
751
        $pdf->footer = $company->footer ? $target_path . DIRECTORY_SEPARATOR . $company->footer : '';
749
        $pdf->header = $company->header ? $target_path . DIRECTORY_SEPARATOR . $company->header : '';
752