feat: add fcp map

fix: fixed lazy fcp search
fix: try to fix preorder filter
This commit is contained in:
Luca Haid
2025-04-08 11:46:10 +02:00
parent 3d3e082fb5
commit 26b92c411c
7 changed files with 323 additions and 6 deletions
+16 -4
View File
@@ -1005,14 +1005,26 @@ class PreorderModel
}
}
}
if (!empty($filter['fcp'])) {
if (!empty($filter['fcp']) && array_key_exists("preordercampaign_id", $filter)) {
$fcp = $filter['fcp'];
$db = FronkDB::singleton();
$campaign = new Preordercampaign($filter['preordercampaign_id']);
if (is_array($fcp)) {
$items = array_map(fn($i) => "'" . $db->escape($i) . "'", array_filter($fcp));
if ($items) $where .= " AND adb_hausnummer.rimo_fcp_name IN (" . implode(',', $items) . ")";
$items = array_map(fn($i) => ADBRimoFcp::getAll([
'netzgebiet_id' => intval($campaign->network->adb_netzgebiet_id),
'name' => $i])[0], array_filter($fcp));
$items = array_map(fn($i) => $i->id, array_filter($items));
if ($items) $where .= " AND adb_hausnummer.fcp_id IN (" . implode(',', $items) . ")";
} else {
$fcp = ADBRimoFcp::getAll([
'netzgebiet_id' => intval($campaign->network->adb_netzgebiet_id),
'name' => $fcp]);
if ($fcp) $fcp = $fcp[0]->id;
else $fcp = null;
$where .= " AND adb_hausnummer.rimo_fcp_name = '" . $db->escape($fcp) . "'";
}
}