FIX Test when date of invoie is in future (pb with TZ and offset)
This commit is contained in:
parent
2bd0fdd364
commit
51b6318f88
@ -393,13 +393,21 @@ if (empty($reshook)) {
|
|||||||
} elseif ($action == 'setinvoicedate' && $usercancreate) {
|
} elseif ($action == 'setinvoicedate' && $usercancreate) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$old_date_lim_reglement = $object->date_lim_reglement;
|
$old_date_lim_reglement = $object->date_lim_reglement;
|
||||||
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
|
$newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
|
||||||
if (empty($date)) {
|
if (empty($newdate)) {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
|
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$object->date = $date;
|
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
||||||
|
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->date = $newdate;
|
||||||
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
|
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
|
||||||
if ($new_date_lim_reglement > $old_date_lim_reglement) {
|
if ($new_date_lim_reglement > $old_date_lim_reglement) {
|
||||||
$object->date_lim_reglement = $new_date_lim_reglement;
|
$object->date_lim_reglement = $new_date_lim_reglement;
|
||||||
@ -413,7 +421,9 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
|
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
|
||||||
|
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||||
|
|
||||||
$object->date_pointoftax = $date_pointoftax;
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -986,14 +996,16 @@ if (empty($reshook)) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
|
||||||
|
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||||
|
|
||||||
// Replacement invoice
|
// Replacement invoice
|
||||||
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
|
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
||||||
if (empty($dateinvoice)) {
|
if (empty($dateinvoice)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -1005,8 +1017,6 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// This is a replacement invoice
|
// This is a replacement invoice
|
||||||
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
||||||
@ -1049,19 +1059,16 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
||||||
if (empty($dateinvoice)) {
|
if (empty($dateinvoice)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (!empty($originentity)) {
|
if (!empty($originentity)) {
|
||||||
$object->entity = $originentity;
|
$object->entity = $originentity;
|
||||||
@ -1265,19 +1272,16 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Standard invoice or Deposit invoice, created from a Predefined template invoice
|
// Standard invoice or Deposit invoice, created from a Predefined template invoice
|
||||||
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
|
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
||||||
if (empty($dateinvoice)) {
|
if (empty($dateinvoice)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$object->socid = GETPOST('socid', 'int');
|
$object->socid = GETPOST('socid', 'int');
|
||||||
$object->type = GETPOST('type');
|
$object->type = GETPOST('type');
|
||||||
@ -1312,8 +1316,6 @@ if (empty($reshook)) {
|
|||||||
$typeamount = GETPOST('typedeposit', 'aZ09');
|
$typeamount = GETPOST('typedeposit', 'aZ09');
|
||||||
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
|
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
|
||||||
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
|
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
|
||||||
|
|
||||||
if (GETPOST('socid', 'int') < 1) {
|
if (GETPOST('socid', 'int') < 1) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1325,7 +1327,7 @@ if (empty($reshook)) {
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -1807,19 +1809,16 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Situation invoices
|
// Situation invoices
|
||||||
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
|
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
||||||
if (empty($dateinvoice)) {
|
if (empty($dateinvoice)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
|
||||||
|
|
||||||
if (!(GETPOST('situations', 'int') > 0)) {
|
if (!(GETPOST('situations', 'int') > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||||
@ -3514,7 +3513,8 @@ if ($action == 'create') {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');
|
||||||
|
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||||
|
|
||||||
// Date invoice
|
// Date invoice
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||||
@ -3524,7 +3524,6 @@ if ($action == 'create') {
|
|||||||
// Date point of tax
|
// Date point of tax
|
||||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
|
||||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2487,7 +2487,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
|
|||||||
* False or 0 or 'tzserver' = local to server TZ
|
* False or 0 or 'tzserver' = local to server TZ
|
||||||
* 'auto'
|
* 'auto'
|
||||||
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.
|
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.
|
||||||
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user.
|
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date.
|
||||||
* 'tz,TimeZone' = use specified timezone
|
* 'tz,TimeZone' = use specified timezone
|
||||||
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
||||||
* @return int|string Date as a timestamp, '' or false if error
|
* @return int|string Date as a timestamp, '' or false if error
|
||||||
|
|||||||
@ -408,9 +408,9 @@ if (empty($reshook)) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
} elseif ($action == 'setdatef' && $usercancreate) {
|
} elseif ($action == 'setdatef' && $usercancreate) {
|
||||||
$newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']);
|
$newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
|
||||||
if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) {
|
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) {
|
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
||||||
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||||
@ -434,7 +434,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
|
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
|
$object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
|
||||||
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
|
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
|
||||||
$object->date_echeance = $object->date;
|
$object->date_echeance = $object->date;
|
||||||
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
|
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
|
||||||
@ -692,8 +692,12 @@ if (empty($reshook)) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
|
||||||
$datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
|
$datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver');
|
||||||
|
/*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
|
||||||
|
var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
|
||||||
|
var_dump($db->idate($dateinvoice));
|
||||||
|
exit;*/
|
||||||
|
|
||||||
// Replacement invoice
|
// Replacement invoice
|
||||||
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
|
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
|
||||||
@ -702,7 +706,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -766,7 +770,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -875,7 +879,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user