/** * Validiere TitleMain eingaben im Formular. * * Zusätzlich zu den normalen Validierungen für Formularelemente wird geprüft, ob eine Sprache zweimal ausgewählt * wurde. * * @param array $data * @return boolean */ public function isValid($data, $context = null) { // wird immer aufgerufen um gegebenenfalls weitere Nachrichten anzuzeigen $result = true; if (!is_null($this->_subformValidator)) { if (array_key_exists($this->getName(), $data)) { $this->_subformValidator->prepareValidation($this, $data[$this->getName()], $context); $result = $this->_subformValidator->isValid($data[$this->getName()], $context); } } return $result && parent::isValid($data); }
/** * Saves form data, including document saving * @param type $form * @return JsonResponse */ public function saveData($form) { if ($form->isValid()) { $data = $form->getData(); try { $em = $this->getDoctrine()->getManager(); // Subo el fichero y luego lo guardo $data->upload(); $em->persist($data); $em->flush(); $response['success'] = true; } catch (\Exception $e) { $response['success'] = false; $response['cause'] = $e->getMessage(); } } else { $response['success'] = false; $response['cause'] = $form->getErrorsAsString(); } return new JsonResponse($response); }
/** * * @param type $form * @return type */ public function save($form) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; } $candDetails = ""; $canProcess = true; $flag = 'true'; $profile_model = new Default_Model_Profiles(); $req_model = new Default_Model_Requisition(); $cand_model = new Default_Model_Candidatedetails(); if ($form->isValid($this->_request->getPost())) { $id = $this->getRequest()->getParam('id'); $technology = $this->_getParam('technology', null); $firstname = $this->_getParam('firstname', null); $lastname = $this->_getParam('lastname', null); $fullname = $firstname . ' ' . $lastname; $email = $this->_getParam('emailaddress', null); $contact = $this->_getParam('contact', null); $totalexprience = $this->_getParam('totalexprience', null); $releventexprience = $this->_getParam('releventexprience', null); $currentCTC = $this->_getParam('currentCTC', null); $expectedCTC = $this->_getParam('expectedCTC', null); $currentcompany = $this->_getParam('currentcompany', null); $currentlocation = $this->_getParam('currentlocation', null); $noticeperiod = $this->_getParam('noticeperiod', null); $requisition_id = $this->_getParam('requisition_id', null); $cvcommentdescription = $this->_getParam('cvcommentdescription', null); $candresume = $this->_getParam('cand_resume', null); $data = array('requisition_id' => $requisition_id, 'technology' => $technology, 'firstname' => trim($firstname), 'lastname' => trim($lastname), 'fullname' => trim($fullname), 'emailaddress' => trim($email), 'contact' => trim($contact), 'totalexprience' => $totalexprience, 'releventexprience' => $releventexprience, 'currentCTC' => $currentCTC, 'expectedCTC' => $expectedCTC, 'currentcompany' => $currentcompany, 'currentlocation' => $currentlocation, 'noticeperiod' => $noticeperiod, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'profilelastmodifiedon' => gmdate("Y-m-d H:i:s"), 'cvcommentdescription' => $cvcommentdescription, 'cand_resume' => $candresume); $data1 = array('requisition_id' => $requisition_id, 'candidate_firstname' => trim($firstname), 'candidate_lastname' => trim($lastname), 'candidate_name' => trim($fullname), 'emailid' => trim($email), 'contact_number' => trim($contact) == '' ? NULL : trim($contact), 'cand_resume' => $candresume, 'cand_status' => "Not Scheduled", 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'cand_technology' => trim($technology), 'totalexprience' => trim($totalexprience), 'releventexprience' => trim($releventexprience), 'currentCTC' => trim($currentCTC), 'expectedCTC' => trim($expectedCTC), 'currentcompany' => trim($currentcompany), 'currentlocation' => trim($currentlocation), 'noticeperiod' => trim($noticeperiod)); $where = ""; $actionflag = 1; if ($id != '') { unset($data['createdby']); unset($data['createddate']); unset($data['isactive']); $where = "id = " . $id; $tableid = $id; $actionflag = 2; if ($canProcess) { $result1 = $cand_model->SaveorUpdateCandidateData($data1, ""); } //perform this action only if login user role is not HRRECRUITER role if ($loginuserRole != HRRECRUITER) { $cvshortlistedstatus = ""; try { //CV Shortlisted status and comments $cvshortlistedstatus = 1; $cvcommentdescription = $this->_getParam('cvcommentdescription', null); $insertCVShortlistDetailsResult = $req_model->insertCVShortlistDetails($id, $requisition_id, $cvshortlistedstatus, $cvcommentdescription, trim($loginUserId), gmdate("Y-m-d H:i:s")); } catch (Exception $xyz) { } } } if ($where == '') { $canProcess = true; //$canProcess = $cand_model->IsCandidateExists($candidate_firstname, $candidate_lastname, $contact_number, $emailid, $cand_technology); } if ($canProcess) { $result = $profile_model->SaveorUpdateCandidateData($data, $where); } else { echo "<script> alert('Profile already exists....!'); </script>"; } $candData = $cand_model->getCandidateForView($result1); if (isset($cvshortlistedstatus) || strlen(trim($cvshortlistedstatus)) > 0) { //updating existing CV $this->requisition_cvupload_emails($requisition_id, "Update", $candData); } else { if ($requisition_id !== NULL) { //new CV $this->requisition_cvupload_emails($requisition_id, "New", $candData); } } //send email end ------------------------------------------------- if ($id == '') { $tableid = $result; } if ($result != '') { $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/profiles'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id == '') { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details added successfully.")); } elseif ($id !== '' && $requisition_id !== '') { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details Added successfully to Resource Pooling.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details updated successfully.")); } $this->_redirect('/profiles'); } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
/** * * @param type $emppersonaldetailsform * @param type $userid * @return type */ public function save($emppersonaldetailsform, $userid) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } if ($emppersonaldetailsform->isValid($this->_request->getPost())) { $post_values = $this->_request->getPost(); $new_post_values = array_filter($post_values); $empperdetailsModal = new Default_Model_Empprobationreview(); $id = $this->_request->getParam('id'); $user_id = $userid; $feedback = $this->_request->getParam('feedback'); $probationstatus = $this->_request->getParam('probationstatus'); $reviewdate = $this->_request->getParam('reviewdate'); $nextreviewdate = $this->_request->getParam('next_reviewdate'); $reviewdate = sapp_Global::change_date($reviewdate, 'database'); $nextreviewdate = sapp_Global::change_date($nextreviewdate, 'database'); $data = array('user_id' => $user_id, 'probationdate' => $reviewdate, 'next_reviewdate' => $nextreviewdate, 'comments' => $feedback, 'status' => $probationstatus, 'createdby' => $loginUserId, 'isactive' => 1, 'createddate' => gmdate("Y-m-d H:i:s")); $where = ''; $actionflag = 1; $menumodel = new Default_Model_Menu(); $empperdetailsModal->makeInactiveExistingRecords($user_id); $Id = $empperdetailsModal->SaveorUpdateEmpPersonalData($data, $where); $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee probation review details added successfully.")); $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id); $this->_redirect('empprobationreview/edit/userid/' . $userid); } else { $messages = $emppersonaldetailsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } //echo '<pre>';print_r($msgarray);exit; return $msgarray; } }
/** * * @param type $form * @param type $data * @return type */ public function save($form, $data) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $cand_model = new Default_Model_Candidatedetails(); $requi_model = new Default_Model_Requisition(); $interview_model = new Default_Model_Interviewdetails(); $user_model = new Default_Model_Usermanagement(); $interview_round_model = new Default_Model_Interviewrounddetails(); $form->round_status->setRequired(false); $form->interview_feedback->setRequired(false); $cand_status = $this->_getParam('cand_status', null); $interview_status = $this->_getParam('interview_status', null); $flag = 'true'; if ($interview_status == 'On hold' && $cand_status != 'On hold') { $msgarray['statusErr'] = 'Since the interview status is onhold, the candidate status should be onhold.'; $flag = 'false'; } if ($interview_status == 'Completed' && ($cand_status != 'Disqualified' && $cand_status != 'Shortlisted')) { $msgarray['statusErr'] = 'Since interview status is completed, the candidate status can be either disqualified or shortlisted.'; $flag = 'false'; } if ($interview_status == 'In process' && ($cand_status == 'Disqualified' || $cand_status == 'Shortlisted')) { $msgarray['statusErr'] = 'Since the interview status is in process, the candidate cannot be shortlisted or disqualified.'; $flag = 'false'; } if ($form->isValid($this->_request->getPost()) && $flag != 'false') { $id = $this->_getParam('id', null); $requisition_id = $this->_getParam('req_id', null); $candidate_id = $this->_getParam('candidate_name', null); $interviewer_ids = $this->_getParam('interviewer_id', null); $interview_panel = implode(",", $interviewer_ids); $interviewer_id = 0; foreach ($interviewer_ids as $interview) { $interviewer_id = $interview; break; } $int_location = $this->_getParam('int_location', null); $country = $this->_getParam('country', null); $state = $this->_getParam('state', null); $city = $this->_getParam('city', null); $interview_mode = $this->_getParam('interview_mode', null); $interview_type_details = $this->_getParam('interview_Type_Details', null); $interview_time = $this->_getParam('interview_time', null); $interview_date = $this->_getParam('interview_date', null); $interview_round = $this->_getParam('interview_round', null); if (!isset($candidate_id)) { $candidate_id = $data['id']; } if (empty($data)) { $getExistingCandidateRecord = $interview_model->getCandidateInInterviewProcess(trim($candidate_id)); if ($getExistingCandidateRecord > 0) { $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview already scheduled for this candidate.'); $this->_redirect('/scheduleinterviews'); } } if (empty($data)) { $idata = array('req_id' => $requisition_id, 'candidate_id' => trim($candidate_id), 'interview_status' => trim($interview_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $idata['interview_status'] = 'In process'; $iwhere = ""; $actionflag = 1; $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere); if ($id == '') { $tableid = $iresult; } if ($iresult != '') { $irdata = array('interview_id' => $iresult, 'req_id' => $requisition_id, 'candidate_id' => $candidate_id, 'interviewer_id' => $interviewer_id, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date($interview_date, 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_type_details, 'interview_round_number' => 1, 'interview_round' => trim($interview_round), 'int_location' => trim($int_location), 'int_country' => trim(intval($country)), 'int_state' => trim(intval($state)), 'int_city' => trim(intval($city)), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel); $ir_result = $interview_round_model->SaveorUpdateInterviewroundData($irdata, ''); $requisition_data = $requi_model->getRequisitionDataById($requisition_id); $cand_data = $cand_model->getCandidateById($candidate_id); $hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]); $requisition_data = $requi_model->getrequisitiondetails($requisition_id); $requesteremailaddress = $requi_model->getemployeeemailaddress($requisition_data["createdby"]); $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($requisition_data["reporting_id"]); $mail_arr = array('HR' => $hrgroupemail["groupEmail"], $requesteremailaddress['userfullname'] => $requesteremailaddress['emailaddress'], $reportingmanageremailaddress['userfullname'] => $reportingmanageremailaddress['emailaddress']); $loginuser_person_data = $user_model->getUserDataById($loginUserId); $interview_panel = $interview_panel . "," . $loginUserId; $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel); /* $emailtemp = array(); $nametemp = array(); foreach ($interviewpanelnamesemailaddress as $row) { array_push($emailtemp, $row['emailaddress']); array_push($nametemp, $row['userfullname']); } $email = implode(";", $emailtemp); $ename = implode(";", $nametemp); */ $cal_unique_id = $this->getCalendarUniqueID(); foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) { $description = "Meeting From : " . $from_name . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n"; /* $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $options['subject'] = APPLICATION_NAME . ': Interview schedule'; $options['header'] = 'Interview schedule'; $options['toEmail'] = $interviewpanelnamesemailaddress['emailaddress']; $options['toName'] = $interviewpanelnamesemailaddress['userfullname']; $options['message'] = $description; $options['location'] = $int_location; $options['interviewdate'] = $interview_date; $options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0); $options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600); //Interview Calendar Invite will be send from login user account $options['fromEmail'] = trim($loginuser_person_data['emailaddress']); $options['fromName'] = $loginuser_person_data['userfullname']; $options['calUniqueID'] = $cal_unique_id; $options['method'] = 'REQUEST'; //sapp_Global::_sendCalendarEmail($options); */ $from_name = trim($loginuser_person_data['userfullname']); $from_address = trim($loginuser_person_data['emailaddress']); $to_name = trim($interviewpanelnamesemailaddress['userfullname']); $to_address = trim($interviewpanelnamesemailaddress['emailaddress']); $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600); $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time))); $subject = APPLICATION_NAME . ': Interview schedule'; $location = $int_location; $calRequest = 'REQUEST'; sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id); } // update Calendar Invite ID to DB $where = "id = " . $ir_result; $irdata = array('calendarinviteid' => $cal_unique_id); $ir_result1 = $interview_round_model->SaveorUpdateInterviewroundData($irdata, $where); $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = "id = " . $candidate_id; $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where); } } else { $idata = array('interview_status' => trim($interview_status), 'isactive' => 1, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $iwhere = "id = " . $id; $tableid = $id; $actionflag = 2; $iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere); $candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($cand_status && $cand_status != '0') { $candData['cand_status'] = $cand_status; } $where = "id = " . $candidate_id; $candResult = $cand_model->SaveorUpdateCandidateData($candData, $where); //send email $currentInterviewData = $requi_model->getinterviewdetails($id); $requisition_data = $requi_model->getrequisitiondetails($currentInterviewData["req_id"]); $currentrequisition_data = $requi_model->getrequisitiondetails($currentInterviewData["req_id"]); $cand_data = $cand_model->getCandidateById($candidate_id); //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]); $requesteremailaddress = $requi_model->getemployeeemailaddress($requisition_data["createdby"]); $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($requisition_data["reporting_id"]); //HR Group $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = constant('REQ_HR_0'); //Requester $mail_arr[1]['name'] = $requesteremailaddress['userfullname']; $mail_arr[1]['email'] = $requesteremailaddress['emailaddress']; //Reporting Manager $mail_arr[2]['name'] = $reportingmanageremailaddress['userfullname']; $mail_arr[2]['email'] = $reportingmanageremailaddress['emailaddress']; //Management Group $mail_arr[3]['name'] = 'Management'; $mail_arr[3]['email'] = constant('REQ_MGMT_0'); //Recruiter Panel $requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($currentrequisition_data["requisition_code"]); $emailCnt = 4; foreach ($requisition_recruiters_data as $requisition_recruiters_data1) { $mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname']; $mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress']; $emailCnt = $emailCnt + 1; } //Technical Panel $pnlIDS = implode(',', $requi_model->getRequisitionInterviewPanelIDs($currentInterviewData["req_id"])); $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($pnlIDS); foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress1) { $mail_arr[$emailCnt]['name'] = $interviewpanelnamesemailaddress1['userfullname']; $mail_arr[$emailCnt]['email'] = $interviewpanelnamesemailaddress1['emailaddress']; $emailCnt = $emailCnt + 1; } for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $mail_arr[$ii]['name']; $this->view->type = 'InterviewSummary'; $this->view->requisition_data = $currentrequisition_data; $this->view->candidate_details = $cand_data; $this->view->round_data = $currentInterviewData; $this->view->base_url = $base_url; $text = $view->render('mailtemplates/requisition.phtml'); $options['subject'] = APPLICATION_NAME . ': Interview feedback'; //$options['header'] = 'Interview feedback'; $options['toEmail'] = $mail_arr[$ii]['email']; $options['toName'] = $mail_arr[$ii]['name']; $options['message'] = $text; sapp_Global::_sendEmail($options, "interviewrounds_feedback", REQUISITIONMODULESENDEMAIL); } } $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/scheduleinterviews'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id == '') { $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview scheduled successfully.'); } else { $this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview details updated successfully.'); } $this->_redirect('/scheduleinterviews'); } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
/** * * @param type $requisitionform * @param type $data * @return type */ public function save($requisitionform, $data) { $ipreporting_id = ""; $technicalskill_id = ""; $nontechnicalskill_id = ""; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $requi_model = new Default_Model_Requisition(); $user_model = new Default_Model_Usermanagement(); $jobtitleModel = new Default_Model_Jobtitles(); $appr_mail = ''; $appr_per = ''; if ($requisitionform->isValid($this->_request->getPost())) { $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $id = (int) $this->_getParam('id', null); $requisition_code = $this->_getParam('requisition_code', null); $onboard_date = $this->_getParam('onboard_date', null); $business_unit = $this->_getParam('business_unit', null); $department = $this->_getParam('department', null); $jobtitle = $this->_getParam('jobtitle', null); $position_id = $this->_getParam('position_id', null); $reporting_id = $this->_getParam('reporting_id', null); $req_no_positions = $this->_getParam('req_no_positions', null); $jobdescription = $this->_getParam('jobdescription', null); $req_skills = $this->_getParam('req_skills', null); $req_qualification = $this->_getParam('req_qualification', null); $req_exp_years = $this->_getParam('req_exp_years', null); $emp_type = $this->_getParam('emp_type', null); $req_priority = $this->_getParam('req_priority', null); $additional_info = $this->_getParam('additional_info', null); $req_status = $this->_getParam('req_status', null); $approver1 = $this->_getParam('approver1', null); $approver2 = $this->_getParam('approver2', null); $approver3 = $this->_getParam('approver3', null); $aflag = $this->_getParam('aflag', null); $edit_flag = $this->_getParam('edit_flag', null); $edit_order = $this->_getParam('edit_order', null); $requ_jd = $this->_getParam('requ_jd', null); $billable = $this->_getParam('billable', null); $billablefor = $this->_getParam('billablefor', null); $billable_empname = $this->_getParam('billable_empname', null); $interviewroundscount = $this->_getParam('interviewroundscount', null); $technology = $this->_getParam('technology', null); try { $ipbusiness_unit = 1; $ipdepartment = 1; $ipreporting_id = $this->_getParam('ipreporting_id', null); $technicalskill_id = $this->_getParam('technicalskill_id', null); $nontechnicalskill_id = $this->_getParam('nontechnicalskill_id', null); } catch (Exception $abc) { } $aorder = $this->_getParam('aorder', null); //1= approver1,2=approver2,3=approver3 if ($aflag != '' && $aflag == 'approver') { if ($req_status == 3) { //for rejected $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'appstatus' . $aorder => $req_status, 'req_status' => $req_status); } else { //for approved if ($aorder == 1) { if ($approver2 != '') { $data = array('appstatus1' => $req_status, 'req_status' => $req_status); $appr_mail = $approver1; $appr_per = $approver1; } else { $data = array('appstatus1' => $req_status, 'req_status' => $req_status); $appr_mail = 'approved'; } } else { if ($aorder == 2) { if ($approver3 != '') { $data = array('appstatus2' => $req_status, 'req_status' => $req_status); $appr_mail = $approver2; $appr_per = $approver2; } else { $data = array('appstatus2' => $req_status, 'req_status' => $req_status); $appr_mail = 'approved'; } } } $data['modifiedby'] = trim($loginUserId); $data['modifiedon'] = gmdate("Y-m-d H:i:s"); } } else { $data = array('requisition_code' => trim($requisition_code), 'onboard_date' => sapp_Global::change_date(trim($onboard_date), 'database'), 'position_id' => trim($position_id), 'reporting_id' => trim($reporting_id), 'businessunit_id' => trim($business_unit), 'department_id' => trim($department), 'req_no_positions' => trim($req_no_positions), 'jobdescription' => trim($jobdescription), 'jobtitle' => trim($jobtitle), 'req_skills' => trim($req_skills), 'req_qualification' => trim($req_qualification), 'req_exp_years' => trim($req_exp_years), 'emp_type' => trim($emp_type), 'req_priority' => trim($req_priority), 'additional_info' => trim($additional_info), 'billable' => trim($billable), 'interviewroundscount' => trim($interviewroundscount), 'technology' => trim($technology), 'approver1' => $approver1, 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'req_status' => 'Initiated', 'appstatus1' => 'Initiated', 'appstatus2' => null, 'appstatus3' => null, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'upload_jd' => trim($requ_jd), 'billable_for' => trim($billablefor), 'billable_empname' => trim($billable_empname)); if ($loginuserGroup == MANAGER_GROUP) { $data['reporting_id'] = $loginUserId; } if ($edit_flag != '' && $edit_flag == 'yes') { if ($edit_order == 1) { $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus2' => 'Initiated'); if ($approver2 == '') { $data['appstatus2'] = null; } else { $appr_per = $edit_order; $appr_mail = $approver2; } } if ($edit_order == 2) { $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus3' => 'Initiated'); if ($approver3 == '') { $data['appstatus3'] = null; } else { $appr_per = $edit_order; $appr_mail = $approver3; } } } } $where = ""; $actionflag = 1; //for mailing if ($id == '') { //for requisition code $identity_code_model = new Default_Model_Identitycodes(); $identity_codes = $identity_code_model->getIdentitycodesRecord(); $irequistion_code = isset($identity_codes[0]) ? $identity_codes[0]['requisition_code'] : ""; if ($irequistion_code != '') { $req_id = $requi_model->getMaxReqCode($irequistion_code . "/"); } else { $req_id = ''; } $data['requisition_code'] = $req_id; //end of requisition code $report_person_data = $user_model->getUserDataById($data['reporting_id']); $approver1_person_data = $user_model->getUserDataById($approver1); $Raisedby_person_data = $user_model->getUserDataById($data['createdby']); $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($jobtitle)); if (!empty($jobttlArr) && $jobttlArr != 'norows') { $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename']; } else { $jobtitlename = ''; } //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $business_unit); //if (isset($hrgroupemail)) { //HR Group $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = constant('REQ_HR_0'); $mail_arr[0]['type'] = 'HR'; //} //$mgmtgroupemail = $requi_model->getgroupemailid("REQ_MGMT", $business_unit); //if (isset($mgmtgroupemail)) { //HR Group $mail_arr[1]['name'] = 'Management'; $mail_arr[1]['email'] = constant('REQ_MGMT_0'); $mail_arr[1]['type'] = 'Management'; //} $mail_arr[2]['name'] = $Raisedby_person_data['userfullname']; $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress']; $mail_arr[2]['type'] = 'RaiseNew'; $mail_arr[3]['name'] = $approver1_person_data['userfullname']; $mail_arr[3]['email'] = $approver1_person_data['emailaddress']; $mail_arr[3]['type'] = 'Approver'; $appr_str = ""; $appr_str = $approver1_person_data['userfullname']; $req_selected_skills = sprintf("Technical Skills (%s), Non-Technical Skills (%s).", $requi_model->getSkillNamesByIds(implode(",", $technicalskill_id), "Technical"), $requi_model->getSkillNamesByIds(implode(",", $nontechnicalskill_id), "Non-Technical")); for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $mail_arr[$ii]['name']; $this->view->base_url = $base_url; $this->view->type = $mail_arr[$ii]['type']; $this->view->jobtitle = $jobtitlename; $this->view->requisition_code = $requisition_code; $this->view->approver_str = $appr_str; $this->view->raised_name = $Raisedby_person_data['userfullname']; if ($mail_arr[$ii]['type'] == "RaiseNew" || $mail_arr[$ii]['type'] == 'Raise' || $mail_arr[$ii]['type'] == 'RaiseNew' || $mail_arr[$ii]['type'] == 'HR' || $mail_arr[$ii]['type'] == 'Management' || $mail_arr[$ii]['type'] == 'Approver' || $mail_arr[$ii]['type'] == 'ReportingManager') { //values for new email template $bu_dept = $requi_model->getBusinessUnitDepartmentName(trim($department)); $this->view->department_name = $bu_dept['DepartmentName']; $this->view->businessunit_name = $bu_dept['BusinessUnitName']; $this->view->noofopenings = trim($req_no_positions); $this->view->position_name = trim($jobtitlename); $this->view->skills = trim($req_selected_skills); $this->view->application_name = APPLICATION_NAME; } $text = $view->render('mailtemplates/requisition.phtml'); $options['subject'] = APPLICATION_NAME . ': ' . $requisition_code . '-Requisition for approval'; $options['header'] = 'Requisition Status'; $options['toEmail'] = $mail_arr[$ii]['email']; $options['toName'] = $mail_arr[$ii]['name']; $options['message'] = $text; //var_dump($text); //$options['cron'] = 'yes'; if ($options['toEmail'] != '') { if ($mail_arr[$ii]['type'] == "RaiseNew" || $mail_arr[$ii]['type'] == 'Raise' || $mail_arr[$ii]['type'] == 'RaiseNew' || $mail_arr[$ii]['type'] == 'HR' || $mail_arr[$ii]['type'] == 'Management' || $mail_arr[$ii]['type'] == 'Approver' || $mail_arr[$ii]['type'] == 'ReportingManager') { sapp_Global::_sendEmail($options, "New", REQUISITIONMODULESENDEMAIL); } else { sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL); } } } } if ($id != '') { unset($data['createdby']); unset($data['createdon']); unset($data['isactive']); $where = "id = " . $id; $tableid = $id; $actionflag = 2; } $result = $requi_model->SaveorUpdateRequisitionData($data, $where); //log approvals by approver if ($loginUserId == $approver1) { $requisition_data1 = $requi_model->getRequisitionDataById($id); $result1 = $requi_model->insert_requisition_approvalLog($id, $requisition_data1['requisition_code'], $req_status, $loginUserId, gmdate("Y-m-d H:i:s")); } /* * To Insert Interview Panel & Skill details when a new Requisition created */ $currReqIDinDB = $id; if ($currReqIDinDB <= 0) { $currReqIDinDB = $result; } $requisition_data2 = $requi_model->getRequisitionDataById($currReqIDinDB); $result1 = $requi_model->insert_requisition_interview_panel($requisition_data2['requisition_code'], $ipbusiness_unit, $ipdepartment, $ipreporting_id, $requ_jd); $result2 = $requi_model->insert_requisition_skills($requisition_data2['requisition_code'], $technicalskill_id, "Technical"); $result3 = $requi_model->insert_requisition_skills($requisition_data2['requisition_code'], $nontechnicalskill_id, "Non-Technical"); if ($id == '') { $tableid = $result; } if ($result != '') { if ($actionflag == 2) { //start of mailing $requisition_data = $requi_model->getRequisitionDataById($id); $report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']); $st_arr = array('0' => 'Select status', '2' => 'Approved', '3' => 'Rejected'); if ($req_status == 3 || $appr_mail == 'approved') { //for rejected $approver1_person_data = $user_model->getUserDataById($requisition_data['approver1']); $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']); $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($requisition_data['jobtitle'])); if (!empty($jobttlArr) && $jobttlArr != 'norows') { $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename']; } else { $jobtitlename = ''; } /* $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : ""; $mail_arr[0]['type'] = 'HR'; $mail_arr[1]['name'] = 'Management'; $mail_arr[1]['email'] = defined('REQ_MGMT_' . $requisition_data['businessunit_id']) ? constant('REQ_MGMT_' . $requisition_data['businessunit_id']) : ""; $mail_arr[1]['type'] = 'Management'; */ //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data['businessunit_id']); //if (isset($hrgroupemail)) { //HR Group $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = constant('REQ_HR_0'); $mail_arr[0]['type'] = 'HR'; //} //$mgmtgroupemail = $requi_model->getgroupemailid("REQ_MGMT", $requisition_data['businessunit_id']); //if (isset($mgmtgroupemail)) { //HR Group $mail_arr[1]['name'] = 'Management'; $mail_arr[1]['email'] = constant('REQ_MGMT_0'); $mail_arr[1]['type'] = 'Management'; //} $mail_arr[2]['name'] = $Raisedby_person_data['userfullname']; $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress']; $mail_arr[2]['type'] = 'Raise'; $mail_arr[3]['name'] = $approver1_person_data['userfullname']; $mail_arr[3]['email'] = $approver1_person_data['emailaddress']; $mail_arr[3]['type'] = 'Approver'; // Check if the reporting person and raised person are same - Requisition raised by Manager case if ($requisition_data['reporting_id'] != $requisition_data['createdby']) { $mail_arr[4]['name'] = $report_person_data['userfullname']; $mail_arr[4]['email'] = $report_person_data['emailaddress']; $mail_arr[4]['type'] = 'ReportingManager'; } $appr_str = ""; $appr_str = $approver1_person_data['userfullname']; if ($requisition_data['approver2'] != '') { $approver2_person_data = $user_model->getUserDataById($requisition_data['approver2']); $appr_str .= ", " . $approver2_person_data['userfullname']; $mail_arr[5]['name'] = $approver2_person_data['userfullname']; $mail_arr[5]['email'] = $approver2_person_data['emailaddress']; $mail_arr[5]['type'] = 'Approver'; } if ($requisition_data['approver3'] != '') { $approver3_person_data = $user_model->getUserDataById($requisition_data['approver3']); $appr_str .= " and " . $approver3_person_data['userfullname']; $mail_arr[6]['name'] = $approver3_person_data['userfullname']; $mail_arr[6]['email'] = $approver3_person_data['emailaddress']; $mail_arr[6]['type'] = 'Approver'; } $mail = array(); for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : ''; $this->view->base_url = $base_url; $this->view->type = !empty($mail_arr[$ii]['type']) ? $mail_arr[$ii]['type'] : ''; $this->view->jobtitle = $jobtitlename; $this->view->requisition_code = $requisition_data['requisition_code']; $this->view->approver_str = $appr_str; $this->view->raised_name = $Raisedby_person_data['userfullname']; $this->view->req_status = $st_arr[$req_status]; $this->view->reporting_manager = $report_person_data['userfullname']; $text = $view->render('mailtemplates/changedrequisition.phtml'); $options['subject'] = strtolower($st_arr[$req_status]) == 'approved' ? APPLICATION_NAME . ': ' . $requisition_data['requisition_code'] . '-Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected'; $options['header'] = 'Requisition Status'; $options['toEmail'] = !empty($mail_arr[$ii]['email']) ? $mail_arr[$ii]['email'] : ''; $options['toName'] = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : ''; $options['message'] = $text; $mail[$ii] = $options; //$options['cron'] = 'yes'; if ($options['toEmail'] != '') { sapp_Global::_sendEmail($options, "by_approver1", REQUISITIONMODULESENDEMAIL); } else { sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL); } } } else { if ($req_status == 2) { //Approver $approver_person_data = $user_model->getUserDataById($appr_mail); $mail_arr[0]['name'] = $approver_person_data['userfullname']; $mail_arr[0]['email'] = $approver_person_data['emailaddress']; $mail_arr[0]['type'] = 'Approver'; //HR Group $mail_arr[1]['name'] = 'HR'; $mail_arr[1]['email'] = constant('REQ_HR_0'); $mail_arr[1]['type'] = 'HR'; //Management Group $mail_arr[2]['name'] = 'Management'; $mail_arr[2]['email'] = constant('REQ_MGMT_0'); $mail_arr[2]['type'] = 'Management'; //Requester $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']); $mail_arr[3]['name'] = $Raisedby_person_data['userfullname']; $mail_arr[3]['email'] = $Raisedby_person_data['emailaddress']; $mail_arr[3]['type'] = 'Raise'; if ($edit_flag == 'yes') { $approved_by_data = $user_model->getUserDataById($requisition_data['approver' . $appr_per]); $req_status = 2; } else { $approved_by_data = $user_model->getUserDataById($appr_per); } $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']); $appr_str = $approved_by_data['userfullname']; for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $mail_arr[$ii]['name']; $this->view->base_url = $base_url; $this->view->type = $mail_arr[$ii]['type']; $this->view->requisition_code = $requisition_data['requisition_code']; $this->view->req_status = $st_arr[$req_status]; $this->view->raised_name = $Raisedby_person_data['userfullname']; $this->view->approver_str = $appr_str; $text = $view->render('mailtemplates/changedrequisition.phtml'); $options['subject'] = strtolower($st_arr[$req_status]) == 'approved' ? APPLICATION_NAME . ':' . $requisition_data['requisition_code'] . '-Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected'; $options['header'] = 'Requisition Status'; $options['toEmail'] = $mail_arr[$ii]['email']; $options['toName'] = $mail_arr[$ii]['name']; $options['message'] = $text; //$options['cron'] = 'yes'; if ($options['toEmail'] != '') { sapp_Global::_sendEmail($options, "by_approver2", REQUISITIONMODULESENDEMAIL); } else { sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL); } } } } //end of mailing } $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/requisition'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id != '') { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition updated successfully.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition added successfully.")); } $trDb->commit(); $this->_redirect('/requisition'); } } catch (Exception $e) { $trDb->rollBack(); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later.")); $this->_redirect('/requisition'); } } else { $messages = $requisitionform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
/** * * @param type $requisitionform * @param type $data * @return type */ public function save($requisitionform, $data) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $requi_model = new Default_Model_Requisition(); $user_model = new Default_Model_Usermanagement(); $req_status = $this->_getParam('req_status', null); try { //update HR Executive for Requisition $hrExecutiveID = $this->_getParam('hrexecutive_id', null); $requisition_code = $this->_getParam('requisition_code', null); $requisition_id = $this->_getParam('id', null); $result1 = $requi_model->update_requisition_hrexecutive($requisition_id, $requisition_code, $hrExecutiveID, $loginUserId, gmdate("Y-m-d H:i:s")); //send emails $this->hrexecutive_to_requisition_emails($data, $requisition_code, $hrExecutiveID); } catch (Exception $xyz) { } $flag = 'true'; if ($requisitionform->isValid($this->_request->getPost()) && $flag != 'false') { $id = $this->_getParam('id', null); $req_status = $this->_getParam('req_status', null); $onboard_date = $this->_getParam('onboard_date', null); $data = array('req_status' => $req_status, 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s")); if ($onboard_date != '') { $data = $data + array('onboard_date' => sapp_Global::change_date($onboard_date, 'database')); } $where = "id = " . $id; $result = $requi_model->SaveorUpdateRequisitionData($data, $where); $requisition_data = $requi_model->getReqDataForView($id); $requisition_data = $requisition_data[0]; if ($loginUserId == $requisition_data['approver1']) { $result1 = $requi_model->insert_requisition_approvalLog($id, $requisition_data['requisition_code'], $data['req_status'], $loginUserId, gmdate("Y-m-d H:i:s")); } $tableid = $id; $actionflag = 2; if ($result != '') { if ($req_status == 'Complete' || $req_status == 'Closed') { $requi_model->change_to_requisition_closed($id); $report_person_data = $user_model->getUserDataById($requisition_data['createdby']); $closed_person_data = $user_model->getUserDataById($loginUserId); //HR $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = constant('REQ_HR_0'); $mail_arr[0]['type'] = 'HR'; //Management $mail_arr[1]['name'] = 'Management'; $mail_arr[1]['email'] = constant('REQ_MGMT_0'); $mail_arr[1]['type'] = 'Management'; //Requester $mail_arr[2]['name'] = $report_person_data['userfullname']; $mail_arr[2]['email'] = $report_person_data['emailaddress']; $mail_arr[2]['type'] = 'Raise'; for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $mail_arr[$ii]['name']; $this->view->base_url = $base_url; $this->view->type = $mail_arr[$ii]['type']; $this->view->requisition_code = $requisition_data['requisition_code']; $this->view->req_status = $status = strtolower($req_status == 'Closed' ? "Closed" : $req_status); $this->view->raised_name = $report_person_data['userfullname']; $this->view->approver_str = $closed_person_data['userfullname']; $text = $view->render('mailtemplates/changedrequisition.phtml'); $options['subject'] = APPLICATION_NAME . ':' . $requisition_data['requisition_code'] . '-Requisition is ' . $status; $options['header'] = 'Requisition is ' . $status; $options['toEmail'] = $mail_arr[$ii]['email']; $options['toName'] = $mail_arr[$ii]['name']; $options['message'] = $text; //$options['cron'] = 'yes'; sapp_Global::_sendEmail($options, "changedrequisition", REQUISITIONMODULESENDEMAIL); } } $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/approvedrequisitions'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id != '') { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Requisition updated successfully.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Requisition added successfully.")); } $this->_redirect('/approvedrequisitions'); } } else { $messages = $requisitionform->getMessages(); $msgarray = array(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
/** * * @param type $bean * @param type $flowData * @param type $request * @param type $paramsRelated * @return type */ public function validateExpression($bean, $flowData, $request, $paramsRelated = array()) { $conditionResult = $this->evaluator->evaluateExpression(trim($flowData['evn_criteria']), $bean, $paramsRelated); if ($flowData['evn_criteria'] == '' || $flowData['evn_criteria'] == '[]' || $conditionResult) { $request->validate(); } else { $request->invalidate(); } $condition = $this->evaluator->condition(); $this->logger->debug("Eval: {$condition} returned " . $request->isValid()); return $request; }
/** * * @param type $employeeform * @return string */ public function updateempdetails($employeeform) { $emproleStr = ''; $roleArr = array(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $usersModel = new Default_Model_Usermanagement(); $employeeModal = new Default_Model_Employee(); $businessunit_id = $this->_request->getParam('businessunit_id', null); $department_id = $this->_request->getParam('department_id', null); $reporting_manager = $this->_request->getParam('reporting_manager', null); $jobtitle_id = $this->_request->getParam('jobtitle_id', null); $position_id = $this->_request->getParam('position_id', null); $user_id = $this->_getParam('user_id', null); $prefix_id = $this->_getParam('prefix_id', null); $extension_number = $this->_getParam('extension_number', null); if ($employeeform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $emp_status_id = $this->_request->getParam('emp_status_id', null); $date_of_joining = $this->_request->getParam('date_of_joining', null); $date_of_joining = sapp_Global::change_date($date_of_joining, 'database'); $date_of_leaving = $this->_request->getParam('date_of_leaving', null); $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database'); $years_exp = $this->_request->getParam('years_exp'); //FOR USER table $employeeId = $this->_getParam('employeeId', null); $modeofentry = $this->_getParam('modeofentry', null); $hid_modeofentry = $this->_getParam('hid_modeofentry', null); $other_modeofentry = $this->_getParam('other_modeofentry', null); $userfullname = $this->_getParam('userfullname', null); $candidatereferredby = $this->_getParam('candidatereferredby', null); $rccandidatename = $this->_getParam('rccandidatename', null); $emprole = $this->_getParam('emprole', null); //roleid_group_id if ($emprole != "") { $roleArr = explode('_', $emprole); if (!empty($roleArr)) { $emproleStr = $roleArr[0]; } } $emailaddress = $this->_getParam('emailaddress', null); $tmp_name = $this->_request->getParam('tmp_emp_name', null); $act_inact = $this->_request->getParam("act_inact", null); //end of user table $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $empstatusarray = array(8, 9, 10); $actionflag = ''; $tableid = ''; if ($modeofentry == 'Direct' || $hid_modeofentry == 'Direct') { $candidate_key = 'userfullname'; $candidate_value = $userfullname; $emp_name = $userfullname; $candidate_flag = 'no'; } else { $candidate_key = 'rccandidatename'; $candidate_value = $rccandidatename; $emp_name = $tmp_name; $candidate_flag = 'yes'; } $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $emppassword = sapp_Global::generatePassword(); $user_data = array('emprole' => $emproleStr, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'modifiedby' => $loginUserId, 'modifieddate' => Zend_Registry::get('currentdate'), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => $candidatereferredby, 'userstatus' => 'old', 'other_modeofentry' => $other_modeofentry); if ($id != '') { $where = array('user_id=?' => $user_id); $actionflag = 2; $user_where = "id = " . $user_id; unset($user_data['candidatereferredby']); unset($user_data['userstatus']); unset($user_data['emppassword']); unset($user_data['employeeId']); unset($user_data['modeofentry']); unset($user_data['other_modeofentry']); } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $user_data['createdby'] = $loginUserId; $user_data['createddate'] = gmdate("Y-m-d H:i:s"); $user_data['isactive'] = 1; if ($modeofentry != 'Direct') { $user_data['userfullname'] = $emp_name; } $where = ''; $actionflag = 1; $user_where = ''; } $user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where); if ($id == '') { $user_id = $user_status; } $data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $Id = $employeeModal->SaveorUpdateEmployeeData($data, $where); $statuswhere = array('id=?' => $user_id); if (in_array($emp_status_id, $empstatusarray)) { $isactivestatus = ''; if ($emp_status_id == 8) { $isactivestatus = 2; } else { if ($emp_status_id == 9) { $isactivestatus = 3; } else { if ($emp_status_id == 10) { $isactivestatus = 4; } } } $statusdata = array('isactive' => $isactivestatus); $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere); } else { $statusdata = array('isactive' => 1); $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere); } if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details updated successfully.")); } else { //start of mailing $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $emp_name; $this->view->password = $emppassword; $this->view->emp_id = $employeeId; $this->view->base_url = $base_url; $text = $view->render('mailtemplates/newpassword.phtml'); $options['subject'] = APPLICATION_NAME . ' login credentials'; $options['header'] = 'Greetings from DeltaONE'; $options['toEmail'] = $emailaddress; $options['toName'] = $this->view->emp_name; $options['message'] = $text; $result = sapp_Global::_sendEmail($options, "newpassword"); //end of mailing $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $menuidArr = $menumodel->getMenuObjID('/usermanagement'); $menuID_user = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id); if ($act_inact == 1) { if ($user_data['isactive'] == 1) { $act_str = array("Activated" => Zend_Registry::get('currentdate')); } else { $act_str = array("Inactivated" => Zend_Registry::get('currentdate')); } $result = sapp_Global::logManager($menuID_user, 4, $loginUserId, $user_id, '', $act_str); } $trDb->commit(); $this->_redirect('employee/edit/id/' . $user_id); } catch (Exception $e) { $trDb->rollBack(); $msgarray['employeeId'] = "Something went wrong,please try again later."; return $msgarray; } } else { $messages = $employeeform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $usersModel = new Default_Model_Users(); if (isset($businessunit_id) && $businessunit_id != 0 && $businessunit_id != '') { $departmentsmodel = new Default_Model_Departments(); $departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id); $employeeform->department_id->clearMultiOptions(); $employeeform->reporting_manager->clearMultiOptions(); $employeeform->department_id->addMultiOption('', 'Select Department'); foreach ($departmentlistArr as $departmentlistresult) { $employeeform->department_id->addMultiOption($departmentlistresult['id'], utf8_encode($departmentlistresult['deptname'])); } if (isset($department_id) && $department_id != 0 && $department_id != '') { $employeeform->setDefault('department_id', $department_id); } } if (isset($department_id) && $department_id != 0 && $department_id != '') { $reportingManagerArr = $usersModel->getReportingManagerList($department_id, $user_id); $employeeform->reporting_manager->addMultiOption('', 'Select Reporting Manager'); foreach ($reportingManagerArr as $reportingManagerresult) { $employeeform->reporting_manager->addMultiOption($reportingManagerresult['id'], utf8_encode($reportingManagerresult['userfullname'])); } if (isset($reporting_manager) && $reporting_manager != 0 && $reporting_manager != '') { $employeeform->setDefault('reporting_manager', $reporting_manager); } } if (isset($jobtitle_id) && $jobtitle_id != 0 && $jobtitle_id != '') { $positionsmodel = new Default_Model_Positions(); $positionlistArr = $positionsmodel->getPositionList($jobtitle_id); $employeeform->position_id->clearMultiOptions(); $employeeform->position_id->addMultiOption('', 'Select Position'); foreach ($positionlistArr as $positionlistRes) { $employeeform->position_id->addMultiOption($positionlistRes['id'], utf8_encode($positionlistRes['positionname'])); } if (isset($position_id) && $position_id != 0 && $position_id != '') { $employeeform->setDefault('position_id', $position_id); } } return $msgarray; } }
/** * * @param type $bean * @param type $flowData * @param type $request * @param type $paramsRelated * @return type */ public function validateExpression($bean, $flowData, $request, $paramsRelated = array()) { $terminate = $this->evaluator->evaluateExpression(trim($flowData['evn_criteria']), $bean, $paramsRelated); if ($flowData['evn_criteria'] != '' && $flowData['evn_criteria'] != '[]' && $terminate) { $request->setResult('TERMINATE_CASE'); } $condition = $this->evaluator->condition(); $this->logger->debug("Eval: {$condition} returned " . $request->isValid()); return $request; }
/** * * @param type $form * @return type */ public function save($form) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; } $canProcess = true; $cand_model = new Default_Model_Candidatedetails(); $candwork_model = new Default_Model_Candidateworkdetails(); $req_model = new Default_Model_Requisition(); $requisition_id = $this->_getParam('requisition_id', null); $cand_status = $this->_getParam('cand_status', null); $ststidflag1 = $this->_getParam('ststidflag1', null); $flag = 'true'; if ($form->isValid($this->_request->getPost())) { $id = $this->getRequest()->getParam('id'); } if ($ststidflag1 == 'true') { if ($requisition_id == '') { $msgarray['requisition_id'] = 'Please select requisition id.'; $flag = 'false'; } //perform this action only if login user role is not HRRECRUITER role if ($loginuserRole != HRRECRUITER) { if ($cand_status == '') { $msgarray['cand_status'] = 'Please select status.'; $flag = 'false'; } } } $contact_number = $this->_getParam('contact_number', null); if ($contact_number == null) { $contact_number = $this->_getParam('candidate_phonenumber', null); if ($id == '') { if ($contact_number != null) { if (!$cand_model->isPhoneNumberEmailAlreadyExists($contact_number)) { echo "<script> alert('Candidate phone number already exists.'); </script>"; #$msgarray['errors-candidate_phonenumber'] = 'Candidate phone number already exists.'; $canProcess = 'false'; } } } } $emailid = $this->_getParam('emailid', null); if ($emailid == null) { $emailid = $this->_getParam('candidate_emailaddress', null); if ($id == '') { if ($emailid != null) { if (!$cand_model->isPhoneNumberEmailAlreadyExists($emailid)) { echo "<script> alert('Candidate email address already exists.'); </script>"; #$msgarray['errors-candidate_emailaddress'] = 'Candidate email address already exists.'; $canProcess = 'false'; } } } } $this->view->ststidflag1 = $ststidflag1; if ($form->isValid($this->_request->getPost()) && $flag == 'true' && $canProcess == 'true') { $id = $this->getRequest()->getParam('id'); $requisition_id = $this->_getParam('requisition_id', null); $candidate_firstname = $this->_getParam('candidate_firstname', null); $candidate_lastname = $this->_getParam('candidate_lastname', null); $candidate_name = $candidate_firstname . ' ' . $candidate_lastname; $cand_resume = $this->_getParam('cand_resume', null); $req_status = $this->_getParam('req_status', null); $cand_technology = $this->_getParam('candidate_technology', null); $totalexprience = $this->_getParam('totalexprience', null); $releventexprience = $this->_getParam('releventexprience', null); $currentCTC = $this->_getParam('currentCTC', null); $expectedCTC = $this->_getParam('expectedCTC', null); $currentcompany = $this->_getParam('currentcompany', null); $currentlocation = $this->_getParam('currentlocation', null); $noticeperiod = $this->_getParam('noticeperiod', null); $req_records = $cand_model->getcountofrecords($requisition_id); if (empty($req_records) || !empty($req_records)) { $rdata = array('req_status' => 'In process', 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s")); $rwhere = ' id = ' . $requisition_id; $req_model->SaveorUpdateRequisitionData($rdata, $rwhere); } $data = array('requisition_id' => $requisition_id, 'candidate_firstname' => trim($candidate_firstname), 'candidate_lastname' => trim($candidate_lastname), 'candidate_name' => trim($candidate_name), 'emailid' => trim($emailid), 'contact_number' => trim($contact_number) == '' ? NULL : trim($contact_number), 'cand_resume' => $cand_resume, 'cand_status' => $cand_status, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'cand_technology' => trim($cand_technology), 'totalexprience' => trim($totalexprience), 'releventexprience' => trim($releventexprience), 'currentCTC' => trim($currentCTC), 'expectedCTC' => trim($expectedCTC), 'currentcompany' => trim($currentcompany), 'currentlocation' => trim($currentlocation), 'noticeperiod' => trim($noticeperiod)); if (trim($contact_number) == '') { unset($data['contact_number']); } if (trim($emailid) == '') { unset($data['emailid']); } $where = ""; $actionflag = 1; if ($id != '') { unset($data['createdby']); unset($data['createddate']); unset($data['isactive']); $where = "id = " . $id; $tableid = $id; $actionflag = 2; //perform this action only if login user role is not HRRECRUITER role if ($loginuserRole != HRRECRUITER) { $cvshortlistedstatus = ""; try { //CV Shortlisted status and comments $cvshortlistedstatus = $this->_getParam('cvshortlistedstatusid', null); $cvcommentdescription = $this->_getParam('cvcommentdescription', null); $insertCVShortlistDetailsResult = $req_model->insertCVShortlistDetails($id, $requisition_id, $cvshortlistedstatus, $cvcommentdescription, trim($loginUserId), gmdate("Y-m-d H:i:s")); } catch (Exception $xyz) { } } } if ($where == '') { $canProcess = $cand_model->IsCandidateExists($candidate_firstname, $candidate_lastname, $contact_number, $emailid, $cand_technology); } if ($canProcess) { $result = $cand_model->SaveorUpdateCandidateData($data, $where); } else { //$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate already exists....!")); //$msgarray['requisition_id'] = 'Candidate already exists....!'; //$flag = 'false'; echo "<script> alert('Candidate already exists....!'); </script>"; } //send email start ------------------------------------------------- if ($id == '') { $id = $result; } $candData = $cand_model->getCandidateForView($id); if (isset($cvshortlistedstatus) || strlen(trim($cvshortlistedstatus)) > 0) { //updating existing CV $this->requisition_cvupload_emails($requisition_id, "Update", $candData); } else { //new CV $this->requisition_cvupload_emails($requisition_id, "New", $candData); } //send email end ------------------------------------------------- if ($id == '') { $tableid = $result; } if ($result != '') { //saving of candidate work details if (count($txt_cname) > 0) { $k = 0; foreach ($txt_cname as $cname) { if ($cname != '') { $cdata = array('cand_id' => $tableid, 'company_name' => $cname, 'contact_number' => $txt_cnumber[$k], 'company_address' => $txt_address[$k], 'company_website' => $txt_website[$k], 'cand_designation' => $txt_desig[$k], 'cand_fromdate' => sapp_Global::change_date($txt_from[$k], 'database'), 'cand_todate' => sapp_Global::change_date($txt_to[$k], 'database'), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $cwhere = $hidworkdata[$k] != '' ? "id = " . $hidworkdata[$k] : ""; $candwork_model->SaveorUpdateCandidateWorkData($cdata, $cwhere); } $k++; } } //end of saving of candidate work details $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/candidatedetails'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id == '') { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully.")); } else { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details updated successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details updated successfully.")); } $this->_redirect('/candidatedetails'); } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($country) && $country != 0 && $country != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getStatesList(intval($country)); $form->state->clearMultiOptions(); $form->city->clearMultiOptions(); $form->state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $form->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state) && $state != 0 && $state != '') { $form->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getCitiesList(intval($state)); $form->city->addMultiOption('', 'Select City'); foreach ($citiesmodeldata as $res) { $form->city->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city) && $city != 0 && $city != '') { $form->setDefault('city', $city); } } return $msgarray; } }
/** * * @param type $form * @return type */ public function save($form) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $requi_model = new Default_Model_Requisition(); $round_model = new Default_Model_Interviewrounddetails(); $round_reschedule_model = new Default_Model_Interviewroundrescheduledetails(); $intrvwModel = new Default_Model_Interviewdetails(); $user_model = new Default_Model_Usermanagement(); $cand_model = new Default_Model_Candidatedetails(); $roundId = $this->getRequest()->getParam('id'); $intrvwId = $this->getRequest()->getParam('unitId'); if ($form->isValid($this->_request->getPost())) { $reqData = $intrvwModel->getReqByintrvwID($intrvwId); if (!empty($reqData)) { $reqId = $reqData['req_id']; $candid = $reqData['candidate_id']; $id = $this->getRequest()->getParam('id'); $interviewrnd_id = $intrvwId; $interviewer_id1 = $this->getRequest()->getParam('interviewer_id'); if (is_array($interviewer_id1)) { $interview_id = $interviewer_id1[0]; } else { $interview_id = $interviewer_id1; } $interview_round = $this->getRequest()->getParam('interview_round'); $interview_mode = $this->getRequest()->getParam('interview_mode'); $interview_Type_Details = $this->getRequest()->getParam('interview_Type_Details'); $int_location = $this->getRequest()->getParam('int_location'); $interview_time = $this->getRequest()->getParam('interview_time'); $interview_date = $this->getRequest()->getParam('interview_date'); $interview_feedback = $this->getRequest()->getParam('interview_feedback'); $interview_comments = $this->getRequest()->getParam('interview_comments'); $round_status = $this->getRequest()->getParam('round_status', null); $hid_round_status = $this->getRequest()->getParam('hid_round_status', null); if (is_array($interviewer_id1)) { $interview_panel = implode(",", $this->getRequest()->getParam('interviewer_id', null)); } else { $interview_id = $interviewer_id1; } if ($id != null) { //get Feedback Matrix values from Request $requisitionSkillMatrix = $round_model->getRequisitionSkillMatrix($id); $currRowCount = 0; foreach ($requisitionSkillMatrix as $skill) { $unqCode = $skill['uniquecode']; $skillSelValue = $this->getRequest()->getParam($unqCode, null); if ($skillSelValue != null) { $requisitionSkillMatrix[$currRowCount]['Rating'] = $skillSelValue; } $currRowCount++; } } //check if Skill matrix is filled as per business logic $skillsmatrixvalidate = true; if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") { if ($interview_round == "Technical") { foreach ($requisitionSkillMatrix as $skill) { if ($skill['Category'] == "Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) { $skillsmatrixvalidate = false; break; } } } /* else if ($interview_round == "Managerial") { foreach ($requisitionSkillMatrix as $skill) { if ($skill['Category'] == "Non-Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) { $skillsmatrixvalidate = false; break; } } } */ } if ($skillsmatrixvalidate != true) { $alertMsg = ($interview_round == "Managerial" ? 'Non-Technical' : 'Technical') . " Skill Rating is Mandatory...!"; echo '<script language="javascript">'; echo 'alert("' . $alertMsg . '")'; echo '</script>'; } else { // for Interview Reschedule & Cancellations if ($round_status == "Re-Scheduled-Interviewer Request" || $round_status == "Re-Scheduled-Candidate Request" || $round_status == "Cancelled") { $round_data = $round_model->getSingleRoundData($id); $cand_data = $cand_model->getCandidateById($candid); $requisition_data = $requi_model->getRequisitionDataById($reqId); $interviewpanelnamesemailaddress = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']); $loginuser_person_data = $user_model->getUserDataById($loginUserId); $data = array('interviewround_id' => $id, 'interview_id' => trim($intrvwId), 'req_id' => $reqId, 'candidate_id' => $candid, 'interview_location_old' => $round_data['int_location'], 'interview_round_old' => $round_data['interview_round'], 'interview_date_old' => $round_data['interview_date'], 'interview_time_old' => $round_data['interview_time'], 'interview_mode_old' => $round_data['interview_mode'], 'interview_mode_details_old' => $round_data['interview_mode_details'], 'interview_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'interview_feedback' => trim($interview_feedback), 'round_status' => trim($round_status), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s")); $result1 = $round_reschedule_model->SaveorUpdateInterviewroundData($data, ""); $intRound_where = array("id = " . $id); if ($round_status == "Cancelled") { $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 0); } else { $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel); } $result2 = $round_model->SaveorUpdateInterviewroundData($data_intRound, $intRound_where); if ($result1 > 0 && $result2 == "update") { //send Reschedule meeting invite $emailtemp = array(); $nametemp = array(); foreach ($interviewpanelnamesemailaddress as $row) { array_push($emailtemp, $row['emailaddress']); array_push($nametemp, $row['userfullname']); } $email = implode(";", $emailtemp); $ename = implode(";", $nametemp); $cal_unique_id = $round_data['calendarinviteid']; $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n"; //$view = $this->getHelper('ViewRenderer')->view; //$this->view->emp_name = "Interviewer"; //$this->view->base_url = $base_url; //$this->view->candidate_name = $cand_data['candidate_name']; //$this->view->interview_type = $interview_mode; //$this->view->interview_mode_details = $interview_Type_Details; //$this->view->interview_location = $int_location; //$this->view->interview_date = $interview_date; //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view'); //$this->view->requisition_code = $requisition_data['requisition_code']; //$text = $view->render('mailtemplates/interviewrounds.phtml'); //$options['subject'] = APPLICATION_NAME . ': Interview schedule'; //$options['header'] = 'Interview schedule'; //$options['toEmail'] = $email; //$options['toName'] = $ename; //$options['message'] = $description; //$options['location'] = $int_location; //$options['interviewdate'] = $interview_date; //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0); //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600); //Interview Calendar Invite will be send from login user account //$options['fromEmail'] = $loginuser_person_data['emailaddress']; //$options['fromName'] = $loginuser_person_data['userfullname']; //$options['fromEmail'] = SUPERADMIN_EMAIL; //$options['fromName'] = "*****@*****.**"; //$options['calUniqueID'] = $cal_unique_id; $calRequest = 'REQUEST'; if ($round_status == "Cancelled") { $calRequest = 'CANCEL'; } $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel); foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) { //sapp_Global::_sendCalendarEmail($options); $from_name = trim($loginuser_person_data['userfullname']); $from_address = trim($loginuser_person_data['emailaddress']); $to_name = trim($interviewpanelnamesemailaddress['userfullname']); $to_address = trim($interviewpanelnamesemailaddress['emailaddress']); $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600); $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time))); $subject = APPLICATION_NAME . ': Interview schedule'; $location = $int_location; sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id); } $irwhere = "id = " . $result1; $irdata = array('calendarinviteid' => $cal_unique_id); $interview_round_model = new Default_Model_Interviewrounddetails(); $ir_result1 = $interview_round_model->SaveorUpdateInterviewroundData($irdata, $irwhere); $this->view->eventact = 'updated'; $actionflag = 1; $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/scheduleinterviews'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId); $close = 'close'; $this->view->popup = $close; $this->view->ermsg = ''; } } else { $data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => $interview_id, 'interview_mode' => trim($interview_mode), 'interview_mode_details' => $interview_Type_Details, 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel); if ($interviewrnd_id != null) { $roundnumberData = $intrvwModel->getinterviewroundnumber($interviewrnd_id); $roundnumber = $roundnumberData['interview_round_number']; } $data['interview_round_number'] = $roundnumber + 1; $currentinterviewroundnumber = $roundnumber; $where = ""; $actionflag = 1; if ($id != '') { //update skill matrix to DB if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") { $skillupdateresult = $round_model->UpdateOrInsertCandidateSkillMatrix($requisitionSkillMatrix, $id, $intrvwId, $reqId, $candid, $loginUserId, $currentinterviewroundnumber); } unset($data['interview_panel']); unset($data['createdby']); unset($data['createdon']); unset($data['isactive']); unset($data['interview_round_number']); $where = array("id = " . $id); $tableid = $id; $actionflag = 2; if ($hid_round_status != '') { $data = array(); $data['round_status'] = trim($round_status); } } if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) { unset($data['interviewer_id']); unset($data['interview_mode']); unset($data['int_location']); unset($data['int_country']); unset($data['int_state']); unset($data['int_city']); unset($data['interview_time']); unset($data['interview_date']); unset($data['interview_round']); } $result = $round_model->SaveorUpdateInterviewroundData($data, $where); //upadating invite calander id if interview round id is numeric if (is_numeric($result)) { //updating calendarinviteid column in main_interviewrounddetails tabel - start $startTime = sapp_Global::add_time($interview_time, 'view', 0); //$domain = 'deltaintech.com'; //$cal_unique_id = date("Ymd\TGis", strtotime($startTime)) . rand() . "@" . $domain; $irwhere = "id = " . $result; $irdata = array('calendarinviteid' => $cal_unique_id); $interview_round_model1 = new Default_Model_Interviewrounddetails(); $ir_result1 = $interview_round_model1->SaveorUpdateInterviewroundData($irdata, $irwhere); } //upadating invite calander id if interview round id is numeric - End if ($id == '') { //start of mailing $requisition_data = $requi_model->getRequisitionDataById($reqId); $cand_data = $cand_model->getCandidateById($candid); /* $report_person_data = $user_model->getUserDataById($interviewer_id); $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress'] ); */ $report_person_data = $user_model->getUserDataById($interviewer_id); $currentrequisition_data = $requi_model->getrequisitiondetails($reqId); $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]); $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]); $hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]); $mail_arr = array('HR' => $hrgroupemail["groupEmail"], $report_person_data['userfullname'] => $report_person_data['emailaddress'], $requesteremailaddress['userfullname'] => $requesteremailaddress['emailaddress'], $reportingmanageremailaddress['userfullname'] => $reportingmanageremailaddress['emailaddress']); //foreach ($mail_arr as $ename => $email) { //$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n"; //$view = $this->getHelper('ViewRenderer')->view; //$this->view->emp_name = $ename; //$this->view->base_url = $base_url; //$this->view->candidate_name = $cand_data['candidate_name']; //$this->view->interview_type = $interview_mode; //$interview_Type_Details //$this->view->interview_location = $int_location; //$this->view->interview_date = $interview_date; //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view'); //$this->view->requisition_code = $requisition_data['requisition_code']; //$text = $view->render('mailtemplates/interviewrounds.phtml'); //$options['subject'] = APPLICATION_NAME . ': Interview schedule'; //$options['header'] = 'Interview schedule'; //$options['toEmail'] = $email; //$options['toName'] = $ename; //$options['message'] = $description; ////$options['cron'] = 'yes'; //additional properties for Calendar invite -------------------START //$options['interviewdate'] = $interview_date; //$options['location'] = $int_location; //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0); //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600); //$options['calUniqueID'] = $cal_unique_id; //additional properties for Calendar invite -------------------END //sapp_Global::_sendCalendarEmail($options); $loginuser_person_data = $user_model->getUserDataById($loginUserId); $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel); foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) { $cal_unique_id = $this->getCalendarUniqueID(); $from_name = trim($loginuser_person_data['userfullname']); $from_address = trim($loginuser_person_data['emailaddress']); $to_name = trim($interviewpanelnamesemailaddress['userfullname']); $to_address = trim($interviewpanelnamesemailaddress['emailaddress']); $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600); $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time))); $subject = APPLICATION_NAME . ': Interview schedule'; $location = $int_location; $calRequest = 'REQUEST'; sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id); } //} //end of mailing $tableid = $result; $this->view->eventact = 'scheduled'; } else { if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) { $requisition_data = $requi_model->getRequisitionDataById($reqId); $requisition_data_View = $requi_model->getReqDataForView($reqId); $cand_data = $cand_model->getCandidateById($candid); $round_data = $round_model->getSingleRoundData($id); $report_person_data = $user_model->getUserDataById($interviewer_id); $currentrequisition_data = $requi_model->getrequisitiondetails($reqId); $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]); $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]); //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]); //HR Group $mail_arr[0]['name'] = 'HR'; $mail_arr[0]['email'] = constant('REQ_HR_0'); //Requester $mail_arr[1]['name'] = $requesteremailaddress['userfullname']; $mail_arr[1]['email'] = $requesteremailaddress['emailaddress']; //Reporting Manager $mail_arr[2]['name'] = $reportingmanageremailaddress['userfullname']; $mail_arr[2]['email'] = $reportingmanageremailaddress['emailaddress']; //Management Group $mail_arr[3]['name'] = 'Management'; $mail_arr[3]['email'] = constant('REQ_MGMT_0'); //Recruiter Panel $requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($currentrequisition_data["requisition_code"]); $emailCnt = 4; foreach ($requisition_recruiters_data as $requisition_recruiters_data1) { $mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname']; $mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress']; $emailCnt = $emailCnt + 1; } //Technical Panel $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']); foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress1) { $mail_arr[$emailCnt]['name'] = $interviewpanelnamesemailaddress1['userfullname']; $mail_arr[$emailCnt]['email'] = $interviewpanelnamesemailaddress1['emailaddress']; $emailCnt = $emailCnt + 1; } for ($ii = 0; $ii < count($mail_arr); $ii++) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $mail_arr[$ii]['name']; $this->view->type = 'InterviewFeedback'; $this->view->requisition_data = $requisition_data_View[0]; $this->view->candidate_details = $cand_data; $this->view->round_data = $round_data; $this->view->base_url = $base_url; $text = $view->render('mailtemplates/requisition.phtml'); $options['subject'] = APPLICATION_NAME . ': Interview feedback'; //$options['header'] = 'Interview feedback'; $options['toEmail'] = $mail_arr[$ii]['email']; $options['toName'] = $mail_arr[$ii]['name']; $options['message'] = $text; sapp_Global::_sendEmail($options, "interviewrounds_feedback", REQUISITIONMODULESENDEMAIL); } } $tableid = $id; $this->view->eventact = 'updated'; } $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/scheduleinterviews'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId); $close = 'close'; $this->view->popup = $close; $this->view->ermsg = ''; } } } else { $this->view->ermsg = 'nodata'; } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
/** * @param type $form * @param type $model * @param type $successMsg * @return boolean * @throws InvalidArgumentException */ protected function updateModelWithFormValidation($form, $model, $successMsg) { if ($form->isValid() && $model->update()) { if (!empty($successMsg)) { $this->flashSession->notice($successMsg); } return true; } $m = ""; foreach ($form->getMessages() as $msg) { $m .= $msg . "<br>"; } foreach ($model->getMessages() as $msg) { $m .= $msg . "<br>"; } throw new InvalidArgumentException($m); }