mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
NEW Invert logic of default date in proposal/order/invoice creation:
Need option to NOT autofill instead of the opposite.
This commit is contained in:
@@ -2221,7 +2221,7 @@ if ($action == 'create') {
|
|||||||
$deposit_percent = GETPOSTFLOAT('cond_reglement_id_deposit_percent');
|
$deposit_percent = GETPOSTFLOAT('cond_reglement_id_deposit_percent');
|
||||||
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
|
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
|
||||||
$fk_account = GETPOSTINT('fk_account');
|
$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
|
// Load objectsrc
|
||||||
$objectsrc = null;
|
$objectsrc = null;
|
||||||
|
|||||||
@@ -2349,9 +2349,11 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
$dateorder = (getDolGlobalString('MAIN_DO_NOT_AUTOFILL_DATE_ORDER') ? -1 : ''); // By default '' so we will autofill date. -1 means keep empty.
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
|
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
|
||||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
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 '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date delivery planned
|
// Date delivery planned
|
||||||
|
|||||||
@@ -3671,6 +3671,11 @@ if ($action == 'create') {
|
|||||||
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
|
$mode_reglement_id = GETPOSTINT('mode_reglement_id');
|
||||||
$fk_account = GETPOSTINT('fk_account');
|
$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
|
// Load objectsrc
|
||||||
$objectsrc = null; // Initialise
|
$objectsrc = null; // Initialise
|
||||||
//$remise_absolue = 0;
|
//$remise_absolue = 0;
|
||||||
@@ -3683,7 +3688,6 @@ if ($action == 'create') {
|
|||||||
$subelement = $regs[2];
|
$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');
|
$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver');
|
||||||
|
|
||||||
if ($element == 'project') {
|
if ($element == 'project') {
|
||||||
@@ -3698,10 +3702,6 @@ if ($action == 'create') {
|
|||||||
if (empty($fk_account)) {
|
if (empty($fk_account)) {
|
||||||
$fk_account = $soc->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 {
|
} else {
|
||||||
// For compatibility
|
// For compatibility
|
||||||
if ($element == 'order' || $element == 'commande') {
|
if ($element == 'order' || $element == 'commande') {
|
||||||
@@ -3744,8 +3744,6 @@ if ($action == 'create') {
|
|||||||
$soc = $objectsrc->thirdparty;
|
$soc = $objectsrc->thirdparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dateinvoice = (empty($dateinvoice) ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $dateinvoice);
|
|
||||||
|
|
||||||
if ($element == 'expedition') {
|
if ($element == 'expedition') {
|
||||||
$elem = $subelem = $objectsrc->origin;
|
$elem = $subelem = $objectsrc->origin;
|
||||||
$expeoriginid = $objectsrc->origin_id;
|
$expeoriginid = $objectsrc->origin_id;
|
||||||
@@ -3801,8 +3799,6 @@ if ($action == 'create') {
|
|||||||
$fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account;
|
$fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account;
|
||||||
$inputReasonId = empty($soc->demand_reason_id) ? $inputReasonId : $soc->demand_reason_id;
|
$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)) {
|
if (isModEnabled('multicurrency') && !empty($soc->multicurrency_code)) {
|
||||||
$currency_code = $soc->multicurrency_code;
|
$currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user