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 1/4] 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(); From b2eaca75bf10b6504eef75f0ad7bfacf8a8c4af6 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:55:48 +0200 Subject: [PATCH 2/4] Update list.php --- htdocs/comm/propal/list.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index c8a1376ff04..4a8bc9ebdb6 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -875,13 +875,6 @@ 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); From 69d489c12b17cf3b6e6209896d9a7caf39cff379 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:00:44 +0200 Subject: [PATCH 3/4] Update list.php --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 4a8bc9ebdb6..f0d8b8fd12f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -880,7 +880,7 @@ if ($resql) { $formproduct = new FormProduct($db); $moreforfilter .= '
'; $tmptitle = $langs->trans('Warehouse'); - $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); $moreforfilter .= '
'; } $parameters = array(); From 5fec4c346e66d4d0e03c210258495219e465af35 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 13 Apr 2021 15:28:16 +0200 Subject: [PATCH 4/4] Update index.php --- htdocs/product/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index e2cb4799965..188e4b5f7a9 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -88,8 +88,7 @@ print load_fiche_titre($transAreaType, $linkback, 'product'); print '
'; -if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This may be - is useless due to the global search combo +if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This may be is useless due to the global search combo // Search contract if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire)) { $listofsearchfields['search_product'] = array('text'=>'ProductOrService');