Merge pull request #18862 from marc-dll/NEW_expense_report_overlap_link
NEW: expense report: show link to already existing overlapping expense report
This commit is contained in:
commit
f7f8ff2df2
@ -277,10 +277,14 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors');
|
||||
$action = 'create';
|
||||
if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS)) {
|
||||
$overlappingExpenseReportID = $object->periode_existe($fuser, $object->date_debut, $object->date_fin, true);
|
||||
|
||||
if ($overlappingExpenseReportID > 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDoubleDeclaration").' <a href="'.$_SERVER['PHP_SELF'].'?id='.$overlappingExpenseReportID.'">'. $langs->trans('ShowTrip').'</a>', null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@ -2213,8 +2213,6 @@ class ExpenseReport extends CommonObject
|
||||
$date_d_form = $date_debut;
|
||||
$date_f_form = $date_fin;
|
||||
|
||||
$existe = false;
|
||||
|
||||
while ($i < $num_rows) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
@ -2222,17 +2220,13 @@ class ExpenseReport extends CommonObject
|
||||
$date_f_req = $this->db->jdate($objp->date_fin); // 4
|
||||
|
||||
if (!($date_f_form < $date_d_req || $date_d_form > $date_f_req)) {
|
||||
$existe = true;
|
||||
return $objp->rowid;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($existe) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user