[add] Employee code length as setting
This commit is contained in:
parent
69b636620a
commit
90f11867a5
@ -6,7 +6,9 @@ class EmployeeApplication{
|
|||||||
private $cryptographyService;
|
private $cryptographyService;
|
||||||
private $asserts;
|
private $asserts;
|
||||||
|
|
||||||
function __construct($mysql, $cryptographyService, $asserts){
|
function __construct($employeeSettings, $mysql, $cryptographyService, $asserts){
|
||||||
|
$this->settings = $employeeSettings;
|
||||||
|
|
||||||
$this->cryptographyService = $cryptographyService;
|
$this->cryptographyService = $cryptographyService;
|
||||||
$this->pdo = $mysql;
|
$this->pdo = $mysql;
|
||||||
$this->asserts = $asserts;
|
$this->asserts = $asserts;
|
||||||
@ -135,7 +137,7 @@ class EmployeeApplication{
|
|||||||
$idNewPerson = $this->saveNewPerson($securedFirstName, $securedMiddleName, $securedLastName,
|
$idNewPerson = $this->saveNewPerson($securedFirstName, $securedMiddleName, $securedLastName,
|
||||||
$birthDate, $securedEmail, $phone);
|
$birthDate, $securedEmail, $phone);
|
||||||
|
|
||||||
$employeeCode = $this->cryptographyService->pseudoRandomStringOpenssl(10);
|
$employeeCode = $this->cryptographyService->pseudoRandomStringOpenssl($this->settings['codeLength']);
|
||||||
$idEmployee = $this->savePersonAsEmployee($idEmployeeType, $idNewPerson, $employeeCode, $contractType);
|
$idEmployee = $this->savePersonAsEmployee($idEmployeeType, $idNewPerson, $employeeCode, $contractType);
|
||||||
|
|
||||||
$response = array(
|
$response = array(
|
||||||
|
@ -65,6 +65,8 @@ $container['sessionApplication'] = function ($c) {
|
|||||||
|
|
||||||
// The employee application
|
// The employee application
|
||||||
$container['employeeApplication'] = function ($c) {
|
$container['employeeApplication'] = function ($c) {
|
||||||
$employeeApplication = new App\Application\EmployeeApplication($c['mysql'], $c['cryptographyService'], $c['asserts']);
|
$employeeSettings = $c->get('settings')['employee'];
|
||||||
|
$employeeApplication = new App\Application\EmployeeApplication($employeeSettings,
|
||||||
|
$c['mysql'], $c['cryptographyService'], $c['asserts']);
|
||||||
return $employeeApplication;
|
return $employeeApplication;
|
||||||
};
|
};
|
@ -40,5 +40,10 @@ return [
|
|||||||
'databaseSelectQueryErrorMessage' => 'There was an error fetching the data.',
|
'databaseSelectQueryErrorMessage' => 'There was an error fetching the data.',
|
||||||
'databaseInsertQueryErrorMessage' => 'There was an error inserting the record.',
|
'databaseInsertQueryErrorMessage' => 'There was an error inserting the record.',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Employee settings
|
||||||
|
'employee' => [
|
||||||
|
'codeLength' => '5',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user