FIX : Comptability when multiple account charts

This commit is contained in:
Florian HENRY 2015-12-09 11:53:38 +01:00
parent 5710bcd38a
commit ea1a81f5f4
2 changed files with 13 additions and 7 deletions

View File

@ -87,10 +87,10 @@ if (! $user->rights->accounting->ventilation->dispatch)
accessforbidden(); accessforbidden();
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT,1);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT); $aarowid_p = $accounting->fetch('',$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT,1);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
@ -278,6 +278,8 @@ if ($result) {
$code_sell_p_notset = ''; $code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_sell)) { if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
} else { } else {
@ -290,12 +292,14 @@ if ($result) {
} }
if ($objp->type_l == 1) { if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') if ($objp->aarowid == '') {
$objp->aarowid_suggest = $aarowid_s; $objp->aarowid_suggest = $aarowid_s;
}
} elseif ($objp->type_l == 0) { } elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') if ($objp->aarowid == '') {
$objp->aarowid_suggest = $aarowid_p; $objp->aarowid_suggest = $aarowid_p;
}
} }
if ($objp->code_sell_l != $objp->code_sell_p) if ($objp->code_sell_l != $objp->code_sell_p)
$code_sell_p_l_differ = 'color:red'; $code_sell_p_l_differ = 'color:red';
@ -311,10 +315,12 @@ if ($result) {
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
$product_static->type = $objp->type; $product_static->type = $objp->type;
print '<td>'; print '<td>';
if ($product_static->id) if ($product_static->id)
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
else else
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>'; print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';

View File

@ -94,8 +94,8 @@ $formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
// TODO: we should need to check if result is a really exist accountaccount rowid..... // TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT,1);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT,1);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers