WIP 2025-07-31 Citycom OAN Api WIP
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user