WIP 2025-07-31 Citycom OAN Api WIP

This commit is contained in:
Frank Schubert
2025-07-31 16:20:31 +02:00
parent c44a429af7
commit 3718ceefdf
10 changed files with 832 additions and 26 deletions

View File

@@ -196,6 +196,41 @@ class CitycomImporter {
}
// get Services to save ONT data
$services = $ccapi->getServices();
foreach($services as $service) {
if(!property_exists($service, "ont") || !$service->ont || !$service->ont->id) continue;
if(!property_exists($service, "location") || !$service->location || !$service->location->id) continue;
if(!property_exists($service->location, "sublocation") || !$service->location->sublocation || !$service->location->sublocation->id) continue;
//var_dump($service);
$extref = $this->citycomIdToHausnummerExtref($service->location->sublocation->id);
$unit = \ADBWohneinheitModel::getFirst(["extref" => $extref]);
if(!$unit) continue;
$preorder = \PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id]);
if(!$preorder) continue;
$pco = \PreorderCitycomOan::getFirst(["preorder_id" => $preorder->id]);
if(!$pco) {
$pco = \PreorderCitycomOan::create([
"preorder_id" => $preorder->id
]);
}
$ont_sn = $service->ont->serial;
$ont_gpid = $service->ont->fsan;
if($pco->ont_sn != $ont_sn || $pco->ont_gpid != $ont_gpid) {
$pco->ont_sn = $ont_sn;
$pco->ont_gpid = $ont_gpid;
$pco->save();
}
}
return true;
}