dolibarr  7.0.0-beta
extrafields_list_search_sql.tpl.php
1 <?php
2 
3 // Protection to avoid direct call of template
4 if (empty($conf) || ! is_object($conf))
5 {
6  print "Error, template page can't be called as URL";
7  exit;
8 }
9 
10 // Loop to complete the sql search criterias from extrafields
11 foreach ($search_array_options as $key => $val)
12 {
13  $crit=$val;
14  $tmpkey=preg_replace('/search_options_/','',$key);
15  $typ=$extrafields->attribute_type[$tmpkey];
16  $mode_search=0;
17  if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
18  if (in_array($typ, array('sellist','link','chkbxlst','checkbox')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
19  if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
20  {
21  $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
22  }
23 }
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print
Draft customers invoices.
Definition: index.php:91