Merge pull request #10143 from atm-florian/8.0_fix9964

8.0 fix #9964
This commit is contained in:
Laurent Destailleur 2018-12-14 19:40:53 +01:00 committed by GitHub
commit 8e08ea5c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -468,8 +468,8 @@ if ($resql)
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendOrderRef";

View File

@ -17,13 +17,17 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
$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'))
if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp')))
{
$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);
}
}