diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index cd445e682eb..433f0bae4b2 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -237,6 +237,23 @@ if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $fi if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode_search_extrafields=0; + if (in_array($typ, array('int','double'))) $mode_search_extrafields=1; // Search on a numeric + + if ($val && ( ($crit != '' && in_array($typ, array('sellist'))) || ! empty($crit))) + { + $sql .= ' AND ef.'.$tmpkey.'='.$crit; + } else if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search_extrafields); + } +} + $sql .= $db->order($sortfield,$sortorder); $nbtotalofrecords = ''; @@ -464,7 +481,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; print '