diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 15b85bad77af1..eaac914888e3d 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1643,8 +1643,7 @@ public function addTimeSpent($user, $notrigger = 0) if (getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS'), 'm'); - - if ($this->timespent_date < $restrictBefore) { + if (dol_stringtotime($this->timespent_date, 0) < $restrictBefore) { $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')); $this->errors[] = $this->error; return -1; @@ -2094,8 +2093,7 @@ public function updateTimeSpent($user, $notrigger = 0) if (getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - - if ($this->timespent_date < $restrictBefore) { + if (dol_stringtotime($this->timespent_date, 0) < $restrictBefore) { $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')); $this->errors[] = $this->error; return -1; @@ -2229,8 +2227,7 @@ public function delTimeSpent($user, $notrigger = 0) if (getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - - if ($this->timespent_date < $restrictBefore) { + if (dol_stringtotime($this->timespent_date, 0) < $restrictBefore) { $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')); $this->errors[] = $this->error; return -1;