From 1b995226b70f3853a6ce3e937b52b171999ddbd2 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:43:36 +0200 Subject: [PATCH] add_filter_warehouse_propal --- htdocs/comm/propal/list.php | 20 ++++++++++++++++++++ htdocs/commande/list.php | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f5ac2ebae7a..c8a1376ff04 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -73,6 +73,7 @@ $search_societe_alias = GETPOST('search_societe_alias', 'alpha'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_vat = GETPOST('search_montant_vat', 'alpha'); $search_montant_ttc = GETPOST('search_montant_ttc', 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha'); $search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha'); $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); @@ -253,6 +254,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_montant_ht = ''; $search_montant_vat = ''; $search_montant_ttc = ''; + $search_warehouse = ''; $search_multicurrency_code = ''; $search_multicurrency_tx = ''; $search_multicurrency_montant_ht = ''; @@ -520,6 +522,9 @@ if ($search_montant_vat != '') { if ($search_montant_ttc != '') { $sql .= natural_search("p.total_ttc", $search_montant_ttc, 1); } +if ($search_warehouse != '' && $search_warehouse > 0) { + $sql .= natural_search("p.fk_warehouse", $search_warehouse, 1); +} if ($search_multicurrency_code != '') { $sql .= ' AND p.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"'; } @@ -870,6 +875,21 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle); $moreforfilter .= ''; } + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle); + $moreforfilter .= '
'; + } + if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle); + $moreforfilter .= '
'; + } $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index df79a9edffd..045c3644ba7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -452,7 +452,7 @@ if ($search_total_vat != '') { if ($search_total_ttc != '') { $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); } -if ($search_warehouse != '' && $search_warehouse != '-1') { +if ($search_warehouse != '' && $search_warehouse > 0) { $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); } if ($search_multicurrency_code != '') { @@ -838,7 +838,7 @@ if ($resql) { $formproduct = new FormProduct($db); $moreforfilter .= '
'; $tmptitle = $langs->trans('Warehouse'); - $moreforfilter .= img_picto($tmptitle, 'warehouse', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle); $moreforfilter .= '
'; } $parameters = array();