From dc7dd85fadbdfac5e87dfac7d435f93573cc9895 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 8 May 2023 21:50:44 +0200 Subject: [PATCH] #24690 Product list - Search on accountancy account product --- htdocs/product/list.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1cb3385b2ed..5e2c76987b3 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2013 Adolfo segura * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2020-2021 Open-DSI + * Copyright (C) 2020-2023 Alexandre Spangaro * * 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 ''.$product_static->accountancy_code_sell.''; + print ''.length_accountg($product_static->accountancy_code_sell).''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) { - print ''.$product_static->accountancy_code_sell_intra.''; + print ''.length_accountg($product_static->accountancy_code_sell_intra).''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) { - print ''.$product_static->accountancy_code_sell_export.''; + print ''.length_accountg($product_static->accountancy_code_sell_export).''; if (!$i) { $totalarray['nbfield']++; } } // Accountancy code buy if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) { - print ''.$product_static->accountancy_code_buy.''; + print ''.length_accountg($product_static->accountancy_code_buy).''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) { - print ''.$product_static->accountancy_code_buy_intra.''; + print ''.length_accountg($product_static->accountancy_code_buy_intra).''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) { - print ''.$product_static->accountancy_code_buy_export.''; + print ''.length_accountg($product_static->accountancy_code_buy_export).''; if (!$i) { $totalarray['nbfield']++; }