Merge pull request #13938 from TobiasSekan/FixDefaultDateValuesForInvoice

FIX not working default date values for new invoices
This commit is contained in:
Laurent Destailleur 2020-05-23 14:21:50 +02:00 committed by GitHub
commit 7463eb2bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1025,7 +1025,7 @@ if (empty($reshook))
// Replacement invoice
if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
{
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice))
{
$error++;
@ -1086,7 +1086,7 @@ if (empty($reshook))
$action = 'create';
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice))
{
$error++;
@ -1269,7 +1269,7 @@ if (empty($reshook))
// Standard invoice or Deposit invoice, created from a Predefined template invoice
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
{
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice))
{
$error++;
@ -1320,7 +1320,7 @@ if (empty($reshook))
$action = 'create';
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice))
{
$error++;
@ -1745,7 +1745,7 @@ if (empty($reshook))
// Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
{
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));

View File

@ -644,7 +644,7 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
// Replacement invoice
@ -1758,7 +1758,7 @@ if ($action == 'create')
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
}
$datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
$datedue = ($datetmp == '' ?-1 : $datetmp);
@ -1772,7 +1772,7 @@ if ($action == 'create')
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
$fk_account = $societe->fk_account;
$datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
$datedue = ($datetmp == '' ?-1 : $datetmp);