From 707a9e40c0e28ab48a9d48c362d40ce76894d0bb Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 6 Jun 2017 12:00:47 +0200 Subject: [PATCH] Fix can't use search on all extrafields on list --- htdocs/product/inventory/listview.class.php | 8 ++++++++ htdocs/product/list-with-listview.php | 2 +- htdocs/societe/list.php | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/listview.class.php b/htdocs/product/inventory/listview.class.php index 1c03d0b524f..ac5ec68f51a 100644 --- a/htdocs/product/inventory/listview.class.php +++ b/htdocs/product/inventory/listview.class.php @@ -41,6 +41,11 @@ class Listview $this->totalRow=0; $this->TField=array(); + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $this->extrafields = new ExtraFields($this->db); + $this->extralabels = $this->extrafields->fetch_name_optionals_label('product'); + $this->search_array_options=$this->extrafields->getOptionalsFromPost($this->extralabels,'','search_'); } /** @@ -808,6 +813,9 @@ class Listview } else { + // Overrive search from extrafields + // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') + if (isset($this->extralabels[$field])) $TParam['search'][$field] = $this->extrafields->showInputField($field, $this->search_array_options['search_options_'.$field], '', '', 'search_'); $visible = 1; } diff --git a/htdocs/product/list-with-listview.php b/htdocs/product/list-with-listview.php index 1ebbf256c9c..6cd8533778e 100644 --- a/htdocs/product/list-with-listview.php +++ b/htdocs/product/list-with-listview.php @@ -611,7 +611,7 @@ else } //var_dump($arraytitle,$arrayhide); - $list=new Listview($db, 'products'); + $list=new Listview($db, 'product'); $listHTML = $list->render($sql,array( 'list'=>array( 'title'=>$texte diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 51d4b41e6bb..29c1ab3bd4c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -840,6 +840,11 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; print ''; } + else + { + // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') + echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_'); + } print ''; } }