improved search with ss or ß
This commit is contained in:
@@ -79,7 +79,15 @@ class AddressController extends mfBaseController {
|
||||
|
||||
if(array_key_exists("kunde", $filter) && $filter["kunde"]) {
|
||||
$kunde = $this->db()->escape($filter['kunde']);
|
||||
$new_filter['add-where'] .= " AND (company like '%$kunde%' OR firstname like '%$kunde%' OR lastname like '%$kunde%' OR concat(firstname, ' ', lastname) like '%$kunde%' OR concat(lastname, ' ', firstname) like '%$kunde%')";
|
||||
// if kunde contains ß or ss we want to search both cases but not with % because it can lead to wrong results
|
||||
if (strpos($kunde, "ß") !== false || strpos($kunde, "ss") !== false) {
|
||||
$kundeWithSS = str_replace("ß", "ss", $kunde);
|
||||
$kundeWithoutSS = str_replace("ss", "ß", $kunde);
|
||||
$new_filter['add-where'] .= " AND (company like '%$kundeWithoutSS%' OR firstname like '%$kundeWithoutSS%' OR lastname like '%$kundeWithoutSS%' OR concat(firstname, ' ', lastname) like '%$kundeWithoutSS%' OR concat(lastname, ' ', firstname) like '%$kundeWithoutSS%')";
|
||||
$new_filter['add-where'] .= " OR (company like '%$kundeWithSS%' OR firstname like '%$kundeWithSS%' OR lastname like '%$kundeWithSS%' OR concat(firstname, ' ', lastname) like '%$kundeWithSS%' OR concat(lastname, ' ', firstname) like '%$kundeWithSS%')";
|
||||
} else {
|
||||
$new_filter['add-where'] .= " AND (company like '%$kunde%' OR firstname like '%$kunde%' OR lastname like '%$kunde%' OR concat(firstname, ' ', lastname) like '%$kunde%' OR concat(lastname, ' ', firstname) like '%$kunde%')";
|
||||
}
|
||||
}
|
||||
|
||||
if(!array_key_exists("parents_only", $filter)) {
|
||||
@@ -110,7 +118,7 @@ class AddressController extends mfBaseController {
|
||||
$new_filter[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $new_filter;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user