Skip to content
Snippets Groups Projects
Commit 707a9e40 authored by Phf's avatar Phf
Browse files

Fix can't use search on all extrafields on list

parent 344263f5
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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
......
......@@ -840,6 +840,11 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
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 '</td>';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment