diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 0d927b7305b..1dcb2a533de 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -58,7 +58,17 @@ if ($action == 'add') { $obj = $db->fetch_object($result); // Clean code - $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + + // To manage zero or not at the end of the accounting account + if($conf->global->ACCOUNTING_MANAGE_ZERO == 1) + { + $account_number = GETPOST('account_number'); + } + else + { + $account_number = clean_account(GETPOST('account_number')); + } + if (GETPOST('account_category') <= 0) { $account_parent = ''; } else { @@ -98,7 +108,17 @@ if ($action == 'add') { $obj = $db->fetch_object($result2); // Clean code - $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + + // To manage zero or not at the end of the accounting account + if($conf->global->ACCOUNTING_MANAGE_ZERO == 1) + { + $account_number = GETPOST('account_number'); + } + else + { + $account_number = clean_account(GETPOST('account_number')); + } + if (GETPOST('account_category') <= 0) { $account_parent = ''; } else { diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 7c85212ccb8..b019872da6e 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -130,6 +130,7 @@ if ($action == 'update') { } } +// TO DO Mutualize code for yes/no constants if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); @@ -155,6 +156,18 @@ if ($action == 'setlistsortdone') { } } +if ($action == 'setmanagezero') { + $setmanagezero = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -286,6 +299,7 @@ foreach ( $list_account as $key ) { print ''; } +// TO DO Mutualize code for yes/no constants $var = ! $var; print "