Skip to content
Snippets Groups Projects
Commit 20144c98 authored by aspangaro's avatar aspangaro
Browse files

FIX Accountancy - Problem with the manage of the zero at the end of an...

FIX Accountancy - Problem with the manage of the zero at the end of an accounting account in dolibarr for somes countries. Add an option.
parent 5d97ce03
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,17 @@ if ($action == 'add') { ...@@ -58,7 +58,17 @@ if ($action == 'add') {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// Clean code // 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) { if (GETPOST('account_category') <= 0) {
$account_parent = ''; $account_parent = '';
} else { } else {
...@@ -98,7 +108,17 @@ if ($action == 'add') { ...@@ -98,7 +108,17 @@ if ($action == 'add') {
$obj = $db->fetch_object($result2); $obj = $db->fetch_object($result2);
// Clean code // 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) { if (GETPOST('account_category') <= 0) {
$account_parent = ''; $account_parent = '';
} else { } else {
......
...@@ -130,6 +130,7 @@ if ($action == 'update') { ...@@ -130,6 +130,7 @@ if ($action == 'update') {
} }
} }
// TO DO Mutualize code for yes/no constants
if ($action == 'setlistsorttodo') { if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int'); $setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
...@@ -155,6 +156,18 @@ if ($action == 'setlistsortdone') { ...@@ -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 * View
*/ */
...@@ -286,6 +299,7 @@ foreach ( $list_account as $key ) { ...@@ -286,6 +299,7 @@ foreach ( $list_account as $key ) {
print '</td></tr>'; print '</td></tr>';
} }
// TO DO Mutualize code for yes/no constants
$var = ! $var; $var = ! $var;
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>'; 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)) { ...@@ -314,6 +328,20 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
} }
print '</tr>'; 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"; print "</table>\n";
dol_fiche_end(); dol_fiche_end();
......
...@@ -56,6 +56,7 @@ ACCOUNTING_LENGTH_DESCRIPTION=Length for displaying product & services descripti ...@@ -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_DESCRIPTION_ACCOUNT=Length for displaying product & services account description form in listings (Best = 50)
ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts
ACCOUNTING_LENGTH_AACCOUNT=Length of the third party 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_SELL_JOURNAL=Sell journal
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment