diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 0d927b7305b4e6015ac876a0738ec13a9331d127..1dcb2a533de8fc9c96c168ae0ee7ba4292389a0b 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 7c85212ccb8f70c51126b4c7302bca77d85df60e..b019872da6e33bd5e3b0a5a63b8263a8e2fa4bc9 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 '</td></tr>'; } +// TO DO Mutualize code for yes/no constants $var = ! $var; print "<tr " . $bc[$var] . ">"; print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>'; @@ -314,6 +328,20 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { } print '</tr>'; +$var = ! $var; +print "<tr " . $bc[$var] . ">"; +print '<td width="80%">' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>'; +if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setmanagezero&value=0">'; + print img_picto($langs->trans("Activated"), 'switch_on'); + print '</a></td>'; +} else { + print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setmanagezero&value=1">'; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '</a></td>'; +} +print '</tr>'; + print "</table>\n"; dol_fiche_end(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9a12afd395353161d37afdaf07bd12ee48e48468..a663d683fe3c3c591b9e9937c326758d2171ca7a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -56,6 +56,7 @@ ACCOUNTING_LENGTH_DESCRIPTION=Length for displaying product & services descripti ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Length for displaying product & services account description form in listings (Best = 50) ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts +ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disable by default. Be careful with the function of length of the accounts. ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal