From 54365078b7dbc061226c3a99215a7499eeabdc94 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 15 Apr 2025 15:28:59 +0200 Subject: [PATCH] Rimo Import: Fixed setting Preorderstatus to 140 when setting flag 141 --- application/AddressDB/AddressDB.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/application/AddressDB/AddressDB.php b/application/AddressDB/AddressDB.php index 156a25d01..163c20c3d 100644 --- a/application/AddressDB/AddressDB.php +++ b/application/AddressDB/AddressDB.php @@ -147,7 +147,7 @@ class AddressDB { if(!$wohneinheit_id) return true; $log = mfLoghandler::singleton(); - //echo "in handleRimoStatusUpdate\n"; + $log->debug(__METHOD__.": =============================== in handleRimoStatusUpdate"); $wohneinheit = new ADBWohneinheit($wohneinheit_id); if(!$wohneinheit->id) { @@ -190,6 +190,14 @@ class AddressDB { $status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX); + $log->debug(__METHOD__.": b_ex_state: ".$b_ex_state); + $log->debug(__METHOD__.": b_op_state: ".$b_op_state); + $log->debug(__METHOD__.": h_ex_state: ".$h_ex_state); + $log->debug(__METHOD__.": h_op_state: ".$h_op_state); + $log->debug(__METHOD__.": wo_state: ".$wo_state); + $log->debug(__METHOD__.": order_type: ".$order_type); + + foreach($status_matrix as $matrix) { //var_dump($matrix); if($matrix["rbop"]) { @@ -218,8 +226,22 @@ class AddressDB { $log->debug(__METHOD__.": new Preorder Status: ".$matrix["p"]); if($preorder) { - $preorderstatus = $matrix["p"]; + $preorderstatus = null; + $preorderstatus_flag = null; + if(array_key_exists("p", $matrix) && $matrix["p"]) { + $preorderstatus = $matrix["p"]; + } + if(array_key_exists("pf", $matrix) && $matrix["pf"]) { + $preorderstatus_flag = $matrix["pf"]; + } + if($preorderstatus) { + $log->debug(__METHOD__.": Setting Preorder Status to ".$preorderstatus); + $preorder->setNewStatusCode($preorderstatus); + $preorder->save(); + } + if($preorderstatus_flag) { + $log->debug(__METHOD__.": Setting Preorder Status Flag ".$preorderstatus); $preorder->setNewStatusCode($preorderstatus); $preorder->save(); }