Exemple #1
0
 public function save()
 {
     $resultArray = array();
     $jobTitle = $this->getValue('jobTitle');
     $jobDescription = $this->getValue('jobDescription');
     $note = $this->getValue('note');
     $jobSpec = $this->getValue('jobSpec');
     $jobSpecUpdate = $this->getValue('jobSpecUpdate');
     if (!empty($this->jobTitleId)) {
         $jobTitleObj = $this->getJobTitleService()->getJobTitleById($this->jobTitleId);
         $attachment = $jobTitleObj->getJobSpecificationAttachment();
         if (!empty($attachment) && $jobSpecUpdate != self::CONTRACT_KEEP) {
             $attachment->delete();
         }
         $resultArray['messageType'] = 'success';
         $resultArray['message'] = __(TopLevelMessages::UPDATE_SUCCESS);
     } else {
         $jobTitleObj = new JobTitle();
         $resultArray['messageType'] = 'success';
         $resultArray['message'] = __(TopLevelMessages::SAVE_SUCCESS);
     }
     $jobTitleObj->setJobTitleName($jobTitle);
     $jobTitleObj->setJobDescription($jobDescription);
     $jobTitleObj->setNote($note);
     if (!empty($jobSpec)) {
         $jobTitleObj->setJobSpecificationAttachment($this->__getJobSpecAttachmentObj());
     } else {
         $jobTitleObj->setJobSpecificationAttachment(null);
     }
     $jobTitleObj->save();
     return $resultArray;
 }