protected function saveInterview($newJobInterview, $selectedInterviewerArrayList) { $empNumber = sfContext::getInstance()->getUser()->getEmployeeNumber(); $name = $this->getValue('name'); $date = $this->getValue('date'); $time = $this->getValue('time'); $note = $this->getValue('note'); $newJobInterview->setInterviewName($name); $newJobInterview->setInterviewDate($date); if (!empty($time)) { $newJobInterview->setInterviewTime($time); } else { $newJobInterview->setInterviewTime($this->defaultTime); } $newJobInterview->setNote($note); $newJobInterview->setCandidateVacancyId($this->candidateVacancyId); $newJobInterview->setCandidateId($this->candidateId); if (!empty($this->interviewId)) { $this->getInterviewService()->updateJobInterview($newJobInterview); $this->resultArray['messageType'] = 'success'; $this->resultArray['message'] = __(TopLevelMessages::UPDATE_SUCCESS); } else { $newJobInterview->save(); } $interviewId = $newJobInterview->getId(); if (!empty($selectedInterviewerArrayList)) { for ($i = 0; $i < count($selectedInterviewerArrayList); $i++) { $newInterviewer = new JobInterviewInterviewer(); $newInterviewer->setInterviewerId($selectedInterviewerArrayList[$i]); $newInterviewer->setInterviewId($interviewId); $newInterviewer->save(); } } else { $interviewers = $newJobInterview->getJobInterviewInterviewer(); foreach ($interviewers as $interviewer) { $selectedInterviewerArrayList[] = $interviewer->getInterviewerId(); } } //Now send mail to HR admin and Hiring manager $interviewMailer = new InterviewMailer($empNumber, $this->candidateId, $this->vacancyId, $this->selectedAction, $newJobInterview, $selectedInterviewerArrayList); $interviewMailer->send(); return $interviewId; }
/** * */ public function performAction() { $note = $this->getValue('notes'); if ($this->id > 0) { $history = $this->getCandidateService()->getCandidateHistoryById($this->id); $history->setNote($note); $this->getCandidateService()->saveCandidateHistory($history); $this->historyId = $history->getId(); $resultArray['messageType'] = 'success'; $resultArray['message'] = __(TopLevelMessages::SAVE_SUCCESS); return $resultArray; } $result = $this->getCandidateService()->updateCandidateVacancy($this->selectedCandidateVacancy, $this->selectedAction, sfContext::getInstance()->getUser()->getAttribute('user')); $interviews = $this->getInterviewService()->getInterviewsByCandidateVacancyId($this->candidateVacancyId); $interview = $interviews[count($interviews) - 1]; $candidateHistory = new CandidateHistory(); $candidateHistory->setCandidateId($this->candidateId); $candidateHistory->setVacancyId($this->vacancyId); $candidateHistory->setAction($this->selectedAction); $candidateHistory->setCandidateVacancyName($this->selectedCandidateVacancy->getVacancyName()); if (!empty($interview)) { if ($this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_INTERVIEW || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_2ND_INTERVIEW || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_MARK_INTERVIEW_PASSED || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_MARK_INTERVIEW_FAILED) { $candidateHistory->setInterviewId($interview->getId()); } } $empNumber = sfContext::getInstance()->getUser()->getEmployeeNumber(); if ($empNumber == 0) { $empNumber = null; } $candidateHistory->setPerformedBy($empNumber); $date = date('Y-m-d'); $candidateHistory->setPerformedDate($date . " " . date('H:i:s')); $candidateHistory->setNote($note); $result = $this->getCandidateService()->saveCandidateHistory($candidateHistory); $this->historyId = $candidateHistory->getId(); if ($this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_HIRE) { $employee = new Employee(); $employee->firstName = $this->selectedCandidateVacancy->getJobCandidate()->getFirstName(); $employee->middleName = $this->selectedCandidateVacancy->getJobCandidate()->getMiddleName(); $employee->lastName = $this->selectedCandidateVacancy->getJobCandidate()->getLastName(); $employee->emp_oth_email = $this->selectedCandidateVacancy->getJobCandidate()->getEmail(); $employee->job_title_code = $this->selectedCandidateVacancy->getJobVacancy()->getJobTitleCode(); $employee->jobTitle = $this->selectedCandidateVacancy->getJobVacancy()->getJobTitle(); $this->getCandidateService()->addEmployee($employee); } //Now send mail to HR admin and Hiring manager $interviewMailer = new InterviewMailer($empNumber, $this->candidateId, $this->vacancyId, $this->selectedAction, null); $interviewMailer->send(); }