fixed multiple stuff
This commit is contained in:
@@ -322,12 +322,23 @@ class AddressModel {
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("company", $filter)) {
|
||||
$company = FronkDB::singleton()->escape($filter["company"]);
|
||||
if ($company) {
|
||||
$where .= " AND company like '%$company%'";
|
||||
if (array_key_exists("company", $filter)) {
|
||||
$companyInput = trim($filter["company"]);
|
||||
if ($companyInput !== '') {
|
||||
$companyParts = preg_split('/\s+/', $companyInput);
|
||||
$companyConditions = [];
|
||||
foreach ($companyParts as $companyPart) {
|
||||
$escapedCompanyPart = FronkDB::singleton()->escape($companyPart);
|
||||
if ($escapedCompanyPart) {
|
||||
$companyConditions[] = "company LIKE '%{$escapedCompanyPart}%'";
|
||||
}
|
||||
}
|
||||
if (!empty($companyConditions)) {
|
||||
$where .= " AND (" . implode(" AND ", $companyConditions) . ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists("firstname", $filter)) {
|
||||
$firstname = FronkDB::singleton()->escape($filter["firstname"]);
|
||||
@@ -343,12 +354,22 @@ class AddressModel {
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("mergedName", $filter)) {
|
||||
$name = FronkDB::singleton()->escape($filter["mergedName"]);
|
||||
if ($name) {
|
||||
$where .= " AND (CONCAT(firstname, ' ', lastname) like '%$name%' OR CONCAT(lastname, ' ', firstname) like '%$name%' )";
|
||||
if (array_key_exists("mergedName", $filter)) {
|
||||
$mergedName = trim($filter["mergedName"]);
|
||||
if ($mergedName !== '') {
|
||||
$names = preg_split('/\s+/', $mergedName);
|
||||
$conditions = [];
|
||||
foreach ($names as $namePart) {
|
||||
$escapedNamePart = FronkDB::singleton()->escape($namePart);
|
||||
if ($escapedNamePart) {
|
||||
$conditions[] = "(firstname LIKE '%{$escapedNamePart}%' OR lastname LIKE '%{$escapedNamePart}%')";
|
||||
}
|
||||
}
|
||||
if (!empty($conditions)) {
|
||||
$where .= " AND (" . implode(" AND ", $conditions) . ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("street", $filter)) {
|
||||
$street = FronkDB::singleton()->escape($filter["street"]);
|
||||
|
||||
Reference in New Issue
Block a user