#24690 Product list - Search on accountancy account product

This commit is contained in:
Alexandre SPANGARO 2023-05-08 21:50:44 +02:00
parent fd3ec20f36
commit dc7dd85fad

View file

@ -11,7 +11,7 @@
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2020-2021 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2020-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,6 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
}
if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
@ -569,22 +572,22 @@ if ($search_finished >= 0 && $search_finished !== '') {
$sql .= " AND p.finished = ".((int) $search_finished);
}
if ($search_accountancy_code_sell) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell', $search_accountancy_code_sell);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell', clean_account($search_accountancy_code_sell));
}
if ($search_accountancy_code_sell_intra) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_intra', clean_account($search_accountancy_code_sell_intra));
}
if ($search_accountancy_code_sell_export) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_export', $search_accountancy_code_sell_export);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_export', clean_account($search_accountancy_code_sell_export));
}
if ($search_accountancy_code_buy) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy', $search_accountancy_code_buy);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy', clean_account($search_accountancy_code_buy));
}
if ($search_accountancy_code_buy_intra) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_intra', clean_account($search_accountancy_code_buy_intra));
}
if ($search_accountancy_code_buy_export) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', $search_accountancy_code_buy_export);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
}
if (!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) {
$sql .= natural_search('cu.rowid', $search_units);
@ -1964,38 +1967,38 @@ while ($i < $imaxinloop) {
}
// Accountancy code sell
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
print '<td>'.$product_static->accountancy_code_sell.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_sell).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
print '<td>'.$product_static->accountancy_code_sell_intra.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_sell_intra).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
print '<td>'.$product_static->accountancy_code_sell_export.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_sell_export).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code buy
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
print '<td>'.$product_static->accountancy_code_buy.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_buy).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
print '<td>'.$product_static->accountancy_code_buy_intra.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_buy_intra).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
print '<td>'.$product_static->accountancy_code_buy_export.'</td>';
print '<td>'.length_accountg($product_static->accountancy_code_buy_export).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}