diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 62ed68db861..793bffe0467 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2221,7 +2221,7 @@ if ($action == 'create') { $deposit_percent = GETPOSTFLOAT('cond_reglement_id_deposit_percent'); $mode_reglement_id = GETPOSTINT('mode_reglement_id'); $fk_account = GETPOSTINT('fk_account'); - $datepropal = (empty($datepropal) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE_PROPOSAL') ? -1 : '') : $datepropal); + $datepropal = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_PROPOSAL') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty. // Load objectsrc $objectsrc = null; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 11185cf51ca..4c88e4b7e54 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2349,9 +2349,11 @@ if ($action == 'create' && $usercancreate) { } // Date + $dateorder = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_ORDER') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty. + print '' . $langs->trans('Date') . ''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate('', 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date + print $form->selectDate($dateorder, 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date print ''; // Date delivery planned diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cd6a3451a82..d07be12a739 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3671,6 +3671,11 @@ if ($action == 'create') { $mode_reglement_id = GETPOSTINT('mode_reglement_id'); $fk_account = GETPOSTINT('fk_account'); + $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + if (empty($dateinvoice)) { + $dateinvoice = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_INVOICE') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty. + } + // Load objectsrc $objectsrc = null; // Initialise //$remise_absolue = 0; @@ -3683,7 +3688,6 @@ if ($action == 'create') { $subelement = $regs[2]; } - $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server $date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver'); if ($element == 'project') { @@ -3698,10 +3702,6 @@ if ($action == 'create') { if (empty($fk_account)) { $fk_account = $soc->fk_account; } - if (empty($dateinvoice)) { - // Do not set 0 here (0 for a date is 1970) - $dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1; - } } else { // For compatibility if ($element == 'order' || $element == 'commande') { @@ -3744,8 +3744,6 @@ if ($action == 'create') { $soc = $objectsrc->thirdparty; } - $dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $dateinvoice); - if ($element == 'expedition') { $elem = $subelem = $objectsrc->origin; $expeoriginid = $objectsrc->origin_id; @@ -3801,8 +3799,6 @@ if ($action == 'create') { $fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account; $inputReasonId = empty($soc->demand_reason_id) ? $inputReasonId : $soc->demand_reason_id; - $dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970) - if (isModEnabled('multicurrency') && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; }