From 363fe1f52f94be20e77bcaf793bd64cfe4a14a9f Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 16 Feb 2021 15:44:24 +0100 Subject: [PATCH 1/3] NEW 12.0: option to leave the "Automatically create a total payment" checkbox empty on the tax creation page --- htdocs/admin/taxes.php | 12 +++++++++ htdocs/compta/tva/card.php | 49 ++++++++++++++++------------------- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index f9bb8f39641..8a46ef00bfb 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -257,6 +257,18 @@ else print "
\n"; +// Options +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + +$key = 'CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT'; +echo ''; + +echo ''; +echo '
' . $langs->trans('Parameter') . '' . $langs->trans('Value') . '
', $langs->trans($key), '', ajax_constantonoff($key), '
'; print '
'; print ''; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index c5cd4d7f0e2..87d36c5faf3 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -43,7 +43,11 @@ $id = GETPOST("id", 'int'); $action = GETPOST("action", "alpha"); $confirm = GETPOST('confirm'); $refund = GETPOST("refund", "int"); -$auto_create_payment = GETPOST("auto_create_paiement", "int"); +if (GETPOSTISSET('auto_create_paiement')) { + $auto_create_payment = GETPOST("auto_create_paiement", "int"); +} else { + $auto_create_payment = empty($conf->global->CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT); +} if (empty($refund)) $refund = 0; @@ -384,17 +388,10 @@ if ($action == 'create') if (!empty($conf->use_javascript_ajax)) { print "\n".''."\n"; } @@ -482,7 +479,7 @@ if ($action == 'create') // Auto create payment print ''.$langs->trans('AutomaticCreationPayment').''; - print ''."\n"; + print ''."\n"; // Number print ''.$langs->trans('Numero'); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 431ef75ac63..4736c655344 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1683,6 +1683,7 @@ YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Se AccountancyCode=Accounting Code AccountancyCodeSell=Sale account. code AccountancyCodeBuy=Purchase account. code +CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT=By default, leave the checkbox “Automatically create a total payment” empty when creating a new tax object ##### Agenda ##### AgendaSetup=Events and agenda module setup PasswordTogetVCalExport=Key to authorize export link From 97052b035e0038a8610a3fca4d61b8dbd6ee5ac5 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 16 Feb 2021 16:05:19 +0100 Subject: [PATCH 2/3] FIX: when form not completely filled, doesn't keep the checked state of checkbox --- htdocs/compta/tva/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 87d36c5faf3..9b0de34a1ed 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -43,7 +43,7 @@ $id = GETPOST("id", 'int'); $action = GETPOST("action", "alpha"); $confirm = GETPOST('confirm'); $refund = GETPOST("refund", "int"); -if (GETPOSTISSET('auto_create_paiement')) { +if (GETPOSTISSET('auto_create_paiement') || $action === 'add') { $auto_create_payment = GETPOST("auto_create_paiement", "int"); } else { $auto_create_payment = empty($conf->global->CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT); From 037de5eac6615fccd443b9b89f498ce28a8169ce Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 16 Feb 2021 16:15:02 +0100 Subject: [PATCH 3/3] FIX no js + UX (button "modify") --- htdocs/admin/taxes.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 8a46ef00bfb..78f411605f4 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -110,7 +110,12 @@ if ($action == 'update') { setEventMessages($langs->trans("Error"), null, 'errors'); } } - +// Set boolean (on/off) constants +elseif (preg_match('/^(set|del)_?([A-Z_]+)$/', $action, $reg)) { + if (!dolibarr_set_const($db, $reg[2], ($reg[1] === 'set' ? '1' : '0'), 'chaine', 0, '', $conf->entity) > 0) { + dol_print_error($db); + } +} /* @@ -257,7 +262,17 @@ else print "
\n"; + +print '
'; +print ''; +print '

'; +print '
'; + +print ''; + // Options + +echo '
'; echo ''; echo ''; echo ''; @@ -269,14 +284,7 @@ echo '
' . $langs->trans('Parameter') . '' . $langs->trans('Value') . '
', $langs->trans($key), '', ajax_constantonoff($key), ''; echo '
'; - -print '
'; -print ''; -print '
'; - -print ''; - - +echo '
'; if (!empty($conf->accounting->enabled))