Merge pull request #19420 from marc-dll/12.0_FIX_project_activity_default_workingdays

FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed
This commit is contained in:
Laurent Destailleur 2022-04-14 23:23:12 +02:00 committed by GitHub
commit 694357d48e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -620,6 +620,11 @@ $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSI
// Get if user is available or not for each day // Get if user is available or not for each day
$isavailable = array(); $isavailable = array();
// Assume from Monday to Friday if conf empty or badly formed
$numstartworkingday = 1;
$numendworkingday = 5;
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
{ {
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS); $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);

View File

@ -521,6 +521,11 @@ $startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['
// Get if user is available or not for each day // Get if user is available or not for each day
$isavailable = array(); $isavailable = array();
// Assume from Monday to Friday if conf empty or badly formed
$numstartworkingday = 1;
$numendworkingday = 5;
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
{ {
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS); $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
@ -530,7 +535,6 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
$numendworkingday = $tmparray[1]; $numendworkingday = $tmparray[1];
} }
} }
for ($idw = 0; $idw < 7; $idw++) for ($idw = 0; $idw < 7; $idw++)
{ {
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0