FIX product list accounting length

This commit is contained in:
Quentin VIAL-GOUTEYRON 2023-08-29 11:45:26 +02:00
parent e85289777c
commit fe7c71d1c2

View file

@ -43,6 +43,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
if (!empty($conf->categorie->enabled))
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (!empty($conf->accounting->enabled))
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks', 'suppliers', 'companies', 'margins'));
@ -410,12 +412,12 @@ if ($fourn_id > 0) $sql .= " AND pfp.fk_soc = ".((int) $fourn_id);
if ($search_country) $sql .= " AND p.fk_country = ".$search_country;
if ($search_state) $sql .= " AND p.fk_state = ".$search_state;
if ($search_finished >= 0 && $search_finished !== '') $sql .= " AND p.finished = ".$search_finished;
if ($search_accountancy_code_sell) $sql .= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
if ($search_accountancy_code_sell_intra) $sql .= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
if ($search_accountancy_code_buy) $sql .= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
if ($search_accountancy_code_buy_intra) $sql .= natural_search('p.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
if ($search_accountancy_code_buy_export) $sql .= natural_search('p.accountancy_code_buy_export', $search_accountancy_code_buy_export);
if ($search_accountancy_code_sell) $sql .= natural_search('p.accountancy_code_sell', clean_account($search_accountancy_code_sell));
if ($search_accountancy_code_sell_intra) $sql .= natural_search('p.accountancy_code_sell_intra', clean_account($search_accountancy_code_sell_intra));
if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_code_sell_export', clean_account($search_accountancy_code_sell_export));
if ($search_accountancy_code_buy) $sql .= natural_search('p.accountancy_code_buy', clean_account($search_accountancy_code_buy));
if ($search_accountancy_code_buy_intra) $sql .= natural_search('p.accountancy_code_buy_intra', clean_account($search_accountancy_code_buy_intra));
if ($search_accountancy_code_buy_export) $sql .= natural_search('p.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -1481,33 +1483,33 @@ if ($resql)
// Accountancy code sell
if (!empty($arrayfields['p.accountancy_code_sell']['checked']))
{
print '<td>'.$obj->accountancy_code_sell.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell).'</td>';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked']))
{
print '<td>'.$obj->accountancy_code_sell_intra.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell_intra).'</td>';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked']))
{
print '<td>'.$obj->accountancy_code_sell_export.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell_export).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Accountancy code buy
if (!empty($arrayfields['p.accountancy_code_buy']['checked']))
{
print '<td>'.$obj->accountancy_code_buy.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy).'</td>';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked']))
{
print '<td>'.$obj->accountancy_code_buy_intra.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy_intra).'</td>';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked']))
{
print '<td>'.$obj->accountancy_code_buy_export.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy_export).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Extra fields