From 4c74b34e62caadad4db0c52cef12f5c045424cf3 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 27 Oct 2020 16:31:22 +0100 Subject: [PATCH 1/2] NEW : Add filters and sort on product unit column --- htdocs/product/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index db77e7714f1..ad2e034e3c5 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -79,6 +79,7 @@ $search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_expor $search_finished = GETPOST("search_finished", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); $type = GETPOST("type", "int"); +$search_units = GETPOST('search_units', 'int'); //Show/hide child products if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { @@ -299,6 +300,7 @@ if (empty($reshook)) $search_accountancy_code_buy_intra = ''; $search_accountancy_code_buy_export = ''; $search_array_options = array(); + $search_units = ''; } // Mass actions @@ -420,6 +422,7 @@ if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_ 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(!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) $sql .= natural_search('cu.rowid', $search_units); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -756,6 +759,7 @@ if ($resql) if (!empty($arrayfields['cu.label']['checked'])) { print ''; + print $form->selectUnits($search_units, 'search_units', 1); print ''; } @@ -917,7 +921,7 @@ if ($resql) if (!empty($arrayfields['p.surface_units']['checked'])) print_liste_field_titre($arrayfields['p.surface_units']['label'], $_SERVER['PHP_SELF'], 'p.surface_units', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER['PHP_SELF'], 'p.volume', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume_units']['checked'])) print_liste_field_titre($arrayfields['p.volume_units']['label'], $_SERVER['PHP_SELF'], 'p.volume_units', '', $param, '', $sortfield, $sortorder, 'center '); - if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], 'cu.label', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.sellprice']['checked'])) { print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } From 9a99e4aaf6f96e5b024f632972e9717afd31a675 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas <31647290+ATM-Nicolas@users.noreply.github.com> Date: Wed, 28 Oct 2020 11:18:39 +0100 Subject: [PATCH 2/2] Seriously ... --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ad2e034e3c5..e4cd83a553e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -422,7 +422,7 @@ if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_ 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(!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) $sql .= natural_search('cu.rowid', $search_units); +if (!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) $sql .= natural_search('cu.rowid', $search_units); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';