Fixed crash in Rimo Import when no preorder with unit id

This commit is contained in:
Frank Schubert
2024-10-21 12:59:59 +02:00
parent bd0421b175
commit f94135c44d

View File

@@ -483,8 +483,8 @@ foreach ($clusters as $cluster_data) {
if(property_exists($service, "customerState") && is_object($service->customerState) && property_exists($service->customerState, "userLabel") && strtolower($service->customerState->userLabel) == "active") {
// active => order 500
$preorder = \PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id]);
$preorder->resetSaveNesting();
if($preorder) {
$preorder->resetSaveNesting();
$new_status = \PreorderstatusModel::getFirst(["code" => 500]);
if($new_status) {
if($preorder->status->code < $new_status->code) {