Merge branch 'NEW_13.0_project_block_timesheet' of github.com:marc-dll/dolibarr into develop_NEW_project_block_timesheet
This commit is contained in:
commit
d383941596
@ -1531,6 +1531,17 @@ class Task extends CommonObject
|
||||
$this->timespent_note = trim($this->timespent_note);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->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) {
|
||||
$this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
|
||||
$this->errors[] = $this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
|
||||
@ -1597,6 +1608,17 @@ class Task extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (! empty($conf->global->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) {
|
||||
$this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
|
||||
$this->errors[] = $this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user