Ajout des horaires de travail en paramètres .env

This commit is contained in:
2020-07-29 14:49:14 +02:00
parent c30bd74e6f
commit cbe0cbf4e7
3 changed files with 10 additions and 2 deletions

View File

@@ -32,6 +32,10 @@ APP_NAME=Schedule
APP_ENV=PROD
APP_CRON=false
# Office hours
OFFICE_HOUR_START=09:00
OFFICE_HOUR_END=17:30
# MAIL sendmail / smtp
MAILER_METHOD=sendmail
MAILER_URL=

View File

@@ -19,6 +19,8 @@ parameters:
casEmail: '%env(resolve:CAS_EMAIL)%'
casLastname: '%env(resolve:CAS_LASTNAME)%'
casFirstname: '%env(resolve:CAS_FIRSTNAME)%'
officeHourStart: '%env(resolve:OFFICE_HOUR_START)%'
officeHourEnd: '%env(resolve:OFFICE_HOUR_END)%'
services:
# default configuration for services in *this* file

View File

@@ -147,8 +147,10 @@ class TimerController extends AbstractController
$officeworkstart = clone $start;
$officeworkend = clone $officeworkstart;
$officeworkstart->SetTime(9,0,0);
$officeworkend->SetTime(17,30,0);
$uStart = explode(":",$this->getParameter('officeHourStart'));
$uEnd = explode(":",$this->getParameter('officeHourEnd'));
$officeworkstart->SetTime(intval($uStart[0]),intval($uStart[1]),0);
$officeworkend->SetTime(intval($uEnd[0]),intval($uEnd[1]),0);
if ($start < $officeworkstart || $end > $officeworkend) {
$data->setAdditionalHour(true);
}else{