From dda503c615c4f3d87e256d85c9738fecd31dd97e Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 11 Nov 2025 18:32:46 +0100 Subject: [PATCH 1/8] Added button to create Netzbau Object from AdressDB --- Layout/default/AddressDB/Index.php | 4 + Layout/default/Building/Form.php | 9 +- application/Building/BuildingController.php | 136 ++++++++++++++++---- application/Building/BuildingModel.php | 1 + 4 files changed, 121 insertions(+), 29 deletions(-) diff --git a/Layout/default/AddressDB/Index.php b/Layout/default/AddressDB/Index.php index da16d14d0..5256baeb6 100644 --- a/Layout/default/AddressDB/Index.php +++ b/Layout/default/AddressDB/Index.php @@ -335,6 +335,10 @@ $address->id])?>"> $address->id])?>" class="pl-1"> $address->id])?>" onclick="if(!confirm('Addresse und alle Wohneinheiten wirklich löschen?')) return false;"> + + is("Admin")): ?> + $address->id])?>" target="_blank"> + diff --git a/Layout/default/Building/Form.php b/Layout/default/Building/Form.php index dddc0cf82..666997cac 100644 --- a/Layout/default/Building/Form.php +++ b/Layout/default/Building/Form.php @@ -28,6 +28,9 @@
+ + +
@@ -70,7 +73,11 @@
- + units == "from_adb"): ?> + + + +
diff --git a/application/Building/BuildingController.php b/application/Building/BuildingController.php index 1999bb46e..4cc2c1786 100644 --- a/application/Building/BuildingController.php +++ b/application/Building/BuildingController.php @@ -177,6 +177,9 @@ class BuildingController extends mfBaseController { protected function saveAction() { $r = $this->request; $id = $r->id; + + $adb_hausnummer_id = null; + //var_dump($r);exit; if(is_numeric($id) && $id > 0) { $mode = "edit"; @@ -187,6 +190,9 @@ class BuildingController extends mfBaseController { } } else { $mode = "add"; + if($r->adb_hausnummer_id) { + $adb_hausnummer_id = $r->adb_hausnummer_id; + } } if(!$r->network_id || !$r->type_id) { @@ -215,10 +221,17 @@ class BuildingController extends mfBaseController { $data['contact'] = trim($r->contact); $data['phone'] = trim($r->phone); $data['email'] = trim($r->email); - $data['units'] = trim($r->units); + $data['description'] = trim($r->description); $data['note'] = trim($r->note); - + + if($adb_hausnummer_id) { + $data["adb_hausnummer_id"] = $adb_hausnummer_id; + $data['units'] = 0; + } else { + $data['units'] = trim($r->units); + } + if($this->me->is(["Admin", "netowner"])) { if($r->gps_lat) $data['gps_lat'] = trim($r->gps_lat); if($r->gps_long) $data['gps_long'] = trim($r->gps_long); @@ -235,7 +248,7 @@ class BuildingController extends mfBaseController { // check if building exists already $checkBuilding = BuildingModel::search(['=street' => $data['street'], '=city' => $data['city'], '=zip' => $data['zip']]); - + if($checkBuilding) { $this->layout()->setFlash("Objekt ist bereits vorhanden!", "error"); $this->layout()->set("building", $building); @@ -283,30 +296,49 @@ class BuildingController extends mfBaseController { } // Anschlüsse anlegen - - if(!$building->terminations && $building->units > 0) { - for($i = 1; $i <= $building->units; $i++) { - $data = []; - $data['building_id'] = $building->id; - $data['code'] = $building->code . "." . sprintf("%03d", $i); - - if($building->units == 1) { - $data['contact'] = $building->contact; - $data['phone'] = $building->phone; - $data['email'] = $building->email; - } - /* - // no more lineworker_id in Termination - if($building->lineworker_id) { - $data['lineworker_id'] = $building->lineworker_id; - }*/ - if($building->oaid) { - $data['oaid'] = $building->oaid. "." . sprintf("%03d", $i); - } - - $term = TerminationModel::create($data); - $term->save(); - } + + if($mode == "add" && $adb_hausnummer_id) { + $i = 1; + foreach(ADBWohneinheitModel::search(["hausnummer_id" => $adb_hausnummer_id]) as $wohneinheit) { + $data = []; + $data['building_id'] = $building->id; + + $oaid_parts = explode(".", $wohneinheit->oaid); + if($wohneinheit->oaid && array_key_exists(1, $oaid_parts)) { + $data['code'] = $building->oaid . "." . $oaid_parts[1]; + } else { + $data['code'] = $building->code . "." . sprintf("%04d", $i); + } + $data['oaid'] = $data['code']; + + $term = TerminationModel::create($data); + $term->save(); + + $i++; + } + } elseif(!$building->terminations && $building->units > 0) { + for($i = 1; $i <= $building->units; $i++) { + $data = []; + $data['building_id'] = $building->id; + $data['code'] = $building->code . "." . sprintf("%03d", $i); + + if($building->units == 1) { + $data['contact'] = $building->contact; + $data['phone'] = $building->phone; + $data['email'] = $building->email; + } + /* + // no more lineworker_id in Termination + if($building->lineworker_id) { + $data['lineworker_id'] = $building->lineworker_id; + }*/ + if($building->oaid) { + $data['oaid'] = $building->oaid. "." . sprintf("%03d", $i); + } + + $term = TerminationModel::create($data); + $term->save(); + } } @@ -343,7 +375,55 @@ class BuildingController extends mfBaseController { $this->layout()->setFlash("Objekt gelöscht", "success"); $this->redirect("Building"); } - + + protected function createFromAdbAction() { + $adb_hausnummer_id = $this->request->adb_hausnummer_id; + + if(!$adb_hausnummer_id) { + $this->layout()->setFlash("AddressDB Adresse nicht gefunden.", "error"); + $this->redirect("AddressDB"); + } + + $hausnummer = new ADBHausnummer($adb_hausnummer_id); + if(!$hausnummer->id) { + $this->layout()->setFlash("AddressDB Adresse nicht gefunden.", "error"); + $this->redirect("AddressDB"); + } + + $network = NetworkModel::getFirst(["adb_netzgebiet_id" => $hausnummer->netzgebiet_id]); + if(!$network) { + $this->layout()->setFlash("AddressDB-Netzgebiet ist keinem Netzbau-Netzgebiet zugeordnet!", "error"); + $this->redirect("AddressDB"); + } + + $building_data = []; + $building_data["adb_hausnummer_id"] = $hausnummer->id; + $building_data["network_id"] = $network->id; + $building_data["type_id"] = ($hausnummer->tool_building_type <= 1) ? 1 : 3; // 1 = EFH | 2 = MPH + $building_data["status_id"] = 1; + + if($hausnummer->oaid) { + if(!BuildingModel::getFirst(["code" => $hausnummer->oaid])) { + $building_data["code"] = $hausnummer->oaid; + } + $building_data["oaid"] = $hausnummer->oaid; + } + + $building_data["street"] = $hausnummer->strasse->name . " ".$hausnummer->hausnummer; + $building_data["city"] = $hausnummer->strasse->gemeinde->name; + $building_data["zip"] = $hausnummer->plz->plz; + $building_data["gps_lat"] = $hausnummer->gps_lat; + $building_data["gps_long"] = $hausnummer->gps_long; + $building_data["units"] = "from_adb"; + $building_data["note"] = "Created from ADB Address {$hausnummer->id}"; + + $building = BuildingModel::create($building_data); + $this->layout()->set("building", $building); + $this->layout()->set("adb_hausnummer_id", $hausnummer->id); + + return $this->addAction(); + } + protected function apiAction() { if(!$this->me->is(["Admin","netowner","pipeplanner"])) { diff --git a/application/Building/BuildingModel.php b/application/Building/BuildingModel.php index 7e0891345..19e55f9a5 100644 --- a/application/Building/BuildingModel.php +++ b/application/Building/BuildingModel.php @@ -1,6 +1,7 @@ Date: Tue, 11 Nov 2025 18:33:25 +0100 Subject: [PATCH 2/8] added migration to resize oaid in Building/Termination --- ...20251111171837_termination_resize_code.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 db/migrations/20251111171837_termination_resize_code.php diff --git a/db/migrations/20251111171837_termination_resize_code.php b/db/migrations/20251111171837_termination_resize_code.php new file mode 100644 index 000000000..6507c09d6 --- /dev/null +++ b/db/migrations/20251111171837_termination_resize_code.php @@ -0,0 +1,36 @@ +getEnvironment() == "thetool") { + $table = $this->table("Termination"); + $table->changeColumn("code", "string", ["length" => 64, "null" => true, "default" => null]); + $table->update(); + + $table = $this->table("Building"); + $table->changeColumn("code", "string", ["length" => 64, "null" => true, "default" => null]); + $table->changeColumn("oaid", "string", ["length" => 255, "null" => true, "default" => null]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} From d00f340a254f38dcb6430075dbb9b74c362df7ae Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 11 Nov 2025 20:03:28 +0100 Subject: [PATCH 3/8] Added Call detail CSV to invoice list --- Layout/default/Invoice/Index.php | 3 +- application/Invoice/InvoiceController.php | 106 ++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/Layout/default/Invoice/Index.php b/Layout/default/Invoice/Index.php index 5f269cc04..32fcff61e 100644 --- a/Layout/default/Invoice/Index.php +++ b/Layout/default/Invoice/Index.php @@ -342,7 +342,8 @@ $pagination_entity_name = "Rechnungen"; billing_type == "sepa") ? "SEPA" : "Überweisung"?> billing_delivery == "email") ? "Email" : "Papier"?> - $invoice->id])?>" title="CSV-Download"> + $invoice->id])?>" title="CSV-Download"> + $invoice->id])?>" title="CSV-Download"> diff --git a/application/Invoice/InvoiceController.php b/application/Invoice/InvoiceController.php index 1871ffd2e..f860ed672 100644 --- a/application/Invoice/InvoiceController.php +++ b/application/Invoice/InvoiceController.php @@ -212,6 +212,112 @@ class InvoiceController extends mfBaseController { exit; } + protected function downloadInvoiceVoiceDetailsAction() { + $id = $this->request->id; + if (!is_numeric($id) || !$id) { + $this->layout()->setFlash("Rechnung nicht gefunden", "error"); + $this->redirect("Invoice"); + } + + $invoice = new Invoice($id); + if (!$invoice->id) { + $this->layout()->setFlash("Rechnung nicht gefunden", "error"); + $this->redirect("Invoice"); + } + + $csv = "Startzeit;Abgehende Nummer;Zielnummer;Zone;Dauer;Kosten\n"; + + $destinations_cache = []; + + foreach($invoice->voicenumbers as $voicenumber) { + $start_date = new DateTime($voicenumber->start_date); + //$start_date->setTimezone(new DateTimeZone("Europe/Vienna")); + $start_date->setTime(0,0,0); + $end_date = new DateTime($voicenumber->end_date); + //$end_date->setTimezone(new DateTimeZone("Europe/Vienna")); + $end_date->setTime(23,59,59); + + foreach(VoiceCallHistoryModel::getVoiceCallHistoryAsEntity([ + "voice_account" => $voicenumber->voicenumber, + "start" => [ + "from" => $start_date->getTimestamp(), + "to" => $end_date->getTimestamp() + ], + "billable" => 1, + ], null, 0, ["key" => "start", "order" => "ASC"]) as $call) { + if(!$call->contract_id) continue; + + //$voiceplan = new Voiceplan($voicenumber->voiceplan_id); + $voiceplan = VoiceplanModel::getFirst(["name" => $voicenumber->voiceplan]); + if(!$voiceplan) { + $this->log->warning(__METHOD__.": Voiceplan not found"); + }; + + $number = $voicenumber->voicenumber; + $dest_nummer = $call->destination; + if (substr($dest_nummer, 0, 2) == "00") { + $dest_nummer = substr($dest_nummer, 2); + } + + if (substr($dest_nummer, 0, 1) == "+") { + $dest_nummer = substr($dest_nummer, 1); + } + + if (array_key_exists($dest_nummer, $destinations_cache)) { + $destination = $destinations_cache[$dest_nummer]; + } else { + $destination = $voiceplan->getDestinationByNumber($dest_nummer); + if (!$destination) { + die("Destination für Zielrufnummer " . $call->destination . " nicht gefunden"); + } + $destinations_cache[$dest_nummer] = $destination; + } + //var_dump($destination); + + $zone = $destination->voiceplanzone; + + if (!$zone) { + die("Keine Zone für Destination " . $dest_nummer . " gefunden"); + } + + //var_dump($zone);exit; + + // inc_first - first minimumm duration to bill + // inc - subsequent minimum duration to bill + $inc_first = $zone->increment_first; + $inc = $zone->increment; + + $billable_duration = $call->duration; + if ($billable_duration <= 0) continue; + + // calculate price of first duration unit + // then subtract first minimum duration from duration + $sec_price = $zone->price / 60; + $call_price = $inc_first * $sec_price; + $billable_duration -= $inc_first; + + // calculate price of remaining duration and make sure to bill in full duration units + if ($billable_duration > 0) { + $multi = ceil($billable_duration / $inc); + $call_price += ($multi * $inc) * $sec_price; + } + + $csv .= '"'.$call->start.'";'; + $csv .= '"'.$call->source.'"; '; + $csv .= '"'.$call->destination.'"; '; + $csv .= '"'.$zone->name.'"; '; + $csv .= $call->duration.'; '; + $csv .= '"'.str_replace(".",",", $call_price).'"'; + $csv .= "\n"; + } + + } + + header("Content-type: text/csv; charset=utf-8"); + header('Content-disposition: attachment; filename="'.$invoice->invoice_number.'-egn.csv"'); + echo $csv; + exit; + } protected function createJob() { $r = $this->request; From 937b71244debecf75aa64a6f3480ebe3cbd44005 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 11 Nov 2025 21:41:32 +0100 Subject: [PATCH 4/8] Fixed invoicing only one of several voicezones with same name --- application/Billing/BillingController.php | 10 +++-- .../BillingVoicenumberModel.php | 1 + application/Invoice/InvoiceController.php | 39 ++++++++++++------- ...201335_billing_voicenumber_add_zone_id.php | 31 +++++++++++++++ 4 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 db/migrations/20251111201335_billing_voicenumber_add_zone_id.php diff --git a/application/Billing/BillingController.php b/application/Billing/BillingController.php index 0425519d3..9f0694e9f 100644 --- a/application/Billing/BillingController.php +++ b/application/Billing/BillingController.php @@ -153,6 +153,7 @@ class BillingController extends mfBaseController { $v = 0; $today = new DateTime("now"); + //$today = new DateTime("2026-01-09"); $today->setTime(0,0,0); $now_year = date("Y"); @@ -191,7 +192,7 @@ class BillingController extends mfBaseController { $contract_search = [ "finish_date<" => mktime(2,0,0,$now_month, $now_day, $now_year), "cancel_date_null_or_gte" => mktime(0,0,0,$now_month, 1, $now_year), - //"owner_id" => 1221 + "owner_id" => 7719 ]; foreach(ContractModel::search($contract_search) as $contract) { @@ -715,6 +716,7 @@ class BillingController extends mfBaseController { } if (!array_key_exists($zone->id, $voicebills[$number][$call_date_start])) { $voicebills[$number][$call_date_start][$zone->id] = [ + //"zone_id" => $zone->id, "zone_name" => $zone->name, "voiceplan" => $voiceplan->name, "duration" => 0, @@ -738,8 +740,8 @@ class BillingController extends mfBaseController { // save to BillingVoicenumber foreach($voicebills as $vbnumber => $zones) { - foreach($zones as $zone_id => $zone) { - foreach($zone as $zone_start_date => $vb) { + foreach($zones as $zone_start_date => $zone) { + foreach($zone as $zone_id => $vb) { $vbdata = []; $vbdata["billing_id"] = $billing->id; $vbdata["contract_id"] = $contract->id; @@ -747,6 +749,7 @@ class BillingController extends mfBaseController { $vbdata["start_date"] = $vb["start_date"]; $vbdata["end_date"] = $vb["end_date"]; $vbdata["voiceplan"] = $vb["voiceplan"]; + $vbdata["zone_id"] = $zone_id; $vbdata["zone"] = $vb["zone_name"]; $vbdata["call_count"] = $vb["count"]; $vbdata["duration"] = $vb["duration"]; @@ -756,6 +759,7 @@ class BillingController extends mfBaseController { $vbdata["increment_first"] = $vb["increment_first"]; $bill_voice = BillingVoicenumberModel::create($vbdata); + $this->log->debug(__METHOD__.": billingvoicenumber record created: ".print_r($vbdata, true)); if(!$bill_voice->save()) { var_dump($vbdata); die("Error saving Billing Voicenumber!"); diff --git a/application/BillingVoicenumber/BillingVoicenumberModel.php b/application/BillingVoicenumber/BillingVoicenumberModel.php index f44184c85..f205854a8 100644 --- a/application/BillingVoicenumber/BillingVoicenumberModel.php +++ b/application/BillingVoicenumber/BillingVoicenumberModel.php @@ -7,6 +7,7 @@ class BillingVoicenumberModel { public $start_date; public $end_date; public $voiceplan; + public $zone_id; public $zone; public $call_count; public $duration; diff --git a/application/Invoice/InvoiceController.php b/application/Invoice/InvoiceController.php index f860ed672..6d44febed 100644 --- a/application/Invoice/InvoiceController.php +++ b/application/Invoice/InvoiceController.php @@ -227,8 +227,9 @@ class InvoiceController extends mfBaseController { $csv = "Startzeit;Abgehende Nummer;Zielnummer;Zone;Dauer;Kosten\n"; + $total = 0; $destinations_cache = []; - + //var_dump($invoice->voicenumbers);exit; foreach($invoice->voicenumbers as $voicenumber) { $start_date = new DateTime($voicenumber->start_date); //$start_date->setTimezone(new DateTimeZone("Europe/Vienna")); @@ -237,6 +238,8 @@ class InvoiceController extends mfBaseController { //$end_date->setTimezone(new DateTimeZone("Europe/Vienna")); $end_date->setTime(23,59,59); + $call_date_start = $start_date->format("Y-m-d"); + foreach(VoiceCallHistoryModel::getVoiceCallHistoryAsEntity([ "voice_account" => $voicenumber->voicenumber, "start" => [ @@ -251,7 +254,8 @@ class InvoiceController extends mfBaseController { $voiceplan = VoiceplanModel::getFirst(["name" => $voicenumber->voiceplan]); if(!$voiceplan) { $this->log->warning(__METHOD__.": Voiceplan not found"); - }; + exit; + } $number = $voicenumber->voicenumber; $dest_nummer = $call->destination; @@ -309,6 +313,9 @@ class InvoiceController extends mfBaseController { $csv .= $call->duration.'; '; $csv .= '"'.str_replace(".",",", $call_price).'"'; $csv .= "\n"; + + $total += $call_price; + } } @@ -486,34 +493,38 @@ class InvoiceController extends mfBaseController { $inc = reset($voicebills)->increment; $inc_first = reset($voicebills)->increment_first; + $zoneId2ZoneName = []; + $voice_rows = []; foreach ($voicebills as $voicebill) { $number = $voicebill->voicenumber; + $zone_id = $voicebill->zone_id; $zone = $voicebill->zone; $call_count = $voicebill->call_count; $duration = $voicebill->duration; $price = $voicebill->price; $price_total = $voicebill->price_total; + $zoneId2ZoneName[$zone_id] = $zone; if (!array_key_exists($number, $voice_rows)) { $voice_rows[$number] = []; } - if (!array_key_exists($zone, $voice_rows[$number])) { - $voice_rows[$number][$zone] = []; + if (!array_key_exists($zone_id, $voice_rows[$number])) { + $voice_rows[$number][$zone_id] = []; } - if (!array_key_exists($price, $voice_rows[$number][$zone])) { - $voice_rows[$number][$zone][$price] = []; - $voice_rows[$number][$zone][$price]["call_count"] = 0; - $voice_rows[$number][$zone][$price]["duration"] = 0; - $voice_rows[$number][$zone][$price]["price_total"] = 0; + if (!array_key_exists($price, $voice_rows[$number][$zone_id])) { + $voice_rows[$number][$zone_id][$price] = []; + $voice_rows[$number][$zone_id][$price]["call_count"] = 0; + $voice_rows[$number][$zone_id][$price]["duration"] = 0; + $voice_rows[$number][$zone_id][$price]["price_total"] = 0; } - $voice_rows[$number][$zone][$price]["call_count"] += $call_count; - $voice_rows[$number][$zone][$price]["duration"] = $duration; - $voice_rows[$number][$zone][$price]["price_total"] = $price_total; + $voice_rows[$number][$zone_id][$price]["call_count"] += $call_count; + $voice_rows[$number][$zone_id][$price]["duration"] = $duration; + $voice_rows[$number][$zone_id][$price]["price_total"] = $price_total; } //var_dump($voice_rows);exit; @@ -533,10 +544,10 @@ class InvoiceController extends mfBaseController { $invoice_voicenumber->voicenumberzones = []; - foreach ($zones as $zone => $prices) { + foreach ($zones as $zone_id => $prices) { foreach ($prices as $price => $row_values) { $zone_data = []; - $zone_data["zone"] = $zone; + $zone_data["zone"] = $zoneId2ZoneName[$zone_id]; $zone_data["call_count"] = $row_values["call_count"]; $zone_data["duration"] = $row_values["duration"]; $zone_data["price"] = $price; diff --git a/db/migrations/20251111201335_billing_voicenumber_add_zone_id.php b/db/migrations/20251111201335_billing_voicenumber_add_zone_id.php new file mode 100644 index 000000000..611f2108f --- /dev/null +++ b/db/migrations/20251111201335_billing_voicenumber_add_zone_id.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + $table = $this->table("BillingVoicenumber"); + $table->addColumn("zone_id", "integer", ["null" => true, "default" => null, "after" => "voiceplan"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $this->table("BillingVoicenumber")->removeColumn("zone_id")->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} From 9e550f4c4f76cb49e2aff19607257eb2b9ded26a Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 11 Nov 2025 21:42:52 +0100 Subject: [PATCH 5/8] Fixed invoicing only one of several voicezones with same name --- application/Billing/BillingController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/Billing/BillingController.php b/application/Billing/BillingController.php index 9f0694e9f..7c4c0b915 100644 --- a/application/Billing/BillingController.php +++ b/application/Billing/BillingController.php @@ -153,7 +153,6 @@ class BillingController extends mfBaseController { $v = 0; $today = new DateTime("now"); - //$today = new DateTime("2026-01-09"); $today->setTime(0,0,0); $now_year = date("Y"); @@ -192,7 +191,7 @@ class BillingController extends mfBaseController { $contract_search = [ "finish_date<" => mktime(2,0,0,$now_month, $now_day, $now_year), "cancel_date_null_or_gte" => mktime(0,0,0,$now_month, 1, $now_year), - "owner_id" => 7719 + //"owner_id" => 7719 ]; foreach(ContractModel::search($contract_search) as $contract) { From 5b7c8d3c645dbdc326f4873074c7019ebe7c8ddb Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 11 Nov 2025 21:46:22 +0100 Subject: [PATCH 6/8] Fixed title attribute on egn download button --- Layout/default/Invoice/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Layout/default/Invoice/Index.php b/Layout/default/Invoice/Index.php index 32fcff61e..f80df6423 100644 --- a/Layout/default/Invoice/Index.php +++ b/Layout/default/Invoice/Index.php @@ -343,7 +343,7 @@ $pagination_entity_name = "Rechnungen"; billing_delivery == "email") ? "Email" : "Papier"?> $invoice->id])?>" title="CSV-Download"> - $invoice->id])?>" title="CSV-Download"> + $invoice->id])?>" title="Download EGN"> From 988fad1a673b37fba80cccd0dbf6c08b35ec5f0b Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 12 Nov 2025 14:30:05 +0100 Subject: [PATCH 7/8] TT_PREORDER_RIMO_STATUS_MATRIX now has netowner specific config --- application/AddressDB/AddressDB.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/application/AddressDB/AddressDB.php b/application/AddressDB/AddressDB.php index 3c5856bd7..39db020c9 100644 --- a/application/AddressDB/AddressDB.php +++ b/application/AddressDB/AddressDB.php @@ -130,9 +130,13 @@ class AddressDB { } + $netowner = $hausnummer->getNetowner(); + if(!$netowner || !$netowner->id) { + $log->debug(__METHOD__.": Unable to determine netowner for Hausnummer ".$hausnummer->id); + return true; + } - - $status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX); + $status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX[$netowner->id]); $log->debug(__METHOD__.": b_ex_state: ".$b_ex_state); $log->debug(__METHOD__.": b_op_state: ".$b_op_state); @@ -218,7 +222,6 @@ class AddressDB { if($hausnummer->status_id != $old_status) { $hausnummer->save(); } - } //$wohneinheit = new ADBWohneinheit($wohneinheit->id); @@ -234,9 +237,18 @@ class AddressDB { } + if(array_key_exists("hf", $matrix)) { + $hausnummer_flag = $matrix["hf"]; + if($hausnummer_flag) { + $log->debug(__METHOD__.": new Hausnummer (".$wohneinheit->id.") statusflag: ".$matrix["hf"]); + $hausnummer->setStatusflag($hausnummer_flag, 1); + } + } - break; + + // commented, for 140/141 + //break; } return true; } From be2c22ca50644501dc8b51ac0aa7ead47cc2f74c Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 13 Nov 2025 13:11:13 +0100 Subject: [PATCH 8/8] Fixed uploading documents in closed Orders --- Layout/default/Order/Form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Layout/default/Order/Form.php b/Layout/default/Order/Form.php index 7b28f713c..a513c694e 100644 --- a/Layout/default/Order/Form.php +++ b/Layout/default/Order/Form.php @@ -1860,7 +1860,7 @@ } - reader.readAsText(selectedFile); + reader.readAsArrayBuffer(selectedFile); });