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