Skip to content

Commit 642feb7

Browse files
committed
NEW Invert logic of default date in proposal/order/invoice creation:
Need option to NOT autofill instead of the opposite.
1 parent ed08d63 commit 642feb7

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

htdocs/comm/propal/card.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@
22212221
$deposit_percent = GETPOSTFLOAT('cond_reglement_id_deposit_percent');
22222222
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
22232223
$fk_account = GETPOSTINT('fk_account');
2224-
$datepropal = (empty($datepropal) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE_PROPOSAL') ? -1 : '') : $datepropal);
2224+
$datepropal = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_PROPOSAL') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty.
22252225

22262226
// Load objectsrc
22272227
$objectsrc = null;

htdocs/commande/card.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,9 +2349,11 @@
23492349
}
23502350

23512351
// Date
2352+
$dateorder = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_ORDER') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty.
2353+
23522354
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
23532355
print img_picto('', 'action', 'class="pictofixedwidth"');
2354-
print $form->selectDate('', 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date
2356+
print $form->selectDate($dateorder, 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date
23552357
print '</td></tr>';
23562358

23572359
// Date delivery planned

htdocs/compta/facture/card.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,6 +3671,11 @@
36713671
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
36723672
$fk_account = GETPOSTINT('fk_account');
36733673

3674+
$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
3675+
if (empty($dateinvoice)) {
3676+
$dateinvoice = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_INVOICE') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty.
3677+
}
3678+
36743679
// Load objectsrc
36753680
$objectsrc = null; // Initialise
36763681
//$remise_absolue = 0;
@@ -3683,7 +3688,6 @@
36833688
$subelement = $regs[2];
36843689
}
36853690

3686-
$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
36873691
$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver');
36883692

36893693
if ($element == 'project') {
@@ -3698,10 +3702,6 @@
36983702
if (empty($fk_account)) {
36993703
$fk_account = $soc->fk_account;
37003704
}
3701-
if (empty($dateinvoice)) {
3702-
// Do not set 0 here (0 for a date is 1970)
3703-
$dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1;
3704-
}
37053705
} else {
37063706
// For compatibility
37073707
if ($element == 'order' || $element == 'commande') {
@@ -3744,8 +3744,6 @@
37443744
$soc = $objectsrc->thirdparty;
37453745
}
37463746

3747-
$dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $dateinvoice);
3748-
37493747
if ($element == 'expedition') {
37503748
$elem = $subelem = $objectsrc->origin;
37513749
$expeoriginid = $objectsrc->origin_id;
@@ -3801,8 +3799,6 @@
38013799
$fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account;
38023800
$inputReasonId = empty($soc->demand_reason_id) ? $inputReasonId : $soc->demand_reason_id;
38033801

3804-
$dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970)
3805-
38063802
if (isModEnabled('multicurrency') && !empty($soc->multicurrency_code)) {
38073803
$currency_code = $soc->multicurrency_code;
38083804
}

0 commit comments

Comments
 (0)