Fixed statusflags only set on Adddresses with Preorder and added snopp
connected api
This commit is contained in:
@@ -78,17 +78,27 @@ class AddressDB {
|
||||
//echo "in handleRimoStatusUpdate\n";
|
||||
|
||||
$wohneinheit = new ADBWohneinheit($wohneinheit_id);
|
||||
if(!$wohneinheit->id) return false;
|
||||
if(!$wohneinheit->id) {
|
||||
//echo "no wohneinheit\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
$hausnummer = $wohneinheit->hausnummer;
|
||||
if(!$hausnummer->netzgebiet->getOption("statuschange")) {
|
||||
//echo "no option statuschange\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
$order_type = false;
|
||||
|
||||
$preorder = PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
if(!$preorder) {
|
||||
return true;
|
||||
if($preorder) {
|
||||
$order_type = $preorder->type;
|
||||
}
|
||||
/*if(!$preorder) {
|
||||
echo "no preorder\n";
|
||||
return true;
|
||||
}*/
|
||||
|
||||
$b_ex_state = strtolower($hausnummer->rimo_ex_state);
|
||||
$b_op_state = strtolower($hausnummer->rimo_op_state);
|
||||
@@ -103,7 +113,7 @@ class AddressDB {
|
||||
}
|
||||
|
||||
|
||||
$order_type = $preorder->type;
|
||||
|
||||
|
||||
$status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX);
|
||||
|
||||
@@ -130,19 +140,19 @@ class AddressDB {
|
||||
|
||||
if($matrix["rwo"] && (!$workorder || $matrix["rwo"] != $wo_state)) continue;
|
||||
|
||||
if($matrix["pt"] && $matrix["pt"] != $order_type) continue;
|
||||
if($matrix["pt"] && $order_type && $matrix["pt"] != $order_type) continue;
|
||||
// seems all criteria match => set new status
|
||||
|
||||
$log->debug(__METHOD__.": new Preorder Status: ".$matrix["p"]);
|
||||
|
||||
$preorderstatus = $matrix["p"];
|
||||
if(!$preorderstatus) {
|
||||
continue;
|
||||
if($preorder) {
|
||||
$preorderstatus = $matrix["p"];
|
||||
if($preorderstatus) {
|
||||
$preorder->setNewStatusCode($preorderstatus);
|
||||
$preorder->save();
|
||||
}
|
||||
}
|
||||
|
||||
$preorder->setNewStatusCode($preorderstatus);
|
||||
$preorder->save();
|
||||
|
||||
$hausnummer_status = $matrix["h"];
|
||||
if($hausnummer_status) {
|
||||
$log->debug(__METHOD__.": new Hausnummer (".$hausnummer->id.") status: ".$matrix["h"]);
|
||||
|
||||
Reference in New Issue
Block a user