[add] Delete emplployee

This commit is contained in:
2018-08-30 23:06:56 -06:00
parent 07e0fbbfab
commit ec64188737
4 changed files with 56 additions and 4 deletions

View File

@@ -518,9 +518,19 @@ class EmployeeApplication{
return $response;
}
function disableEmployeeRecord($idEmployee){
/**
* @param $code string
* @return array
* @throws Exception
*/
function disableEmployeeRecord($code){
$this->asserts->isNotEmpty($code, "The code can't be empty.");
$idEmployee = $this->getIdEmployeeByCode($code);
$this->asserts->higherThanZero($idEmployee, "idEmployee must be higher than 0");
$employeeData = $this->proxyGetEmployeeDataById($idEmployee);
try {
$stmt = $this->pdo->prepare("UPDATE employees
SET
@@ -532,8 +542,12 @@ class EmployeeApplication{
$this->pdo->commit();
$stmt = null;
return $employeeData;
} catch( PDOExecption $e ) {
$this->pdo->rollback();
throw new Exception("The employee you tried to delete could not be found.");
}
}