New add test dates order for start and end dates of a line of a contract
This commit is contained in:
parent
43d85af5ae
commit
e715a680bf
@ -440,6 +440,14 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||||
|
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||||
|
if (!empty($date_end) && $date_start > $date_end)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
@ -638,6 +646,15 @@ if (empty($reshook))
|
|||||||
|
|
||||||
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
|
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
|
if (!empty($date_end_update) && $date_start_update > $date_end_update)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||||
|
$action = 'editline';
|
||||||
|
$_GET['rowid'] = GETPOST('elrowid');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
$objectline = new ContratLigne($db);
|
$objectline = new ContratLigne($db);
|
||||||
if ($objectline->fetch(GETPOST('elrowid')))
|
if ($objectline->fetch(GETPOST('elrowid')))
|
||||||
{
|
{
|
||||||
@ -722,6 +739,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
|
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user