Added status check logic in Citycom API Helper and Snopp API

This commit is contained in:
Frank Schubert
2025-08-19 16:06:18 +02:00
parent 9524f4cc90
commit 037b086f57
2 changed files with 41 additions and 10 deletions

View File

@@ -114,6 +114,20 @@ class Citycom_OanApiHelper {
// order all services and save ctags
$cc_service_types = $this->api->getServiceTypes();
$this->log->debug(print_r($want_services, true));
// check if we have these services already
foreach($cc_service_types as $stype) {
if(!in_array($stype->name, CITYCOM_OAN_API_SERVICES_FOR_ORDER)) continue;
$ctag_service_type = array_flip(CITYCOM_OAN_API_SERVICES_FOR_ORDER)[$stype->name];
if(PreorderCtag::getFirstActive(["preorder_id" => $preorder->id, "service_type" => $ctag_service_type])) {
// service was ordered already, remove from want_services
unset($want_services[$ctag_service_type]);
}
}
$this->log->debug(print_r($want_services, true));
$new_services = [];
if($ctag_range_search) {
@@ -124,7 +138,7 @@ class Citycom_OanApiHelper {
$this->log->debug(print_r($ctags, true));
if(!$ctags) {
if(!is_array($ctags)) {
$this->log->error(__METHOD__.": No Free Ctags (Preorder ".$preorder->id.")");
return false;
}
@@ -141,7 +155,6 @@ class Citycom_OanApiHelper {
];
$service_count = 0;
$service_return = [];
foreach($cc_service_types as $stype) {
// was this service type requested
if(!in_array($stype->name, $want_services)) continue;
@@ -173,7 +186,7 @@ class Citycom_OanApiHelper {
return false;
}
$service_return[] = [
/*$service_return[] = [
"service_number" => $new_service->service_number,
"sublocation_id" => $sublocation_id,
"service_type" => $ctag_service_type,
@@ -182,7 +195,7 @@ class Citycom_OanApiHelper {
"serial" => $new_service->ont->serial,
"fsan" => $new_service->ont->fsan,
],
];
];*/
/*$service_return[] = [
"sublocation_id" => $sublocation_id,
@@ -225,7 +238,7 @@ class Citycom_OanApiHelper {
return $service_return;
return true;
}