Esempio n. 1
0
 public function terminateEmployement($empNumber, $terminatedId)
 {
     $date = $this->getValue('date');
     $reasonId = $this->getValue('reason');
     $note = $this->getValue('note');
     if (!empty($terminatedId)) {
         $employeeTerminationRecord = $this->getEmployeeService()->getEmployeeTerminationRecord($terminatedId);
     } else {
         $employeeTerminationRecord = new EmployeeTerminationRecord();
     }
     $employeeTerminationRecord->setDate($date);
     $employeeTerminationRecord->setReasonId($reasonId);
     $employeeTerminationRecord->setEmpNumber($empNumber);
     $employeeTerminationRecord->setNote($note);
     $this->getEmployeeService()->terminateEmployment($employeeTerminationRecord);
 }
Esempio n. 2
0
 public function terminateEmployment(EmployeeTerminationRecord $employeeTerminationRecord)
 {
     try {
         $connection = Doctrine_Manager::getInstance()->getCurrentConnection();
         $connection->beginTransaction();
         /* Saving EmployeeTerminationRecord */
         $employeeTerminationRecord->save();
         /* Updating employee record */
         $q = Doctrine_Query::create()->update('Employee')->set('termination_id', '?', $employeeTerminationRecord->getId())->where('empNumber = ?', $employeeTerminationRecord->getEmpNumber());
         $q->execute();
         $connection->commit();
         return $employeeTerminationRecord;
         // @codeCoverageIgnoreStart
     } catch (Exception $e) {
         $connection->rollback();
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
     // @codeCoverageIgnoreEnd
 }