fix #9964
This commit is contained in:
parent
508cb459eb
commit
c422904b99
@ -1927,7 +1927,10 @@ class ExtraFields
|
|||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach ($extralabels as $key => $value)
|
foreach ($extralabels as $key => $value)
|
||||||
{
|
{
|
||||||
$key_type = $this->attributes[$object->table_element]['type'][$key];
|
$key_type=$this->attribute_type[$key];
|
||||||
|
if (! empty($object->table_element)) {
|
||||||
|
$key_type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($key_type,array('date','datetime')))
|
if (in_array($key_type,array('date','datetime')))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,13 +17,17 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
|
|||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
|
$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
|
||||||
|
if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp')))
|
||||||
$mode_search=0;
|
|
||||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
|
||||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
|
||||||
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
|
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
|
||||||
{
|
{
|
||||||
|
$sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'";
|
||||||
|
}
|
||||||
|
elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||||
|
{
|
||||||
|
$mode_search=0;
|
||||||
|
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||||
|
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||||
|
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
|
||||||
|
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user