public function configure() { $status = array('Enabled' => __('Enabled'), 'Disabled' => __('Disabled')); $idGenService = new IDGeneratorService(); $idGenService->setEntity(new Employee()); $empNumber = $idGenService->getNextID(false); $employeeId = str_pad($empNumber, 4, '0'); $this->widgets = array('firstName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'middleName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'lastName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'empty' => new ohrmWidgetDiv(), 'fullNameLabel' => new ohrmWidgetDiv(), 'firstNameLabel' => new ohrmWidgetDiv(), 'middleNameLabel' => new ohrmWidgetDiv(), 'lastNameLabel' => new ohrmWidgetDiv(), 'employeeId' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 10, "colspan" => 3)), 'photofile' => new sfWidgetFormInputFileEditable(array('edit_mode' => false, 'with_delete' => false, 'file_src' => ''), array("class" => "duplexBox", "colspan" => 3)), 'chkLogin' => new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1), array("style" => "vertical-align:top", "colspan" => 3)), 'lineSeperator' => new ohrmWidgetDiv(array(), array("colspan" => 3)), 'user_name' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 20)), 'status' => new sfWidgetFormSelect(array('choices' => $status), array("class" => "formInputText", "br" => true)), 'user_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20)), 're_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20, "br" => true)), 'empNumber' => new sfWidgetFormInputHidden()); $this->widgets['empNumber']->setDefault($empNumber); $this->widgets['employeeId']->setDefault($employeeId); if ($this->getOption('employeeId') != "") { $this->widgets['employeeId']->setDefault($this->getOption('employeeId')); } $this->widgets['firstName']->setDefault($this->getOption('firstName')); $this->widgets['middleName']->setDefault($this->getOption('middleName')); $this->widgets['lastName']->setDefault($this->getOption('lastName')); $this->widgets['chkLogin']->setDefault($this->getOption('chkLogin')); $this->widgets['user_name']->setDefault($this->getOption('user_name')); $this->widgets['user_password']->setDefault($this->getOption('user_password')); $this->widgets['re_password']->setDefault($this->getOption('re_password')); $this->widgets['status']->setDefault($this->getOption('status')); $this->setWidgets($this->widgets); $this->setValidators(array('photofile' => new sfValidatorFile(array('max_size' => 1000000, 'required' => false)), 'firstName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'empNumber' => new sfValidatorString(array('required' => false)), 'lastName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'middleName' => new sfValidatorString(array('required' => false, 'max_length' => 30, 'trim' => true)), 'employeeId' => new sfValidatorString(array('required' => false, 'max_length' => 10)), 'chkLogin' => new sfValidatorString(array('required' => false)), 'user_name' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 'user_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 're_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 'status' => new sfValidatorString(array('required' => false)))); $this->getWidgetSchema()->setLabels($this->getFormLabels()); sfWidgetFormSchemaFormatterAddEmployee::setNoOfColumns(4); //merge location dropdown $formExtension = PluginFormMergeManager::instance(); $formExtension->mergeForms($this, 'addEmployee', 'AddEmployeeForm'); $this->widgetSchema->setFormFormatterName('AddEmployee'); }
public function saveJobInterview(JobInterview $jobInterview) { try { if ($jobInterview->getId() == "") { $idGenService = new IDGeneratorService(); $idGenService->setEntity($jobInterview); $jobInterview->setId($idGenService->getNextID()); } $jobInterview->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * Save Employee * @param Employee $employee * @returns boolean * @throws DaoException */ public function addEmployee(Employee $employee) { try { if ($employee->getEmpNumber() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($employee); $employee->setEmpNumber($idGenService->getNextID()); } $employee->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * save punchRecord * @param AttendanceRecord $attendanceRecord * @return AttendanceRecord */ public function savePunchRecord(AttendanceRecord $attendanceRecord) { try { if ($attendanceRecord->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($attendanceRecord); $attendanceRecord->setId($idGenService->getNextID()); } $attendanceRecord->save(); return $attendanceRecord; } catch (Exception $ex) { throw new DaoException($ex->getMessage()); } }
/** * Saves the leave period * * @param LeavePeriod $leavePeriod * @return boolean */ public function saveLeavePeriod(LeavePeriod $leavePeriod) { try { if ($leavePeriod->getLeavePeriodId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($leavePeriod); $leavePeriod->setLeavePeriodId($idGenService->getNextID()); } $leavePeriod->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
public function saveWorkflowStateMachineRecord(WorkflowStateMachine $workflowStateMachine) { try { if ($workflowStateMachine->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($workflowStateMachine); $workflowStateMachine->setId($idGenService->getNextID()); } $workflowStateMachine->save(); return $workflowStateMachine; } catch (Exception $ex) { throw new DaoException($ex->getMessage()); } }
/** * Save Performance Review * @param PerformanceReview $performanceReview * @return PerformanceReview */ public function savePerformanceReview(PerformanceReview $performanceReview) { try { if ($performanceReview->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($performanceReview); $performanceReview->setId($idGenService->getNextID()); } $performanceReview->save(); return $performanceReview; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * * @param JobCandidateAttachment $attachment * @return <type> */ public function saveCandidateAttachment(JobCandidateAttachment $attachment) { try { if ($attachment->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($attachment); $attachment->setId($idGenService->getNextID()); } $attachment->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * * @param LeaveType $leaveType * @return boolean */ public function saveLeaveType(LeaveType $leaveType) { try { if ($leaveType->getLeaveTypeId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($leaveType); $leaveType->setLeaveTypeId($idGenService->getNextID()); } $leaveType->save(); return true; } catch (Exception $e) { $this->getLogger()->error("Exception in saveLeaveType:" . $e); throw new DaoException($e->getMessage()); } }
/** * Save Employee * @param Employee $employee * @returns boolean * @throws DaoException */ public function saveEmployee(Employee $employee) { try { if ($employee->getEmpNumber() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($employee); $employee->setEmpNumber($idGenService->getNextID()); } $employee->save(); return $employee; // @codeCoverageIgnoreStart } catch (Exception $e) { throw new DaoException($e->getMessage(), $e->getCode(), $e); } // @codeCoverageIgnoreEnd }
/** * Save Kpi * * @param DefineKpi $Kpi * @return DefineKpi */ public function saveKpi(DefineKpi $Kpi) { try { if ($Kpi->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($Kpi); $Kpi->setId($idGenService->getNextID()); } $Kpi->save(); return $Kpi; } catch (Doctrine_Validator_Exception $e) { // propagate validator exceptions throw $e; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
public function configure() { $status = array('Enabled' => __('Enabled'), 'Disabled' => __('Disabled')); if ($this->getOption('openIdEnabled') == 'on') { $this->openIdEnabled = true; } $idGenService = new IDGeneratorService(); $idGenService->setEntity(new Employee()); $empNumber = $idGenService->getNextID(false); $employeeId = str_pad($empNumber, 4, '0'); $this->widgets = array('firstName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'middleName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'lastName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'employeeId' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 10)), 'photofile' => new sfWidgetFormInputFileEditable(array('edit_mode' => false, 'with_delete' => false, 'file_src' => ''), array("class" => "duplexBox")), 'chkLogin' => new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1), array()), 'user_name' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 40)), 'user_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20)), 're_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20)), 'status' => new sfWidgetFormSelect(array('choices' => $status), array("class" => "formInputText")), 'empNumber' => new sfWidgetFormInputHidden()); $this->widgets['empNumber']->setDefault($empNumber); $this->widgets['employeeId']->setDefault($employeeId); if ($this->getOption('employeeId') != "") { $this->widgets['employeeId']->setDefault($this->getOption('employeeId')); } $this->widgets['firstName']->setDefault($this->getOption('firstName')); $this->widgets['middleName']->setDefault($this->getOption('middleName')); $this->widgets['lastName']->setDefault($this->getOption('lastName')); $this->widgets['chkLogin']->setDefault($this->getOption('chkLogin')); $this->widgets['user_name']->setDefault($this->getOption('user_name')); $this->widgets['user_password']->setDefault($this->getOption('user_password')); $this->widgets['re_password']->setDefault($this->getOption('re_password')); $selectedStatus = $this->getOption('status'); if (empty($selectedStatus) || !isset($status[$selectedStatus])) { $selectedStatus = 'Enabled'; } $this->widgets['status']->setDefault($selectedStatus); $this->setWidgets($this->widgets); $this->setValidators(array('photofile' => new sfValidatorFile(array('max_size' => 1000000, 'required' => false)), 'firstName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'empNumber' => new sfValidatorString(array('required' => false)), 'lastName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'middleName' => new sfValidatorString(array('required' => false, 'max_length' => 30, 'trim' => true)), 'employeeId' => new sfValidatorString(array('required' => false, 'max_length' => 10)), 'chkLogin' => new sfValidatorString(array('required' => false)), 'user_name' => new sfValidatorString(array('required' => false, 'max_length' => 40, 'trim' => true)), 'user_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 're_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 'status' => new sfValidatorString(array('required' => false)))); $this->getWidgetSchema()->setLabels($this->getFormLabels()); $formExtension = PluginFormMergeManager::instance(); $formExtension->mergeForms($this, 'addEmployee', 'AddEmployeeForm'); $customRowFormats[0] = "<li class=\"line nameContainer\"><label class=\"hasTopFieldHelp\">" . __('Full Name') . "</label><ol class=\"fieldsInLine\"><li><div class=\"fieldDescription\"><em>*</em> " . __('First Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[1] = "<li><div class=\"fieldDescription\">" . __('Middle Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[2] = "<li><div class=\"fieldDescription\"><em>*</em> " . __('Last Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n</ol>\n</li>"; $customRowFormats[6] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[7] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[8] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[9] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; sfWidgetFormSchemaFormatterCustomRowFormat::setCustomRowFormats($customRowFormats); $this->widgetSchema->setFormFormatterName('CustomRowFormat'); }
/** * Get the default employee id to be used for next employee being * added to the system. * * @return employee id based on empNumber * * @ignore */ public function getDefaultEmployeeId() { $idGenService = new IDGeneratorService(); $idGenService->setEntity(new Employee()); return $idGenService->getNextID(false); }
protected function getUniqueId($object) { $idGenService = new IDGeneratorService(); $idGenService->setEntity($object); return $idGenService->getNextID(); }
/** * Save CompanyLocation * @param Location location * @returns boolean * @throws DaoException */ public function saveCompanyLocation(Location $location) { try { if ($location->getLocCode() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($location); $location->setLocCode($idGenService->getNextID()); } $location->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * Save User * @param Language $language * @return void */ public function saveUser(Users $user) { try { if ($user->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($user); $user->setId($idGenService->getNextID()); } $user->save(); } catch (Exception $e) { throw new AdminServiceException($e->getMessage()); } }
/** * Modify Overlap leave request * @param LeaveRequest $leaveRequest * @return boolean */ public function xmodifyOverlapLeaveRequest(LeaveRequest $leaveRequest, $leaveList, $leavePeriod = null) { try { $nextLeavePeriod = false; $nextLeaveRequest = false; if ($leavePeriod == null) { $leavePeriod = Doctrine::getTable('LeavePeriod')->find($leaveRequest->getLeavePeriodId()); } foreach ($leaveList as $leave) { if ($leave->getLeaveDate() > $leavePeriod->getEndDate()) { if (!$nextLeavePeriod instanceof LeavePeriod) { $leavePeriodService = new LeavePeriodService(); $leavePeriodService->setLeavePeriodDao(new LeavePeriodDao()); $nextLeavePeriod = $leavePeriodService->createNextLeavePeriod($leave->getLeaveDate()); $nextLeaveRequest = new LeaveRequest(); $idGenService = new IDGeneratorService(); $idGenService->setEntity($leaveRequest); $nextLeaveRequest->setLeaveRequestId($idGenService->getNextID()); $nextLeaveRequest->setLeaveTypeId($leaveRequest->getLeaveTypeId()); $nextLeaveRequest->setDateApplied($leaveRequest->getDateApplied()); $nextLeaveRequest->setLeavePeriodId($nextLeavePeriod->getLeavePeriodId()); $nextLeaveRequest->setLeaveTypeName($leaveRequest->getLeaveTypeName()); $nextLeaveRequest->setEmpNumber($leaveRequest->getEmpNumber()); $nextLeaveRequest->setLeaveComments($leaveRequest->getLeaveComments()); $nextLeaveRequest->save(); } $q = Doctrine_Query::create()->update('Leave l')->set('l.leave_request_id=', $nextLeaveRequest->getLeaveRequestId())->where('l.leave_id = ?', $leave->getLeaveId()); $q->execute(); } } return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * Retrieve vacancy list * @returns doctrine collection * @throws DaoException */ public function saveJobVacancy(JobVacancy $jobVacancy) { try { if ($jobVacancy->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($jobVacancy); $jobVacancy->setId($idGenService->getNextID()); } $jobVacancy->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * * @param CandidateHistory $candidateHistory * @return <type> */ public function saveCandidateHistory(CandidateHistory $candidateHistory) { try { if ($candidateHistory->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($candidateHistory); $candidateHistory->setId($idGenService->getNextID()); } $candidateHistory->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }
/** * Add or Save TimesheetActionLog * @param TimesheetActionLog $timesheetActionLog * @return $timesheetActionLog */ public function saveTimesheetActionLog(TimesheetActionLog $timesheetActionLog) { try { if ($timesheetActionLog->getTimesheetActionLogId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($timesheetActionLog); $timesheetActionLog->setTimesheetActionLogId($idGenService->getNextID()); } $timesheetActionLog->save(); return $timesheetActionLog; } catch (Exception $ex) { throw new DaoException($ex->getMessage()); } }
/** * Save JobTitle * @param JobTitle $jobTitle * @param array() $emplymentStatus * @returns boolean * @throws DaoException */ public function saveJobTitle(JobTitle $jobTitle, $emplymentStatus = array()) { try { if ($jobTitle->getId() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($jobTitle); $jobTitle->setId($idGenService->getNextID()); } if ($jobTitle->getSalaryGradeId() == '-1') { $jobTitle->setSalaryGradeId(new SalaryGrade()); } if ($jobTitle->getJobspecId() == '-1') { $jobTitle->setJobspecId(new JobSpecifications()); } $jobTitle->save(); $this->deleteJobTitleEmpStstus($jobTitle); foreach ($emplymentStatus as $empStatus) { $jobEmpStatus = new JobTitleEmployeeStatus(); $jobEmpStatus->setJobtitCode($jobTitle->getId()); $jobEmpStatus->setEstatCode($empStatus->getId()); $jobEmpStatus->save(); } return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }