FIX Bad value suggested in default product account setup

This commit is contained in:
Laurent Destailleur 2019-11-11 19:05:06 +01:00
parent 40d66489ad
commit f62f73f5cb

View File

@ -52,27 +52,40 @@ $list_account_main = array (
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
); );
$list_account = array ( $list_account = array ();
'ACCOUNTING_PRODUCT_BUY_ACCOUNT', $list_account[] = '---Product---';
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', $list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', if ($mysoc->isInEEC()) {
'ACCOUNTING_SERVICE_BUY_ACCOUNT', $list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
'ACCOUNTING_SERVICE_SOLD_ACCOUNT', }
'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT', $list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT', $list_account[] = '---Service---';
'ACCOUNTING_VAT_BUY_ACCOUNT', $list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
'ACCOUNTING_VAT_SOLD_ACCOUNT', $list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
'ACCOUNTING_VAT_PAY_ACCOUNT', if ($mysoc->isInEEC()) {
'ACCOUNTING_ACCOUNT_SUSPENSE', $list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
'ACCOUNTING_ACCOUNT_TRANSFER_CASH', }
'DONATION_ACCOUNTINGACCOUNT', $list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', $list_account[] = '---Other---';
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL', $list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
'LOAN_ACCOUNTING_ACCOUNT_INTEREST', $list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE' $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
); $list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if ($conf->banque->enabled) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
if ($conf->don->enabled) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
}
if ($conf->adherent->enabled) {
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
}
if ($conf->loan->enabled) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
/* /*
* Actions * Actions
@ -105,7 +118,12 @@ if ($action == 'update') {
} }
foreach ($list_account as $constname) { foreach ($list_account as $constname) {
$constvalue = GETPOST($constname, 'alpha'); $reg=array();
if (preg_match('/---(.*)---/', $constname, $reg)) { // This is a separator
continue;
}
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++; $error ++;
@ -172,15 +190,21 @@ print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
foreach ($list_account as $key) { foreach ($list_account as $key) {
print '<tr class="oddeven value">'; $reg=array();
// Param if (preg_match('/---(.*)---/', $key, $reg)) {
$label = $langs->trans($key); print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).'</td><td></td></tr>';
print '<td width="50%">' . $label . '</td>'; }
// Value else {
print '<td>'; // Do not force class=right, or it align also the content of the select box print '<tr class="oddeven value">';
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); // Param
print '</td>'; $label = $langs->trans($key);
print '</tr>'; print '<td width="50%">' . $label . '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
}
} }