Your code in "include/SearchForm/SearchForm.php" should look like this:
From line 182
PHP Code:
if(isset($parms['value']) && $parms['value'] != "") {
$operator = 'like';
if(!empty($parms['operator'])) {
$operator = $parms['operator'];
}
if(is_array($parms['value'])) {
// comment this block out as this builds the in query: "... field_value IN {'test1', 'test2'}
// we will build another query later
// $operator = 'in';
// $field_value = '';
// foreach($parms['value'] as $key => $val) {
// if($val != ' ' and $val != '') {
// if (!empty($field_value)) {
// $field_value .= ',';
// }
// $field_value .= "'" . $GLOBALS['db']->quote($val) . "'";
// }
// }
}
else {
$field_value = $GLOBALS['db']->quote($parms['value']);
}
and at the bugfix at line 260, that is implementing the OR lookup for the selected search fields:
PHP Code:
if($GLOBALS['db']->dbType == 'oci8' && isset($parms['query_type']) && $parms['query_type'] == 'case_insensitive') {
$db_field = 'upper(' . $db_field . ")";
$field_value = strtoupper($field_value);
}
// bugfix, line 260, include/SearchForm/SearchForm.php:
// test for every multi select parameter, if it is a substring of the field:
// @stig: you need to build sql of the form:
// ( locate('term1', FIELD)>0 AND locate('term2', FIELD)>0 ... )
if(is_array($parms['value'])) {
foreach($parms['value'] as $key => $val) {
if($val != ' ' and $val != '') {
if(!empty($where)) {
// @stig this has to be the AND
$where .= " AND ";
}
// @stig probably it is the best to have the and expression in ( )
else {
$where .= " ( ";
}
$where .= " locate('" . $GLOBALS['db']->quote($val) . "',$db_field)>0 " ;
}
}
// @stig and close it again:
if(!empty($where)) {
$where .= ")";
}
}
// end bugfix: test for every multi select parameter, if it is a substring of the field
$itr++;
if(!empty($where)) {
$where .= " OR ";
}
Best regards,
Martin
Bookmarks