updated vodia identity

This commit is contained in:
Luca Haid
2025-08-07 13:05:07 +00:00
parent fed87a236c
commit 4313cf70c0
4 changed files with 139 additions and 11 deletions

View File

@@ -414,12 +414,18 @@ class AddressModel {
}
}
if (array_key_exists("pfm", $filter)) {
$pfm = FronkDB::singleton()->escape($filter["pfm"]);
if ($pfm) {
$where .= " AND (phone like '%$pfm%' OR fax like '%$pfm%' OR mobile like '%$pfm%' )";
$pfm = preg_replace('/^(43|0)/', '', preg_replace('/[^0-9]/', '', $filter['pfm'] ?? ''));
if (!empty($pfm)) {
$pfmEscaped = FronkDB::singleton()->escape($pfm);
$searchColumns = ['phone', 'fax', 'mobile'];
$conditions = array_map(function ($column) use ($pfmEscaped) {
$normalizedColumn = "REGEXP_REPLACE(REGEXP_REPLACE(`$column`, '[^0-9]', ''), '^(43|0)', '')";
return "$normalizedColumn LIKE '%$pfmEscaped%'";
}, $searchColumns);
$where .= " AND (" . implode(' OR ', $conditions) . ")";
}
}
if (array_key_exists("billing_type", $filter)) {
$billing_type = FronkDB::singleton()->escape($filter["billing_type"]);