예제 #1
0
 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');
 }
예제 #2
0
 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());
     }
 }
예제 #3
0
 /**
  * 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());
     }
 }
예제 #4
0
 /**
  * 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());
     }
 }
예제 #5
0
 /**
  * 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());
     }
 }
예제 #7
0
 /**
  * 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());
     }
 }
예제 #9
0
 /**
  *
  * @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());
     }
 }
예제 #10
0
 /**
  * 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
 }
예제 #11
0
파일: KpiDao.php 프로젝트: THM068/orangehrm
 /**
  * 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());
     }
 }
예제 #12
0
 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');
 }
예제 #13
0
 /**
  * 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());
     }
 }
예제 #14
0
 /**
  * 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);
 }
예제 #15
0
 protected function getUniqueId($object)
 {
     $idGenService = new IDGeneratorService();
     $idGenService->setEntity($object);
     return $idGenService->getNextID();
 }
예제 #16
0
 /**
  * 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());
     }
 }
예제 #17
0
 /**
  * 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());
     }
 }
예제 #18
0
 /**
  * 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());
     }
 }
예제 #19
0
 /**
  *
  * @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());
     }
 }
예제 #20
0
 /**
  * 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());
     }
 }
예제 #21
0
파일: JobDao.php 프로젝트: THM068/orangehrm
 /**
  * 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());
     }
 }