From d451703bbf5b0769ff0ec92857a3c3fcd438fee0 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 9 Sep 2021 11:21:34 +0200 Subject: [PATCH] Fix : reception list sql error --- htdocs/reception/list.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e4b519517ea..5b4bdf6bb6f 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -85,7 +85,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options = (array) $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -537,21 +537,7 @@ if ($sall) { } // Add where from extra fields -foreach ($search_array_options as $key => $val) { - $crit = $val; - $tmpkey = preg_replace('/search_options_/', '', $key); - $typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey]; - $mode = 0; - if (in_array($typ, array('int', 'double', 'real'))) { - $mode = 1; // Search on a numeric - } - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') { - $mode = 2; // Search on a foreign key int - } - if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook