Merge pull request #20785 from aspangaro/16a29-Fixcustomerdeposit
FIX Accountancy - Add an option to disable use of sub-account on deposit line
This commit is contained in:
commit
1b82340e1b
@ -95,10 +95,11 @@ if ($conf->loan->enabled) {
|
|||||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
|
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
|
||||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
|
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
|
||||||
}
|
}
|
||||||
|
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||||
if ($conf->societe->enabled) {
|
if ($conf->societe->enabled) {
|
||||||
|
$list_account[] = '---Deposits---';
|
||||||
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
|
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
|
||||||
}
|
}
|
||||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -134,6 +135,20 @@ if ($action == 'update') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setdisableauxiliaryaccountoncustomerdeposit') {
|
||||||
|
$setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int');
|
||||||
|
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, '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
|
||||||
@ -231,6 +246,20 @@ foreach ($list_account as $key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($conf->societe->enabled) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||||
|
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=0">';
|
||||||
|
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||||
|
print '</a></td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=1">';
|
||||||
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||||
|
print '</a></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|||||||
@ -418,9 +418,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
|
|
||||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
@ -897,12 +899,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
|
||||||
} else {
|
|
||||||
print length_accounta($tabcompany[$key]['code_compta']);
|
print length_accounta($tabcompany[$key]['code_compta']);
|
||||||
}
|
}
|
||||||
|
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||||
|
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
|||||||
@ -182,6 +182,7 @@ DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations
|
|||||||
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions
|
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions
|
||||||
|
|
||||||
ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Accounting account by default to register customer deposit
|
ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Accounting account by default to register customer deposit
|
||||||
|
UseAuxiliaryAccountOnCustomerDeposit=Use sub-accounts on customer deposit lines
|
||||||
|
|
||||||
ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet)
|
ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet)
|
||||||
ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet)
|
ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user