diff --git a/lib/dolisirh_function.lib.php b/lib/dolisirh_function.lib.php index c0a3212..c05c38a 100644 --- a/lib/dolisirh_function.lib.php +++ b/lib/dolisirh_function.lib.php @@ -148,12 +148,7 @@ function dolisirh_num_between_day(int $timestampStart, int$timestampEnd, int $la { $daysNumber = 0; if ($timestampStart <= $timestampEnd) { - if ($lastDay == 1) { - $bit = 0; - } else { - $bit = 1; - } - $daysNumber = (int) round(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - $bit; + $daysNumber = (int) round(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - abs($lastDay - 1); } return $daysNumber; diff --git a/lib/dolisirh_timespent.lib.php b/lib/dolisirh_timespent.lib.php index 5a2cd19..461c7e9 100644 --- a/lib/dolisirh_timespent.lib.php +++ b/lib/dolisirh_timespent.lib.php @@ -48,21 +48,21 @@ function timespent_prepare_head(string $mode, User $fkUser): array $param .= '&search_user_id=' . $fkUser->id; } - if (!getDolGlobalInt($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH)) { + if (!getDolGlobalInt('PROJECT_DISABLE_TIMESHEET_PERMONTH')) { $head[$h][0] = DOL_URL_ROOT . '/custom/dolisirh/view/timespent_range.php?view_mode=month' . $param; $head[$h][1] = $langs->trans('InputPerMonth'); $head[$h][2] = 'inputpermonth'; $h++; } - if (!getDolGlobalInt($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) { + if (!getDolGlobalInt('PROJECT_DISABLE_TIMESHEET_PERWEEK')) { $head[$h][0] = DOL_URL_ROOT . '/custom/dolisirh/view/timespent_range.php?view_mode=week' . $param; $head[$h][1] = $langs->trans('InputPerWeek'); $head[$h][2] = 'inputperweek'; $h++; } - if (!getDolGlobalInt($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) { + if (!getDolGlobalInt('PROJECT_DISABLE_TIMESHEET_PERTIME')) { $head[$h][0] = DOL_URL_ROOT.'/custom/dolisirh/view/timespent_range.php?view_mode=day' . $param; $head[$h][1] = $langs->trans('InputPerDay'); $head[$h][2] = 'inputperday'; @@ -581,12 +581,12 @@ function task_lines_within_range(int &$inc, int $timestampStart, int $timestampE } if (empty($oldProjectForBreak)) { - $oldProjectForBreak = (!getDolGlobalInt($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break. + $oldProjectForBreak = (!getDolGlobalInt('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1); // 0 = start break, -1 = never break. } $restrictBefore = null; - if (getDolGlobalInt($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + if (getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); }