/** * This action is used to delete candidate and their interview round data. * @parameters * @param objid = id of candidate. * * @return = success/failure message */ public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ""; $actionflag = 3; if ($id) { $cand_model = new Default_Model_Candidatedetails(); $cand_work_model = new Default_Model_Candidateworkdetails(); $interview_model = new Default_Model_Interviewdetails(); $interview_round_model = new Default_Model_Interviewrounddetails(); $menumodel = new Default_Model_Menu(); $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $cand_model->SaveorUpdateCandidateData($data, $where); if ($Id == 'update') { $cand_work_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $cand_work_where = "cand_id = " . $id; $cand_work_model->SaveorUpdateCandidateWorkData($cand_work_data, $cand_work_where); $interview_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $interview_where = "candidate_id = " . $id; $interview_model->SaveorUpdateInterviewData($interview_data, $interview_where); $interview_round_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $interview_round_where = "candidate_id = " . $id; $interview_round_model->SaveorUpdateInterviewroundData($interview_round_data, $interview_round_where); $objidArr = $menumodel->getMenuObjID('/candidatedetails'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id); $messages['message'] = 'Candidate deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Candidate cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Candidate cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }
/** * * @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; } }
public function updatebgstatus($con, $specimenid, $flag) { $db = Zend_Db_Table::getDefaultAdapter(); $screeningmodel = new Default_Model_Empscreening(); $usermodel = new Default_Model_Users(); $candmodel = new Default_Model_Candidatedetails(); if ($con == 'onhold') { $userdata = array('backgroundchk_status' => 'On hold', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId()); $userwhere = "id=" . $specimenid; if ($flag == 1) { $usermodel->addOrUpdateUserModel($userdata, $userwhere); } else { $candmodel->SaveorUpdateCandidateData($userdata, $userwhere); } $data = array('bgcheck_status' => 'On hold', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId()); $where = "flag = " . $flag . " AND specimen_id=" . $specimenid; $screeningmodel->SaveorUpdateDetails($data, $where); } if ($con == 'complete') { $userdata = array('backgroundchk_status' => 'Completed', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId()); $userwhere = "id=" . $specimenid; if ($flag == 1) { $usermodel->addOrUpdateUserModel($userdata, $userwhere); } else { $candmodel->SaveorUpdateCandidateData($userdata, $userwhere); } $data = array('bgcheck_status' => 'Complete', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId()); $where = "flag = " . $flag . " AND specimen_id=" . $specimenid; $screeningmodel->SaveorUpdateDetails($data, $where); } }
public function change_to_requisition_closed($id) { $candidate_model = new Default_Model_Candidatedetails(); $interview_model = new Default_Model_Interviewdetails(); $iround_model = new Default_Model_Interviewrounddetails(); $candidate_data = array('cand_status' => 'Requisition Closed/Completed'); $candidate_where = "requisition_id = " . $id . " and isactive =1 and cand_status not in ('Recruited','Rejected','On hold','Disqualified')"; $interview_data = array('interview_status' => 'Requisition Closed/Completed'); $interview_where = "isactive = 1 and req_id = " . $id . " and interview_status != 'Completed'"; $iround_data = array('round_status' => 'Requisition Closed/Completed'); $iround_where = "isactive = 1 and req_id = " . $id . " and (round_status not in ('Schedule for next round','Qualified','Selected') or round_status is null)"; if ($id != '') { $candidate_model->SaveorUpdateCandidateData($candidate_data, $candidate_where); $interview_model->SaveorUpdateInterviewData($interview_data, $interview_where); $iround_model->SaveorUpdateInterviewroundData($iround_data, $iround_where); } }
public function save($employeeform) { $emproleStr = ''; $roleArr = array(); $empgroupStr = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $usersModel = new Default_Model_Usermanagement(); $employeeModal = new Default_Model_Employee(); $requimodel = new Default_Model_Requisition(); $candidate_model = new Default_Model_Candidatedetails(); $orgInfoModel = new Default_Model_Organisationinfo(); $unitid = ''; $deptid = ''; $errorflag = 'true'; $msgarray = array(); $id = $this->_request->getParam('id'); $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); $office_number = $this->_request->getParam('office_number', null); $office_faxnumber = $this->_request->getParam('office_faxnumber', null); $date_of_joining = $this->_request->getParam('date_of_joining', null); $date_of_joining = sapp_Global::change_date($date_of_joining, 'database'); $isvalidorgstartdate = $orgInfoModel->validateEmployeeJoiningDate($date_of_joining, $unitid, $deptid); if (!empty($isvalidorgstartdate)) { $msgarray['date_of_joining'] = 'Employee joining date should be greater than organization start date.'; $errorflag = 'false'; } if ($id) { $data = $employeeModal->getsingleEmployeeData($id); if (!empty($data) && $data[0]['is_orghead'] == 1) { $reporting_manager = $this->_request->getParam('reporting_manager', '0'); } } if ($employeeform->isValid($this->_request->getPost()) && $errorflag == 'true') { $id = $this->_request->getParam('id'); $emp_status_id = $this->_request->getParam('emp_status_id', null); $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); $firstname = trim($this->_getParam('firstname', null)); $lastname = trim($this->_getParam('lastname', null)); $userfullname = $firstname . ' ' . $lastname; $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]; $empgroupStr = $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, 'firstname' => $firstname != '' ? $firstname : NULL, 'lastname' => $lastname != '' ? $lastname : NULL, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), '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 { $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 = ''; $identity_code_model = new Default_Model_Identitycodes(); $identity_codes = $identity_code_model->getIdentitycodesRecord(); $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : ""; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; } $user_data['employeeId'] = $emp_id; } $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 != '' ? $extension_number : NULL, 'office_number' => $office_number != '' ? $office_number : NULL, 'office_faxnumber' => $office_faxnumber != '' ? $office_faxnumber : NULL, '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")); if ($id == '') { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; } $Id = $employeeModal->SaveorUpdateEmployeeData($data, $where); $statuswhere = array('id=?' => $user_id); if ($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); $employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id); } else { $edata = $usersModel->getUserDataById($id); $statusdata = array('isactive' => 1); if ($edata['isactive'] != 0) { if ($edata['emptemplock'] == 1) { $statusdata = array('isactive' => 0); } $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere); $employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id); } } } 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 Sentrifugo'; $options['toEmail'] = $emailaddress; $options['toName'] = $this->view->emp_name; $options['message'] = $text; $result = sapp_Global::_sendEmail($options); //end of mailing $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details added successfully.")); //incrementing requisition id if ($candidate_flag == 'yes') { $cand_data = $candidate_model->getCandidateById($rccandidatename); $candidate_model->SaveorUpdateCandidateData(array('cand_status' => 'Recruited', 'modifieddate' => gmdate("Y-m-d H:i:s")), " id = " . $rccandidatename); $reqData = $requimodel->incrementfilledpositions($cand_data['requisition_id']); if ($reqData['req_no_positions'] == $reqData['filled_positions']) { $req_status = '6'; $data = array('req_status' => $req_status, 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s")); $where = "id = " . $cand_data['requisition_id']; $result = $requimodel->SaveorUpdateRequisitionData($data, $where); $requimodel->change_to_requisition_closed($cand_data['requisition_id']); $this->send_requi_mail($cand_data['requisition_id'], $requimodel, $usersModel, $loginUserId); } } } $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id); if ($act_inact == 1) { if ($user_data['isactive'] == 1) { } else { } } $trDb->commit(); // Send email to employee when his details are edited by other user. $options['subject'] = APPLICATION_NAME . ': Employee details updated'; $options['header'] = 'Employee details updated'; $options['toEmail'] = $emailaddress; $options['toName'] = $userfullname; $options['message'] = 'Dear ' . $userfullname . ', your employee details are updated.'; $options['cron'] = 'yes'; if (!empty($id)) { sapp_Global::_sendEmail($options); } $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; } } if (isset($businessunit_id) && $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($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; } }
/** * */ public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $actionflag = 3; $flag = 1; if ($id) { $interview_model = new Default_Model_Interviewdetails(); $round_model = new Default_Model_Interviewrounddetails(); $cand_model = new Default_Model_Candidatedetails(); $menumodel = new Default_Model_Menu(); $candidateId = $interview_model->getCandidateIdById($id); if ($candidateId) { $datacand = array('cand_status' => 'Not Scheduled'); $wherecand = array('id=?' => $candidateId); $Idcand = $cand_model->SaveorUpdateCandidateData($datacand, $wherecand); if ($Idcand == 'update') { $data = array('isactive' => 0); $where = array('id=?' => $id); $Id = $interview_model->SaveorUpdateInterviewData($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/scheduleinterviews'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $messages['message'] = 'Schedule Interview deleted successfully'; $messages['msgtype'] = 'success'; $messages['flagtype'] = 'process'; } else { $flag = 0; } } else { $flag = 0; } } else { $flag = 0; } } else { $flag = 0; } if ($flag == 0) { $messages['message'] = 'This schedule interview cannot be deleted'; $messages['msgtype'] = 'error'; $messages['flagtype'] = 'process'; } $this->_helper->json($messages); }