Preorder: addresses in banned FCPs can not be ordered now

This commit is contained in:
Frank Schubert
2023-10-19 15:47:55 +02:00
parent 702e9f54c5
commit babaac9ea9
3 changed files with 26 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ class AddressDB {
`Hausnummer`.`rollout` AS `rollout`,
`Hausnummer`.`rollout_info` AS `rollout_info`,
`Hausnummer`.`freigabe` AS `freigabe`,
`Hausnummer`.`rimo_fcp_name` AS `rimo_fcp_name`,
`Wohneinheit`.`id` AS `wohneinheit_id`,
`Wohneinheit`.`oaid` AS `wohneinheit_oaid`,
`Wohneinheit`.`extref` AS `wohneinheit_extref`,

View File

@@ -421,6 +421,16 @@ class AddressdbApicontroller extends mfBaseApicontroller {
}
}
}
// if FCP is on blacklist, don't allow any order types
$campaign = $this->campaigns[$this->campaigns_by_scluster[$data->netzgebiet_id]];
if(!$campaign) {
$this->log->error("Campaign not found for netzgebiet_id ".$data->netzgebiet_id);
} else {
if($data->rimo_fcp_name && is_array($campaign->banned_fcps) && count($campaign->banned_fcps) && in_array($data->rimo_fcp_name, $campaign->banned_fcps)) {
$ptypes = [];
}
}
}
$housenumber = $data->hausnummer;
@@ -696,6 +706,16 @@ class AddressdbApicontroller extends mfBaseApicontroller {
}
}
}
// if FCP is on blacklist, don't allow any order types
$campaign = $this->campaigns[$this->campaigns_by_scluster[$data->netzgebiet_id]];
if(!$campaign) {
$this->log->error("Campaign not found for netzgebiet_id ".$data->netzgebiet_id);
} else {
if($data->rimo_fcp_name && is_array($campaign->banned_fcps) && count($campaign->banned_fcps) && in_array($data->rimo_fcp_name, $campaign->banned_fcps)) {
$ptypes = [];
}
}
}
$housenumber = $data->hausnummer;

View File

@@ -590,6 +590,11 @@ class PreorderApicontroller extends mfBaseApicontroller {
return mfResponse::Forbidden(['message' => "PreorderType not allowed"]);
}
// if FCP is on blacklist, don't allow order
if($address->rimo_fcp_name && is_array($this->campaign->banned_fcps) && count($this->campaign->banned_fcps) && in_array($address->rimo_fcp_name, $this->campaign->banned_fcps)) {
return mfResponse::Forbidden(['message' => "PreorderType not allowed"]);
}
/*
* build fields
*/