From 898e35f830d1793aff4c9376b308e977180c4f40 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 15 Jan 2024 18:16:20 +0100 Subject: [PATCH 01/19] Update to Dashboard Preorder statistics --- Layout/default/Dashboard/Dashboard.php | 110 +++++++++++++++++- application/Dashboard/DashboardController.php | 54 +++++++-- 2 files changed, 152 insertions(+), 12 deletions(-) diff --git a/Layout/default/Dashboard/Dashboard.php b/Layout/default/Dashboard/Dashboard.php index b38155320..6ebac6122 100644 --- a/Layout/default/Dashboard/Dashboard.php +++ b/Layout/default/Dashboard/Dashboard.php @@ -159,22 +159,76 @@ $chartColors = [
- $count): ?> + $count): ?> - +
## % ()strtrim($provider,22)?>strtrim($partner,22)?>
- Keine Aktiven Anschlüsse + Keine Bestellungen + +
+
+
+

Bestellstatus je Partner

+
+
+ + $status): ?> +
+
+
+ strtrim($partner, 200)?> +
+
+
+
+ +
+
+ + $count): ?> + + + + + + + +
##% () - " style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> + +
+
+
+ +
+
+
+ +
+
+ + + +
+ + + Keine Bestellungen + + +
+
+
+ @@ -301,6 +355,56 @@ $chartColors = [ + var status = []; + + status[id?>] = {"code": "code?>", "name": "name?>"}; + + + + + var productCharts = []; + + $status): ?> + productCharts[] = new Chart(document.getElementById('partner-status-').getContext('2d'), { + type: 'doughnut', + data: { + labels: [ + $count): ?> + + code?> - name?> " (%)", + + + ], + datasets: [{ + data: [ + $count): ?> + + , + + ], + backgroundColor: [ + "" + ], + /*borderColor: [ + "#d54369", + "#4592e0" + ],*/ + borderWidth: 1 + + }] + }, + options: { + scales: { + y: { + beginAtZero: true + } + }, + legend: false + + } + }); + + }); diff --git a/application/Dashboard/DashboardController.php b/application/Dashboard/DashboardController.php index 5adff48a1..5f4ff600a 100644 --- a/application/Dashboard/DashboardController.php +++ b/application/Dashboard/DashboardController.php @@ -61,6 +61,7 @@ class DashboardController extends mfBaseController { $status_connected = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 500]); $partner_orders = $this->getPartnerOrderCount($campaign_ids); + $partner_orders_by_status = $this->getPartnerOrdersByStatus($campaign_ids); } else { $campaigns = PreordercampaignModel::search(["owner_id" => $this->me->address_id]); @@ -78,7 +79,9 @@ class DashboardController extends mfBaseController { $status_connected_multi = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 245]); $status_connected = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 500]); + $partner_orders = $this->getPartnerOrderCount($campaign_ids); + $partner_orders_by_status = $this->getPartnerOrdersByStatus($campaign_ids); } $total_orders = $partner_orders["total"]; @@ -86,6 +89,13 @@ class DashboardController extends mfBaseController { //var_dump($partner_orders);exit; + $stati = []; + foreach(PreorderstatusModel::getAll() as $status) { + $stati[$status->id] = ["code" => $status->code, "name" => $status->name]; + } + + $this->layout()->set("stati", $stati); + $this->layout()->set("max_connections", $max_connections); $this->layout()->set("count_orders", $count_orders); $this->layout()->set("weekly_orders", $weekly_orders); @@ -95,6 +105,7 @@ class DashboardController extends mfBaseController { $this->layout()->set("status_connected", $status_connected); $this->layout()->set("partner_orders", $partner_orders); $this->layout()->set("total_orders", $total_orders); + $this->layout()->set("partner_orders_by_status", $partner_orders_by_status); $this->layout()->set("campaigns", $campaigns); $this->layout()->set("campaign_id", $r->campaign_id); @@ -118,19 +129,24 @@ class DashboardController extends mfBaseController { $orders = []; $totals = 0; - - foreach(AddressModel::search(["addresstype" => ["salespartner"]]) as $partner) { - $count = PreorderModel::count(["partner_id" => $partner->id, "preordercampaign_id" => $preordercampaign_id, "deleted" => 0]); - if($count) { - if(!array_key_exists($partner->getCompanyOrName(), $orders)) { - $orders[$partner->getCompanyOrName()] = $count; + $sql = "SELECT COUNT(Preorder.id) as cnt, IF(Address.company IS NOT NULL AND Address.company <> '', Address.company, CONCAT(Address.firstname, ' ', Address.lastname)) as partner FROM Preorder + LEFT JOIN Address ON (Preorder.partner_id = Address.id) + LEFT JOIN Addresstype ON (Addresstype.address_id = Address.id AND Addresstype.type='salespartner') + WHERE Preorder.deleted = 0 AND Preorder.preordercampaign_id IN (".implode(",", $preordercampaign_id).") + GROUP BY Address.id + "; + $this->log->debug($sql); + $res = $this->db()->query($sql); + if($this->db()->num_rows($res)) { + while($data = $this->db()->fetch_object($res)) { + if($data->partner) { + $orders[$data->partner] = $data->cnt; } else { - $orders[$partner->getCompanyOrName()] += $count; + $orders["Kein Partner"] = $data->cnt; } - $totals += $count; + $totals += $data->cnt; } } - arsort($orders); $orders["total"] = $totals; return $orders; @@ -161,6 +177,26 @@ class DashboardController extends mfBaseController { //var_dump($orders);exit; } + private function getPartnerOrdersByStatus($preordercampaign_id = []) { + $orders = []; + + foreach(PreorderModel::search(["preordercampaign_id" => $preordercampaign_id, "deleted" => 0]) as $preorder) { + $name = $preorder->partner->getCompanyOrName(); + if(!$name) $name = "Kein Partner"; + if(!array_key_exists($name, $orders)) { + $orders[$name] = []; + $orders[$name]["total"] = 0; + } + if(!array_key_exists($preorder->status->id, $orders[$name])) { + $orders[$name][$preorder->status->id] = 0; + } + $orders[$name][$preorder->status->id]++; + $orders[$name]["total"]++; + } + //var_dump($orders);exit; + return $orders; + } + protected function pdfAction() { $order = new Order(7); $owner = new Address(1); From 086706d6c7ba6bf972a183373e701f14acc56b02 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 16 Jan 2024 16:46:16 +0100 Subject: [PATCH 02/19] BMD export update / address Skonto --- Layout/default/Address/Form.php | 20 +++- Layout/default/Address/bmd_export.csv.php | 5 +- application/Address/AddressController.php | 108 ++++++++++++------ application/Address/AddressModel.php | 3 + .../20240116132506_address_add_skonto.php | 35 ++++++ lang/de.php | 58 ++++++++++ lib/mvcfronk/mfLayout/mfLayout.php | 5 +- 7 files changed, 193 insertions(+), 41 deletions(-) create mode 100644 db/migrations/20240116132506_address_add_skonto.php diff --git a/Layout/default/Address/Form.php b/Layout/default/Address/Form.php index 329805844..4512bf3bb 100644 --- a/Layout/default/Address/Form.php +++ b/Layout/default/Address/Form.php @@ -1,4 +1,3 @@ -parent->types);exit;?>
- +
- +
Standard: Tage
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ diff --git a/Layout/default/Address/bmd_export.csv.php b/Layout/default/Address/bmd_export.csv.php index 10b093993..1ca733dfc 100644 --- a/Layout/default/Address/bmd_export.csv.php +++ b/Layout/default/Address/bmd_export.csv.php @@ -1,9 +1,10 @@ -Lieferant;Kunde;address_id;FIBU-Verrechnungsnummer;FIBU Lieferantennummer;Zahlungsziel Lieferant;Firma;Vorname;Nachname;Straße Hausnummer;PLZ;Ort;Land;Telefon;Mobil;Mail;UID;Verrechnungsart;Rechnungsversand;Kreditinstitut;Kontoinhaber;IBAN;BIC setReturnValue(["header" => $header]); foreach($addresses as $a): ?> -;;;;;;nl2ws($a["company"])?>;nl2ws($a["firstname"])?>;nl2ws($a["lastname"])?>;nl2ws($a["street"])?>;nl2ws($a["$address->zip"])?>;nl2ws($a["city"])?>;nl2ws($a["country"])?>;nl2ws($a["phone"])?>;nl2ws($a["mobile"])?>;nl2ws($a["email"])?>;nl2ws($a["uid"])?>;;;;;; +;;;;nl2ws($a["firstname"])?>;nl2ws($a["lastname"])?>;nl2ws($a["street"])?>;nl2ws($a["zip"])?>;nl2ws($a["city"])?>;nl2ws($a["countrycode"])?>;nl2ws($a["phone"])?>;nl2ws($a["email"])?>;nl2ws($a["uid"])?>;;;;; value(); } - $type = "inc"; + if(!file_exists(TT_ADDRESS_BMD_EXPORT_PATH)) { + $this->layout()->setFlash("Export Pfad (".TT_ADDRESS_BMD_EXPORT_PATH.") nicht gefunden!", "error"); + } + $filepath = TT_ADDRESS_BMD_EXPORT_PATH."/".TT_ADDRESS_BMD_EXPORT_FILENAME; + $type = "inc"; if($this->request->type == "full") { $last_export = 0; $type = "full"; } - if(!file_exists(TT_ADDRESS_BMD_EXPORT_PATH)) { - $this->layout()->setFlash("Export Pfad (".TT_ADDRESS_BMD_EXPORT_PATH.") nicht gefunden!", "error"); + // delete export file if export if full + if($last_export == 0 && file_exists($filepath)) { + unlink($filepath); } - + $export_ts->value(date('U')); $search = ["edit>" => $last_export, "customer_or_fibu_numbers" => true]; @@ -215,7 +220,11 @@ class AddressController extends mfBaseController { $addresses = []; foreach(AddressModel::search($search) as $address) { - + // if supplier -> add it as extra line + if($address->fibu_supplier_number) { + $addresses[$address->fibu_supplier_number] = $address; + if(!$address->fibu_account_number) continue; + } // if is primary -> use it if($address->fibu_account_number && $address->fibu_primary_account) { @@ -271,48 +280,68 @@ class AddressController extends mfBaseController { continue; } - // if supplier -> use it - if($address->fibu_supplier_number) { - $addresses[$address->fibu_supplier_number] = $address; - continue; - } - + + } $export_addresses = []; - foreach($addresses as $address) { + foreach($addresses as $fibu_num => $address) { $a = []; $a["id"] = $address->id; - $a["is_supplier"] = (array_key_exists("supplier", $address->types) && $address->types['supplier']) ? "1" : "0"; - $a["is_customer"] = "1"; - $a["customer_number"] = $address->customer_number; - $a["fibu_account_number"] = $address->fibu_account_number; - $a["fibu_supplier_number"] = $address->fibu_supplier_number; + //$a["is_supplier"] = (array_key_exists("supplier", $address->types) && $address->types['supplier']) ? "1" : "0"; + //$a["is_customer"] = "1"; + //$a["customer_number"] = $address->customer_number; + $a["fibu_account_number"] = $fibu_num; + //$a["fibu_supplier_number"] = $address->fibu_supplier_number; $a["fibu_supplier_due"] = (is_numeric($address->fibu_supplier_due)) ? $address->fibu_supplier_due : TT_ADDRESS_DEFAULT_SUPPLIER_DUE; - $a["company"] = $address->company; - $a["firstname"] = $address->firstname; - $a["lastname"] = $address->lastname; + $a["fibu_supplier_skonto"] = $address->fibu_supplier_skonto; + $a["fibu_supplier_skonto_rate"] = $address->fibu_supplier_skonto_rate; $a["street"] = $address->street; $a["zip"] = $address->zip; $a["city"] = $address->city; - $a["country"] = $address->country; - $a["phone"] = $address->phone; - $a["mobile"] = $address->mobile; - $a["email"] = $address->email; + $a["countrycode"] = ($address->country) ? __($address->country, "cc") : "AT"; + $a["phone"] = ""; + if($address->mobile) $a["phone"] = $address->mobile; + if($address->phone) $a["phone"] = $address->phone; $a["uid"] = $address->uid; - $a["billing_type"] = $address->billing_type; - $a["billing_delivery"] = $address->billing_delivery; - if(array_key_exists("billing", $address->links) && $address->links["billing"]) { - $a["bank"] = $address->links["billing"]->bank_account_bank; - $a["bank_owner"] = $address->links["billing"]->bank_account_owner; - $a["iban"] = $address->links["billing"]->bank_account_iban; - $a["bic"] = $address->links["billing"]->bank_account_bic; + $a["billing_type"] = ($address->billing_type == "sepa") ? "1" : "0"; + //$a["billing_delivery"] = $address->billing_delivery; + + if($address->company) { + $a["firstname"] = ""; + $a["lastname"] = $address->company; + } else { + $a["firstname"] = $address->firstname; + $a["lastname"] = $address->lastname; + } + + if(array_key_exists("billing", $address->links) && $address->links["billing"][0] && $address->links["billing"][0]->address_id) { + //var_dump($address->links);exit; + $bill = $address->links["billing"][0]->address; + $a["bank"] = $bill->bank_account_bank; + $a["bank_owner"] = $bill->bank_account_owner; + $a["iban"] = $bill->bank_account_iban; + $a["bic"] = $bill->bank_account_bic; + $a["email"] = $bill->email; } else { $a["bank"] = $address->bank_account_bank; $a["bank_owner"] = $address->bank_account_owner; $a["iban"] = $address->bank_account_iban; $a["bic"] = $address->bank_account_bic; + $a["email"] = $address->email; + } + + $a["customer_numbers"] = []; + $a["customer_numbers"][] = $address->customer_number; + + // add all customer numbers to customer_numbers + if($address->fibu_account_number) { + foreach(AddressModel::search(["fibu_account_number" => $address->fibu_account_number]) as $secondary) { + if($secondary->customer_number && !in_array($secondary->customer_number, $a["customer_numbers"])) { + $a["customer_numbers"][] = $secondary->customer_number; + } + } } $export_addresses[] = $a; @@ -325,13 +354,20 @@ class AddressController extends mfBaseController { $tpl->setTemplate("Address/bmd_export.csv"); $tpl->set("addresses", $export_addresses); $csv_content = $tpl->render(); + $return_values = $tpl->getReturnedValue(); + $csv_header = $return_values['header']; - $filename = "thetool_address_export_".$type."_".date("Y-m-d-H-i-s").".csv"; - // save to TT_ADDRESS_BMD_EXPORT_PATH - $filepath = TT_ADDRESS_BMD_EXPORT_PATH."/".$filename; - if(!file_put_contents($filepath, $csv_content)) { + if(file_exists($filepath)) { + // if file exists, append new content + $result = file_put_contents($filepath, $csv_content, FILE_APPEND); + } else { + // else, add content with csv header + $result = file_put_contents($filepath, $csv_header.$csv_content); + } + + if($result === false) { $this->layout()->setFlash("Datei $filepath konnte nicht gespeichert werden!", "error"); } else { $export_ts->save(); @@ -385,6 +421,8 @@ class AddressController extends mfBaseController { $data['fibu_primary_account'] = 0; } $data['fibu_supplier_due'] = ($r->fibu_supplier_due) ? $r->fibu_supplier_due : null; + $data['fibu_supplier_skonto'] = ($r->fibu_supplier_skonto) ? $r->fibu_supplier_skonto : null; + $data['fibu_supplier_skonto_rate'] = ($r->fibu_supplier_skonto_rate) ? $r->fibu_supplier_skonto_rate : null; } diff --git a/application/Address/AddressModel.php b/application/Address/AddressModel.php index 62f80f9c0..76ab3dee8 100644 --- a/application/Address/AddressModel.php +++ b/application/Address/AddressModel.php @@ -5,6 +5,9 @@ class AddressModel { public $customer_number; public $fibu_account_number; public $fibu_supplier_number; + public $fibu_supplier_due; + public $fibu_supplier_skonto; + public $fibu_supplier_skonto_rate; public $fibu_primary_account; public $spin; public $company; diff --git a/db/migrations/20240116132506_address_add_skonto.php b/db/migrations/20240116132506_address_add_skonto.php new file mode 100644 index 000000000..86cfca51f --- /dev/null +++ b/db/migrations/20240116132506_address_add_skonto.php @@ -0,0 +1,35 @@ +getEnvironment() == "thetool") { + $table = $this->table("Address"); + $table->addColumn("fibu_supplier_skonto", "integer", ["null" => true, "default" => null, "after" => "fibu_supplier_due"]); + $table->addColumn("fibu_supplier_skonto_rate", "integer", ["null" => true, "default" => null, "after" => "fibu_supplier_skonto"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $table = $this->table("Address"); + $table->removeColumn("fibu_supplier_skonto_rate"); + $table->removeColumn("fibu_supplier_skonto"); + $table->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/lang/de.php b/lang/de.php index 6e2612066..feef57f38 100644 --- a/lang/de.php +++ b/lang/de.php @@ -56,4 +56,62 @@ $l['contract.downgrade'] = "Downgrade"; $l['contract.relocation'] = "Umzug"; $l['contract.productchange'] = "Produktwechsel"; + +$l['cc.österreich'] = "AT"; +$l['cc.osterreich'] = "AT"; +$l['cc.oesterreich'] = "AT"; +$l['cc.austria'] = "AT"; +$l["cc.bulgarien"] = "BG"; +$l["cc.bulgaria"] = "BG"; +$l["cc.schweiz"] = "CH"; +$l["cc.switzerland"] = "CH"; +$l["cc.zypern"] = "CY"; +$l["cc.cyprus"] = "CY"; +$l["cc.tschechien"] = "CZ"; +$l["cc.czechia"] = "CZ"; +$l["cc.tschechische republik"] = "CZ"; +$l["cc.czech republic"] = "CZ"; +$l["cc.Česká republika"] = "CZ"; +$l["cc.deutschland"] = "DE"; +$l["cc.germany"] = "DE"; +$l["cc.großbritannien"] = "GB"; +$l["cc.grossbritannien"] = "GB"; +$l["cc.britain"] = "GB"; +$l["cc.great britain"] = "GB"; +$l["cc.uk"] = "GB"; +$l["cc.united kingdom"] = "GB"; +$l["cc.United Kingdom of Great Britain and Northern Ireland"] = "GB"; +$l["cc.Vereinigtes Königreich"] = "GB"; +$l["cc.Vereinigtes Königreich Großbritannien und Nordirland"] = "GB"; +$l["cc.ungarn"] = "HU"; +$l["cc.hungary"] = "HU"; +$l["cc.irland"] = "IE"; +$l["cc.ireland"] = "IE"; +$l["cc.republic of ireland"] = "IE"; +$l["cc.italien"] = "IT"; +$l["cc.italia"] = "IT"; +$l["cc.japan"] = "JP"; +$l["cc.jpn"] = "JP"; +$l["cc.nippon"] = "JP"; +$l["cc.nihon"] = "JP"; +$l["cc.日本"] = "JP"; +$l["cc.日本国"] = "JP"; +$l["cc.niederlande"] = "NL"; +$l["cc.netherlands"] = "NL"; +$l["cc.nederland"] = "NL"; +$l["cc.holland"] = "NL"; +$l["cc.polen"] = "PL"; +$l["cc.poland"] = "PL"; +$l["cc.polska"] = "PL"; +$l["cc.rumänien"] = "RO"; +$l["cc.rumaenien"] = "RO"; +$l["cc.romania"] = "RO"; +$l["cc.slowenien"] = "SL"; +$l["cc.slovenia"] = "SL"; +$l["cc.slowakei"] = "SK"; +$l["cc.slovakia"] = "SK"; +$l["cc.slowakische republik"] = "SK"; +$l["cc.Slovak Republic"] = "SK"; + + $lang['de'] = $l; \ No newline at end of file diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index eeb3ceec5..31416a252 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -279,9 +279,12 @@ if(!isset($lang)) { $lang = []; } -function __($string, $prefix = null) { +function __($_string, $prefix = null) { global $lang; + $string = str_replace(["Ä","Ö","Ü"],["ä","ö","ü"] , strtolower($_string)); + + if(!$lang) { //mfLoghandler::singleton()->debug("Loading language file for __() function"); include(BASEDIR . "/lang/de.php"); From e806dd6d119b5e032062f04fae1b27c0c832a558 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 16 Jan 2024 19:22:33 +0100 Subject: [PATCH 03/19] BMD Export update --- application/Address/AddressController.php | 37 ++++++++++++++++++++++- lang/de.php | 37 +++++++++++++++++++---- lib/mvcfronk/mfLayout/mfLayout.php | 13 ++++++-- 3 files changed, 78 insertions(+), 9 deletions(-) diff --git a/application/Address/AddressController.php b/application/Address/AddressController.php index 05df3e272..c601d725e 100644 --- a/application/Address/AddressController.php +++ b/application/Address/AddressController.php @@ -284,6 +284,7 @@ class AddressController extends mfBaseController { } + $country_code_errors = []; $export_addresses = []; foreach($addresses as $fibu_num => $address) { @@ -300,7 +301,28 @@ class AddressController extends mfBaseController { $a["street"] = $address->street; $a["zip"] = $address->zip; $a["city"] = $address->city; - $a["countrycode"] = ($address->country) ? __($address->country, "cc") : "AT"; + if(strlen($address->country) == 2) { + $a["countrycode"] = trim($address->country); + } else { + $a["countrycode"] = "AT"; + + if(trim($address->country)) { + $acountry = strtolower(trim($address->country)); + $cc = __($acountry, "cc"); + + $this->log->debug("is $cc == cc.$acountry"); + $this->log->debug("last translation failed: ".(__last_translation_failed() ? "true" : "false")); + + if(__last_translation_failed()) { + //if($cc == "cc.".$acountry) { + $a["countrycode"] = "AT"; + // email to buchhaltung + $country_code_errors[$fibu_num] = $address; + } else { + $a["countrycode"] = $cc; + } + } + } $a["phone"] = ""; if($address->mobile) $a["phone"] = $address->mobile; if($address->phone) $a["phone"] = $address->phone; @@ -347,6 +369,19 @@ class AddressController extends mfBaseController { $export_addresses[] = $a; } + if(count($country_code_errors)) { + $msg = "Hallo,\r\n\r\ndas in thetool eingetragene Land von folgenden Kunden/Lieferanten konnte nicht in einen ISO-Code übersetzt werden:\r\n\r\n"; + foreach($country_code_errors as $fibu_num => $address) { + $msg .= "$fibu_num (".$address->getCompanyOrName()."): ".$address->country."\r\n"; + } + + $email = new Emailnotification(); + $email->setFrom(TT_OUTGOING_EMAIL, "thetool"); + $email->setTo(TT_FIBU_EMAIL_TO); + $email->setSubject("[BMD-Export] Fehlerhaftes Land"); + $email->setBody($msg); + $email->send(); + } diff --git a/lang/de.php b/lang/de.php index feef57f38..9c5e67579 100644 --- a/lang/de.php +++ b/lang/de.php @@ -32,7 +32,7 @@ $l['connected-b'] = "Rohr im Haus"; $l['created-t'] = "Erstellt"; $l['planned-t'] = "Faserplan vorhanden"; $l['assigned-t'] = "Bauauftrag zugeteilt"; -$l['passed-t'] = "Fasern im Gebäude"; +$l['passed-t'] = "Fasern im Gebaeude"; $l['connected-t'] = "Passiv erschlossen"; $l['active-t'] = "Internetprodukt aktiv"; @@ -57,10 +57,12 @@ $l['contract.relocation'] = "Umzug"; $l['contract.productchange'] = "Produktwechsel"; -$l['cc.österreich'] = "AT"; +$l['cc.oesterreich'] = "AT"; +$l['cc.oestereich'] = "AT"; $l['cc.osterreich'] = "AT"; $l['cc.oesterreich'] = "AT"; $l['cc.austria'] = "AT"; +$l['cc.at'] = "AT"; $l["cc.bulgarien"] = "BG"; $l["cc.bulgaria"] = "BG"; $l["cc.schweiz"] = "CH"; @@ -74,6 +76,11 @@ $l["cc.czech republic"] = "CZ"; $l["cc.Česká republika"] = "CZ"; $l["cc.deutschland"] = "DE"; $l["cc.germany"] = "DE"; +$l["cc.frankreich"] = "FR"; +$l["cc.france"] = "FR"; +$l["cc.francaise"] = "FR"; +$l["cc.République française"] = "FR"; +$l["cc.Republique francaise"] = "FR"; $l["cc.großbritannien"] = "GB"; $l["cc.grossbritannien"] = "GB"; $l["cc.britain"] = "GB"; @@ -81,8 +88,9 @@ $l["cc.great britain"] = "GB"; $l["cc.uk"] = "GB"; $l["cc.united kingdom"] = "GB"; $l["cc.United Kingdom of Great Britain and Northern Ireland"] = "GB"; -$l["cc.Vereinigtes Königreich"] = "GB"; -$l["cc.Vereinigtes Königreich Großbritannien und Nordirland"] = "GB"; +$l["cc.Vereinigtes Koenigreich"] = "GB"; +$l["cc.Vereinigtes Koenigreich Großbritannien und Nordirland"] = "GB"; +$l["cc.Vereinigtes Koenigreich Grossbritannien und Nordirland"] = "GB"; $l["cc.ungarn"] = "HU"; $l["cc.hungary"] = "HU"; $l["cc.irland"] = "IE"; @@ -96,6 +104,13 @@ $l["cc.nippon"] = "JP"; $l["cc.nihon"] = "JP"; $l["cc.日本"] = "JP"; $l["cc.日本国"] = "JP"; +$l["cc.luxemburg"] = "LU"; +$l["cc.großherzogtum luxemburg"] = "LU"; +$l["cc.grossherzogtum luxemburg"] = "LU"; +$l["cc.luxembourg"] = "LU"; +$l["cc.grand duchy of luxembourg"] = "LU"; +$l["cc.groussherzogtum lëtzebuerg"] = "LU"; +$l["cc.groussherzogtum letzebuerg"] = "LU"; $l["cc.niederlande"] = "NL"; $l["cc.netherlands"] = "NL"; $l["cc.nederland"] = "NL"; @@ -103,7 +118,7 @@ $l["cc.holland"] = "NL"; $l["cc.polen"] = "PL"; $l["cc.poland"] = "PL"; $l["cc.polska"] = "PL"; -$l["cc.rumänien"] = "RO"; +$l["cc.rumaenien"] = "RO"; $l["cc.rumaenien"] = "RO"; $l["cc.romania"] = "RO"; $l["cc.slowenien"] = "SL"; @@ -112,6 +127,16 @@ $l["cc.slowakei"] = "SK"; $l["cc.slovakia"] = "SK"; $l["cc.slowakische republik"] = "SK"; $l["cc.Slovak Republic"] = "SK"; - +$l["cc.Vereinigte Staaten"] = "US"; +$l["cc.Vereinigte Staaten von Amerika"] = "US"; +$l["cc.usa - vereinigte staaten"] = "US"; +$l["cc.Amerika"] = "US"; +$l["cc.US"] = "US"; +$l["cc.USA"] = "US"; +$l["cc.U.S.A."] = "US"; +$l["cc.America"] = "US"; +$l["cc.United States"] = "US"; +$l["cc.United States of America"] = "US"; +$l["cc.mm"] = "CW"; $lang['de'] = $l; \ No newline at end of file diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index 31416a252..e854a12d4 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -261,7 +261,7 @@ function mfLayoutInclude($filename, $folder = "") { global $mfLayoutPackage; if($folder) { - $folder = $fodler."/"; + $folder = $folder."/"; } $inc_path = VIEWDIR . "/" . LAYOUT_DEFAULTPACKAGE . "/" . $folder . $filename; @@ -279,10 +279,14 @@ if(!isset($lang)) { $lang = []; } +$last_translation_failed = false; + function __($_string, $prefix = null) { global $lang; + global $last_translation_failed; + $last_translation_failed = false; - $string = str_replace(["Ä","Ö","Ü"],["ä","ö","ü"] , strtolower($_string)); + $string = str_replace(["Ä","Ö","Ü","ß","ä","ö","ü","ss"], ["ae","oe","ue"], strtolower($_string)); if(!$lang) { @@ -297,6 +301,11 @@ function __($_string, $prefix = null) { if (array_key_exists($string, $lang['de'])) { return $lang['de'][$string]; } + $last_translation_failed = true; return $string; } +function __last_translation_failed() { + global $last_translation_failed; + return $last_translation_failed; +} \ No newline at end of file From c5ee7faae197f6e4b01f99cb7ea84b6fe5d39340 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 17 Jan 2024 17:57:17 +0100 Subject: [PATCH 04/19] Added trims to BMD Export --- application/Address/AddressController.php | 44 +++++++++++------------ lib/mvcfronk/mfRequest/mfRequest.php | 28 +++++++++++++-- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/application/Address/AddressController.php b/application/Address/AddressController.php index c601d725e..0ab460003 100644 --- a/application/Address/AddressController.php +++ b/application/Address/AddressController.php @@ -433,31 +433,31 @@ class AddressController extends mfBaseController { $data = []; $data['parent_id'] = (!$r->parent_id) ? null : $r->parent_id; - $data['company'] = $r->company; - $data['firstname'] = $r->firstname; - $data['lastname'] = $r->lastname; - $data['street'] = $r->street; - $data['zip'] = $r->zip; - $data['city'] = $r->city; - $data['country'] = $r->country; - $data['phone'] = $r->phone; - $data['fax'] = $r->fax; - $data['mobile'] = $r->mobile; - $data['email'] = $r->email; - $data['note'] = $r->note; - $data['uid'] = $r->uid; + $data['company'] = trim($r->company); + $data['firstname'] = trim($r->firstname); + $data['lastname'] = trim($r->lastname); + $data['street'] = trim($r->street); + $data['zip'] = trim($r->zip); + $data['city'] = trim($r->city); + $data['country'] = trim($r->country); + $data['phone'] = trim($r->phone); + $data['fax'] = trim($r->fax); + $data['mobile'] = trim($r->mobile); + $data['email'] = trim($r->email); + $data['note'] = trim($r->note); + $data['uid'] = trim($r->uid); if($this->me->can("Fibu")) { - $data['fibu_account_number'] = ($r->fibu_account_number) ? $r->fibu_account_number : null; - $data['fibu_supplier_number'] = ($r->fibu_supplier_number) ? $r->fibu_supplier_number : null; + $data['fibu_account_number'] = ($r->fibu_account_number) ? trim($r->fibu_account_number) : null; + $data['fibu_supplier_number'] = ($r->fibu_supplier_number) ? trim($r->fibu_supplier_number) : null; if($r->fibu_primary_account) { $data['fibu_primary_account'] = 1; } else { $data['fibu_primary_account'] = 0; } - $data['fibu_supplier_due'] = ($r->fibu_supplier_due) ? $r->fibu_supplier_due : null; - $data['fibu_supplier_skonto'] = ($r->fibu_supplier_skonto) ? $r->fibu_supplier_skonto : null; - $data['fibu_supplier_skonto_rate'] = ($r->fibu_supplier_skonto_rate) ? $r->fibu_supplier_skonto_rate : null; + $data['fibu_supplier_due'] = ($r->fibu_supplier_due) ? trim($r->fibu_supplier_due) : null; + $data['fibu_supplier_skonto'] = ($r->fibu_supplier_skonto) ? trim($r->fibu_supplier_skonto) : null; + $data['fibu_supplier_skonto_rate'] = ($r->fibu_supplier_skonto_rate) ? trim($r->fibu_supplier_skonto_rate) : null; } @@ -492,10 +492,10 @@ class AddressController extends mfBaseController { } - $data['bank_account_bank'] = $r->bank_account_bank; - $data['bank_account_owner'] = $r->bank_account_owner; - $data['bank_account_iban'] = $r->bank_account_iban; - $data['bank_account_bic'] = $r->bank_account_bic; + $data['bank_account_bank'] = trim($r->bank_account_bank); + $data['bank_account_owner'] = trim($r->bank_account_owner); + $data['bank_account_iban'] = trim($r->bank_account_iban); + $data['bank_account_bic'] = trim($r->bank_account_bic); $data['allow_contact'] = ($r->allow_contact) ? 1 : 0; $data['allow_spin'] = ($r->allow_spin) ? 1 : 0; diff --git a/lib/mvcfronk/mfRequest/mfRequest.php b/lib/mvcfronk/mfRequest/mfRequest.php index faef3c2ae..1619b5283 100644 --- a/lib/mvcfronk/mfRequest/mfRequest.php +++ b/lib/mvcfronk/mfRequest/mfRequest.php @@ -2,6 +2,7 @@ class mfRequest { protected static $instance; + protected $original_request = []; protected $request = []; public function __construct(Array $request = []) { @@ -9,8 +10,19 @@ class mfRequest { $this->request = $request; } else { // get request from POST/GET - if(isset($_POST) && isset($_GET)) { - $this->request = array_merge($_GET, $_POST); + $_request = []; + if(isset($_GET)) { + $_request = array_merge($_request, $_GET); + } + if(isset($_POST)) { + $_request = array_merge($_request, $_POST); + } + if(!count($_request)) { + return true; + } + foreach($_request as $key => $name) { + $this->original_request[$key] = $name; + $this->request[$key] = trim($name); } } } @@ -41,6 +53,18 @@ class mfRequest { return $this->request; } + public function getUnmodified($name = null) { + if($name) { + if(array_key_exists($name, $this->original_request)) { + //var_dump($this->request);exit; + return $this->original_request[$name]; + } else { + return null; + } + } + return $this->request; + } + public function __get($name) { return $this->get($name); } From d6477a94521b0d87baa05064f17dced2158fd5ee Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 17 Jan 2024 18:00:53 +0100 Subject: [PATCH 05/19] Added source to SyncToFibumerge --- application/Address/Address.php | 1 + application/XinonFibuMerge/XinonFibuMergeModel.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/application/Address/Address.php b/application/Address/Address.php index e77129074..69c141bbb 100644 --- a/application/Address/Address.php +++ b/application/Address/Address.php @@ -73,6 +73,7 @@ class Address extends mfBaseModel { if(!$fibumerge) { // create fibu merge $fibumerge = XinonFibuMergeModel::create([ + "source" => "t", "old_custnum" => $this->customer_number, "new_custnum" => $this->fibu_account_number, "name" => ($this->company) ? $this->company : $this->lastname, diff --git a/application/XinonFibuMerge/XinonFibuMergeModel.php b/application/XinonFibuMerge/XinonFibuMergeModel.php index 2e46a3983..ecfcfb8f6 100644 --- a/application/XinonFibuMerge/XinonFibuMergeModel.php +++ b/application/XinonFibuMerge/XinonFibuMergeModel.php @@ -1,7 +1,7 @@ Date: Thu, 18 Jan 2024 15:13:09 +0100 Subject: [PATCH 06/19] Fixed umlauts in translation function --- lib/mvcfronk/mfLayout/mfLayout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index e854a12d4..9881ed950 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -286,7 +286,7 @@ function __($_string, $prefix = null) { global $last_translation_failed; $last_translation_failed = false; - $string = str_replace(["Ä","Ö","Ü","ß","ä","ö","ü","ss"], ["ae","oe","ue"], strtolower($_string)); + $string = str_replace(["Ä","Ö","Ü","ß","ä","ö","ü","ß"], ["ae","oe","ue","ss","ae","oe","ue", "ss"], strtolower($_string)); if(!$lang) { From d2297ab0a9272ebc7925821751b8f6ad92d3d382 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 20:10:22 +0100 Subject: [PATCH 07/19] Address::syncToFibuMerge() knows about > 900000 customer numbers now --- Layout/default/Address/View.php | 12 +++++++++--- application/Address/Address.php | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Layout/default/Address/View.php b/Layout/default/Address/View.php index f62321c14..409d928da 100644 --- a/Layout/default/Address/View.php +++ b/Layout/default/Address/View.php @@ -123,14 +123,20 @@ Ist primäres Verrechnungskonto fibu_primary_account) ? "" : ""?> - FIBU Verrechnungskonto + Verrechnungskonto fibu_account_number?> - FIBU Lieferanten Konto + Lieferantenkonto fibu_supplier_number?> - FIBU Lieferanten Zahlungsziel + Zahlungsziel Lieferant fibu_supplier_due?> + + Lieferant Skontotage + fibu_supplier_skonto?> + + Lieferant Skonto % + fibu_supplier_skonto_rate?>

Zusatzdaten

diff --git a/application/Address/Address.php b/application/Address/Address.php index 69c141bbb..076608425 100644 --- a/application/Address/Address.php +++ b/application/Address/Address.php @@ -69,12 +69,17 @@ class Address extends mfBaseModel { $me->loadMe(); if($this->fibu_account_number) { - $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $this->customer_number]); + $old_custnum = $this->customer_number; + if($old_custnum > 900000) { + $old_custnum -= 900000; + } + + $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum]); if(!$fibumerge) { // create fibu merge $fibumerge = XinonFibuMergeModel::create([ "source" => "t", - "old_custnum" => $this->customer_number, + "old_custnum" => $old_custnum, "new_custnum" => $this->fibu_account_number, "name" => ($this->company) ? $this->company : $this->lastname, "vorname" => ($this->company) ? "" : $this->firstname, @@ -87,7 +92,7 @@ class Address extends mfBaseModel { $fibumerge->save(); return true; } - + if($fibumerge->new_custnum != $this->fibu_account_number) { $fibumerge->new_custnum = $this->fibu_account_number; $fibumerge->save(); From e19442cd43dee92ec36027b4a598dcbc5b8c23f3 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 21:10:45 +0100 Subject: [PATCH 08/19] Address::syncToFibuMerge() checks for old_custnum and name before updateing --- application/Address/Address.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/Address/Address.php b/application/Address/Address.php index 076608425..a9c9d529c 100644 --- a/application/Address/Address.php +++ b/application/Address/Address.php @@ -74,7 +74,11 @@ class Address extends mfBaseModel { $old_custnum -= 900000; } - $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum]); + $name_search = []; + if($this->company) $name_search[] = $this->company; + if($this->lastname) $name_search[] = $this->lastname; + + $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum, "name" => $name_search]); if(!$fibumerge) { // create fibu merge $fibumerge = XinonFibuMergeModel::create([ From fc3c3de604102832528609038a639a8f1593fb6a Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 22:02:43 +0100 Subject: [PATCH 09/19] Added ADBWohneinheit edit, productgroup matchcodeorigin --- Layout/default/ADBWohneinheit/Form.php | 173 ++++++++++++++++++ Layout/default/AddressDB/Form.php | 11 ++ Layout/default/AddressDB/View.php | 5 + .../Preorder/include/preorder-detail.php | 3 + Layout/default/Productgroup/Form.php | 16 +- .../ADBWohneinheitController.php | 100 ++++++++++ .../ADBWohneinheit/ADBWohneinheitModel.php | 4 + application/AddressDB/AddressDB.php | 1 + application/AddressDB/AddressDBController.php | 2 +- .../Productgroup/ProductgroupController.php | 18 ++ .../Productgroup/ProductgroupModel.php | 5 +- .../XinonFibuMerge/XinonFibuMergeModel.php | 11 +- ...93741_productgroup_add_matchcodeorigin.php | 31 ++++ lang/de.php | 23 +-- lib/mvcfronk/mfLayout/mfLayout.php | 1 - 15 files changed, 384 insertions(+), 20 deletions(-) create mode 100644 db/migrations/20240118193741_productgroup_add_matchcodeorigin.php diff --git a/Layout/default/ADBWohneinheit/Form.php b/Layout/default/ADBWohneinheit/Form.php index b3d9bbc7f..b7a5b3a65 100644 --- a/Layout/default/ADBWohneinheit/Form.php +++ b/Layout/default/ADBWohneinheit/Form.php @@ -1 +1,174 @@ id && !array_key_exists($unit->hausnummer->netzgebiet_id, $my_adb_networks)) { + $this->setFlash("Keine Berechtigung", "error"); + mfBaseController::redirect("AddressDB"); + } + +?> + + +
+
+
+ +

Wohneinheit

+
+
+
+ + +
+
+ +
+
+

id) ? "Wohneinheit bearbeiten" : "Neue Adresse"?>

+ +
"> + +
+
+ +
+ +
+ hausnummer->rimo_id : ""?>" disabled="disabled" /> +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +

FTU

FTU Name:ftu_data["name"]?> +
FTU External IDftu_data["id"]?> +

Workorder

Namerimo_workorder->rimo_name?>
External IDrimo_workorder->rimo_id?>
Statusrimo_workorder->rimo_status?>
Erstelltrimo_workorder)) ? date("d.m.Y H:i:s", $unit->rimo_workorder->create) : ""?>
+
+
+
+
+
+ + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/Layout/default/AddressDB/Form.php b/Layout/default/AddressDB/Form.php index bbc33e8f1..8ef16663f 100644 --- a/Layout/default/AddressDB/Form.php +++ b/Layout/default/AddressDB/Form.php @@ -90,6 +90,17 @@
+
+ +
+ + + + + +
+
+
diff --git a/Layout/default/AddressDB/View.php b/Layout/default/AddressDB/View.php index 3e147a561..669cd8829 100644 --- a/Layout/default/AddressDB/View.php +++ b/Layout/default/AddressDB/View.php @@ -47,6 +47,9 @@ Extref extref?> + + Rimo External ID + rimo_id?> Netzgebiet netzgebiet->name?> @@ -113,6 +116,7 @@ wohneinheiten) && count($address->wohneinheiten)): ?> + @@ -121,6 +125,7 @@ wohneinheiten as $unit): ?> + diff --git a/Layout/default/Preorder/include/preorder-detail.php b/Layout/default/Preorder/include/preorder-detail.php index f0254f5a7..dfb5b3a66 100644 --- a/Layout/default/Preorder/include/preorder-detail.php +++ b/Layout/default/Preorder/include/preorder-detail.php @@ -312,6 +312,9 @@ + + - - - + + @@ -371,7 +373,7 @@ $chartColors = [ labels: [ $count): ?> - code?> - name?> " (%)", + " - (%)", ], diff --git a/Layout/default/User/Form.php b/Layout/default/User/Form.php index 291b3e205..05877814e 100644 --- a/Layout/default/User/Form.php +++ b/Layout/default/User/Form.php @@ -50,7 +50,7 @@ @@ -219,6 +219,13 @@ + +
+
+ can("Statistics")) ? "checked='checked'" : ""?> /> + +
+

@@ -248,9 +255,9 @@ "> apikey): ?> - + - + diff --git a/application/Dashboard/DashboardController.php b/application/Dashboard/DashboardController.php index 5f4ff600a..e05ace346 100644 --- a/application/Dashboard/DashboardController.php +++ b/application/Dashboard/DashboardController.php @@ -23,8 +23,7 @@ class DashboardController extends mfBaseController { $newss = NewsModel::getAll(); $this->layout()->set("newss", $newss); - //if($this->me->is(["Admin", "netowner", "salespartner"]) || $this->me->can("Preorder")) { - if($this->me->is("Admin")) { + if($this->me->can("Statistics") && $this->me->is(["Admin", "netowner", "salespartner"])) { return $this->dashboardAction(); } @@ -118,7 +117,7 @@ class DashboardController extends mfBaseController { foreach($preordercampaign_id as $campaign_id) { $campaign = new Preordercampaign($campaign_id); if($campaign->id) { - $total_homes += $campaign->total_homes; + $total_homes += ($campaign->homes_total) ? $campaign->homes_total : $campaign->total_homes; } } diff --git a/application/User/UserController.php b/application/User/UserController.php index e8a51163b..eeba4c1b9 100644 --- a/application/User/UserController.php +++ b/application/User/UserController.php @@ -51,7 +51,9 @@ class UserController extends mfBaseController } $this->layout()->setTemplate('User/Form'); - $addresses = AddressModel::getAll(); + $roles = TT_NETWORK_ROLES_WITH_OWNER; + $roles[] = "systemowner"; + $addresses = AddressModel::search(["addresstype" => $roles]); $this->layout()->set("addresses", $addresses); if ($this->request->address_id) { @@ -225,6 +227,7 @@ class UserController extends mfBaseController $user->permissions->canPreorder = "false"; $user->permissions->canOrder = "false"; $user->permissions->canFibu = "false"; + $user->permissions->canStatistics = "false"; if($r->get("can") && is_array($r->can)) { foreach($r->can as $key => $can) { diff --git a/db/migrations/20240119124212_add_can_statistics_permission.php b/db/migrations/20240119124212_add_can_statistics_permission.php new file mode 100644 index 000000000..fe7593c84 --- /dev/null +++ b/db/migrations/20240119124212_add_can_statistics_permission.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + $table = $this->table("WorkerPermission"); + $table->addColumn("canStatistics", "enum", ["values" => 'false,true', "default" => "false", "after" => "canOrder"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $this->table("WorkerPermission")->removeColumn("canStatistics")->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} From 3ab04b7a20ea931149cd4e0c8dfff7d6f815b089 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 22 Jan 2024 10:26:48 +0100 Subject: [PATCH 12/19] Preorder statistics update --- Layout/default/AddressDB/Index.php | 2 +- Layout/default/Dashboard/Dashboard.php | 41 ++++++++++--- application/Dashboard/DashboardController.php | 57 ++++++++++--------- application/Preorder/Preorder.php | 6 +- 4 files changed, 67 insertions(+), 39 deletions(-) diff --git a/Layout/default/AddressDB/Index.php b/Layout/default/AddressDB/Index.php index 04d6b936c..58c7f04a6 100644 --- a/Layout/default/AddressDB/Index.php +++ b/Layout/default/AddressDB/Index.php @@ -144,7 +144,7 @@ diff --git a/Layout/default/Dashboard/Dashboard.php b/Layout/default/Dashboard/Dashboard.php index f347982a9..da882d900 100644 --- a/Layout/default/Dashboard/Dashboard.php +++ b/Layout/default/Dashboard/Dashboard.php @@ -69,18 +69,43 @@ $chartColors = [

Akquise Statistiken

-
+
- - +
+
+ + is("Admin")): ?> +
Netzinhaber:
+ + + + + +
+
+
+
diff --git a/application/Dashboard/DashboardController.php b/application/Dashboard/DashboardController.php index e05ace346..00e5dc4d8 100644 --- a/application/Dashboard/DashboardController.php +++ b/application/Dashboard/DashboardController.php @@ -39,50 +39,51 @@ class DashboardController extends mfBaseController { $campaign_ids = [$campaign_ids]; } - + $netowner_id = intval($r->netowner_id); + $this->layout()->set("netowner_id", $netowner_id); if($this->me->is("Admin")) { - $campaigns = PreordercampaignModel::getAll(); + if($netowner_id) { + $campaigns = PreordercampaignModel::search(["owner_id" => $netowner_id]); + } else { + $campaigns = PreordercampaignModel::getAll(); + } if(!$campaign_ids) { - foreach(PreordercampaignModel::getAll() as $campaign) { + $campaign_filter = []; + if($netowner_id) { + $campaign_filter['owner_id'] = $netowner_id; + } + foreach(PreordercampaignModel::search($campaign_filter) as $campaign) { $campaign_ids[] = $campaign->id; } } - - $max_connections = $this->getTotalHomes($campaign_ids); - $count_orders = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0]); - $weekly_orders = $this->getWeeklyOrders($campaign_ids); - - $status_connected_single = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 244]); - $status_connected_multi = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 245]); - - $status_connected = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 500]); - - $partner_orders = $this->getPartnerOrderCount($campaign_ids); - $partner_orders_by_status = $this->getPartnerOrdersByStatus($campaign_ids); } else { $campaigns = PreordercampaignModel::search(["owner_id" => $this->me->address_id]); - + $campaign_filter = ["preordercampaign_id" => $campaign_ids]; if(!$campaign_ids) { foreach(PreordercampaignModel::search(["owner_id" => $this->me->address_id]) as $campaign) { $campaign_ids[] = $campaign->id; } } - - $max_connections = $this->getTotalHomes($campaign_ids); - $count_orders = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0]); - $weekly_orders = $this->getWeeklyOrders($campaign_ids); - - $status_connected_single = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 244]); - $status_connected_multi = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 245]); - - $status_connected = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 500]); - - $partner_orders = $this->getPartnerOrderCount($campaign_ids); - $partner_orders_by_status = $this->getPartnerOrdersByStatus($campaign_ids); } + if(!$campaign_ids) { + $campaign_ids = [0]; + } + + $max_connections = $this->getTotalHomes($campaign_ids); + $count_orders = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0]); + $weekly_orders = $this->getWeeklyOrders($campaign_ids); + + $status_connected_single = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 244]); + $status_connected_multi = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 245]); + + $status_connected = PreorderModel::count(["preordercampaign_id" => $campaign_ids, "deleted" => 0, "status_code" => 500]); + + $partner_orders = $this->getPartnerOrderCount($campaign_ids); + $partner_orders_by_status = $this->getPartnerOrdersByStatus($campaign_ids); + $total_orders = $partner_orders["total"]; unset($partner_orders["total"]); diff --git a/application/Preorder/Preorder.php b/application/Preorder/Preorder.php index 8b654ad38..86afc24b3 100644 --- a/application/Preorder/Preorder.php +++ b/application/Preorder/Preorder.php @@ -2,7 +2,7 @@ class Preorder extends mfBaseModel { protected $forcestr = ['street','company','zip','phone','email','note']; - private $in_after_save = false; + private $in_after_save = 0; private $status; private $campaign; @@ -38,7 +38,7 @@ class Preorder extends mfBaseModel { // prevent potential infinite loop if($this->in_after_save) return true; - $this->in_after_save = true; + $this->in_after_save++; // update preorder OAID if it's different from the unit OAID // but only if the unit OAID is of the same origin as the campaign $old_oaid = $this->oaid; @@ -52,6 +52,8 @@ class Preorder extends mfBaseModel { $this->cascadeStatus(); // Cascade status changes down all active preorders with the same hausnummer $this->cascadeStatusToPreorders(); + + $this->in_after_save--; } /* From 5d051406fa830ffcc6d2bb4b6392ae4db0c11d33 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 22 Jan 2024 11:24:14 +0100 Subject: [PATCH 13/19] Added adb unit count to OpenAccessId Index --- Layout/default/OpenAccessId/Index.php | 10 +++++----- application/OpenAccessId/OpenAccessId.php | 6 ++++++ .../OpenAccessId/OpenAccessIdController.php | 18 +++++++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Layout/default/OpenAccessId/Index.php b/Layout/default/OpenAccessId/Index.php index 2e157176f..39f6cc328 100644 --- a/Layout/default/OpenAccessId/Index.php +++ b/Layout/default/OpenAccessId/Index.php @@ -35,8 +35,8 @@
@@ -84,7 +84,7 @@
+
+
+
+
+ +
+

Wohneinheit

+
+
+
+ + +
+
+ +
+
+

id) ? "Wohneinheit bearbeiten" : "Neue Adresse"?>

+ +
"> + +
+
+ +
+ +
+ +
+
+ +
+ +
+ adb_wohneinheit_id && is_object($oaid->adb_wohneinheit)): ?> + adb_wohneinheit : ""?>" + /> + +
+
+ +
+ +
+ + Wohneinheit ID +

+
+
+ + +
+
+ + +
+ +
+ +
+
+ + +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/Layout/default/OpenAccessId/Index.php b/Layout/default/OpenAccessId/Index.php index 39f6cc328..fd367b772 100644 --- a/Layout/default/OpenAccessId/Index.php +++ b/Layout/default/OpenAccessId/Index.php @@ -135,12 +135,15 @@
- + From f060cb50a2f2e41ef52b7e661c633f363717f622 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 23 Jan 2024 15:12:31 +0100 Subject: [PATCH 17/19] Added fibu_supplier_paymentblock to Address --- Layout/default/Address/Form.php | 11 ++++++- Layout/default/Address/Index.php | 29 +++++++++++++++-- Layout/default/Address/View.php | 3 ++ Layout/default/Address/bmd_export.csv.php | 4 +-- application/Address/AddressController.php | 21 +++++++++++-- ...address_add_fibu_supplier_paymentblock.php | 31 +++++++++++++++++++ 6 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 db/migrations/20240123132303_address_add_fibu_supplier_paymentblock.php diff --git a/Layout/default/Address/Form.php b/Layout/default/Address/Form.php index 4512bf3bb..401696a18 100644 --- a/Layout/default/Address/Form.php +++ b/Layout/default/Address/Form.php @@ -254,7 +254,9 @@ - + +
+
@@ -284,6 +286,13 @@
+
+ +
+ +
+
+ diff --git a/Layout/default/Address/Index.php b/Layout/default/Address/Index.php index 5fb7a9824..b5a06bb51 100644 --- a/Layout/default/Address/Index.php +++ b/Layout/default/Address/Index.php @@ -39,10 +39,11 @@ @@ -259,6 +260,30 @@ diff --git a/Layout/default/Address/View.php b/Layout/default/Address/View.php index 409d928da..9af125451 100644 --- a/Layout/default/Address/View.php +++ b/Layout/default/Address/View.php @@ -137,6 +137,9 @@
+ + + diff --git a/Layout/default/Address/bmd_export.csv.php b/Layout/default/Address/bmd_export.csv.php index 1ca733dfc..49f51a8d6 100644 --- a/Layout/default/Address/bmd_export.csv.php +++ b/Layout/default/Address/bmd_export.csv.php @@ -1,10 +1,10 @@ setReturnValue(["header" => $header]); foreach($addresses as $a): ?> -;;;;nl2ws($a["firstname"])?>;nl2ws($a["lastname"])?>;nl2ws($a["street"])?>;nl2ws($a["zip"])?>;nl2ws($a["city"])?>;nl2ws($a["countrycode"])?>;nl2ws($a["phone"])?>;nl2ws($a["email"])?>;nl2ws($a["uid"])?>;;;;; +;;;;;nl2ws($a["firstname"])?>;nl2ws($a["lastname"])?>;nl2ws($a["street"])?>;nl2ws($a["zip"])?>;nl2ws($a["city"])?>;nl2ws($a["countrycode"])?>;nl2ws($a["phone"])?>;nl2ws($a["email"])?>;nl2ws($a["uid"])?>;;;;;customer_number; $a["fibu_account_number"] = $fibu_num; //$a["fibu_supplier_number"] = $address->fibu_supplier_number; - $a["fibu_supplier_due"] = (is_numeric($address->fibu_supplier_due)) ? $address->fibu_supplier_due : TT_ADDRESS_DEFAULT_SUPPLIER_DUE; - $a["fibu_supplier_skonto"] = $address->fibu_supplier_skonto; - $a["fibu_supplier_skonto_rate"] = $address->fibu_supplier_skonto_rate; + if($fibu_num >= 300000 && $fibu_num < 400000) { + $a["fibu_supplier_due"] = (is_numeric($address->fibu_supplier_due)) ? $address->fibu_supplier_due : TT_ADDRESS_DEFAULT_SUPPLIER_DUE; + $a["fibu_supplier_skonto"] = $address->fibu_supplier_skonto; + $a["fibu_supplier_skonto_rate"] = $address->fibu_supplier_skonto_rate; + $a["fibu_supplier_paymentblock"] = $address->fibu_supplier_paymentblock; + } else { + $a["fibu_supplier_due"] = ""; + $a["fibu_supplier_skonto"] = ""; + $a["fibu_supplier_skonto_rate"] = ""; + $a["fibu_supplier_paymentblock"] = ""; + } $a["street"] = $address->street; $a["zip"] = $address->zip; $a["city"] = $address->city; @@ -455,6 +463,13 @@ class AddressController extends mfBaseController { } else { $data['fibu_primary_account'] = 0; } + + if($r->fibu_supplier_paymentblock) { + $data['fibu_supplier_paymentblock'] = 1; + } else { + $data['fibu_supplier_paymentblock'] = 0; + } + $data['fibu_supplier_due'] = ($r->fibu_supplier_due) ? trim($r->fibu_supplier_due) : null; $data['fibu_supplier_skonto'] = ($r->fibu_supplier_skonto) ? trim($r->fibu_supplier_skonto) : null; $data['fibu_supplier_skonto_rate'] = ($r->fibu_supplier_skonto_rate) ? trim($r->fibu_supplier_skonto_rate) : null; diff --git a/db/migrations/20240123132303_address_add_fibu_supplier_paymentblock.php b/db/migrations/20240123132303_address_add_fibu_supplier_paymentblock.php new file mode 100644 index 000000000..412b71a0b --- /dev/null +++ b/db/migrations/20240123132303_address_add_fibu_supplier_paymentblock.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + $table = $this->table("Address"); + $table->addColumn("fibu_supplier_paymentblock", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, "after" => "fibu_supplier_skonto_rate"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $this->table("Address")->removeColumn("fibu_supplier_paymentblock")->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} From 76083e5d5318cd15c98f042bd751b1c53baf9eaf Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 23 Jan 2024 17:00:20 +0100 Subject: [PATCH 18/19] Added git post hook handler --- application/Init/Init.php | 8 ++++++++ bin/post_merge_hook.php | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 bin/post_merge_hook.php diff --git a/application/Init/Init.php b/application/Init/Init.php index a4abe2daf..fe782d108 100644 --- a/application/Init/Init.php +++ b/application/Init/Init.php @@ -1,2 +1,10 @@ layout()->set("git_merge_ts", $last_merge_ts->value()); diff --git a/bin/post_merge_hook.php b/bin/post_merge_hook.php new file mode 100755 index 000000000..9a214dceb --- /dev/null +++ b/bin/post_merge_hook.php @@ -0,0 +1,41 @@ +#!/usr/bin/php +id); +define("INTERNAL_USER_USERNAME", $me->username); + +$now = date("U"); + +// update last merge timestamp +$merge_ts = new mfConfig("git.merge.ts"); +$merge_ts->type("int"); +$merge_ts->value($now); +$merge_ts->save(); + + +// update git commit ref +$git_ref = new mfConfig("git.lastref"); + +$sc = new SystemController(); +$commitid = $sc->getLastCommit(); + +if($commitid) { + $git_ref->value($commitid); + $git_ref->save(); +} From 6e7d158287f0013959bf3e7edc7b452421596835 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 23 Jan 2024 17:04:31 +0100 Subject: [PATCH 19/19] changed timestamp to git_merge_ts in header.php --- Layout/default/header.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Layout/default/header.php b/Layout/default/header.php index 9313717d4..69f06c620 100644 --- a/Layout/default/header.php +++ b/Layout/default/header.php @@ -9,17 +9,17 @@ - - + + - + - + - + @@ -38,7 +38,7 @@ - +
ID OAID Status
$unit->id])?>"> id?> oaid?> status->code?> - status->name?>
Building Name: adb_hausnummer->extref?> +
Building External ID:adb_hausnummer->rimo_id?>
Home External ID: adb_wohneinheit->extref?> diff --git a/Layout/default/Productgroup/Form.php b/Layout/default/Productgroup/Form.php index c5b55d0d3..ad3830a8f 100644 --- a/Layout/default/Productgroup/Form.php +++ b/Layout/default/Productgroup/Form.php @@ -7,7 +7,7 @@
@@ -48,6 +48,20 @@ +
+ +
+ +
+
+ diff --git a/application/ADBWohneinheit/ADBWohneinheitController.php b/application/ADBWohneinheit/ADBWohneinheitController.php index 6836891c8..e1941ce1f 100644 --- a/application/ADBWohneinheit/ADBWohneinheitController.php +++ b/application/ADBWohneinheit/ADBWohneinheitController.php @@ -2,4 +2,104 @@ class ADBWohneinheitController extends mfBaseController { + protected function init() { + $this->needlogin=true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me",$me); + + if(!$me->is(["Admin", "netowner"]) && !$me->can("Preorder")) { + $this->redirect("Dashboard"); + } + } + + protected function addAction() { + $this->layout()->setTemplate("ADBWohneinheit/Form"); + + if($this->me->is("Admin")) { + $my_networks = NetworkModel::getAll(); + } else { + $my_networks = $this->me->myNetworks(["netowner", "salespartner"]); + } + + $netzgebiet_ids = []; + $my_adb_networks = []; + foreach($my_networks as $network) { + if($network->adb_netzgebiet_id && !in_array($network->adb_netzgebiet_id, $netzgebiet_ids)) { + $netzgebiet_ids[] = $network->adb_netzgebiet_id; + $my_adb_networks[$network->adb_netzgebiet_id] = new ADBNetzgebiet($network->adb_netzgebiet_id); + } + } + $this->layout()->set("my_adb_networks", $my_adb_networks); + + } + + protected function editAction() { + $id = $this->request->id; + if(!is_numeric($id) || $id < 1) { + $this->layout()->setFlash("Adresse nicht gefunden", "error"); + $this->redirect("AddressDB"); + } + + $unit = new ADBWohneinheit($id); + if(!$unit->id) { + $this->layout()->setFlash("Wohneinheit nicht gefunden", "error"); + $this->redirect("AddressDB"); + } + + /*if(!in_array($hausnummer->netzgebiet_id, $my_adb_networks)) { + $this->layout()->setFlash("Adresse nicht gefunden", "error"); + $this->redirect("AddressDB"); + }*/ + + $this->layout()->set("unit", $unit); + + return $this->addAction(); + } + + protected function saveAction() { + $r = $this->request; + $id = $r->id; + //var_dump($r->get());exit; + + $unit_data = []; + + if(is_numeric($id) && $id > 0) { + $mode = "edit"; + $unit = new ADBWohneinheit($id); + if(!$unit->id) { + $this->layout()->setFlash("Wohneinheit nicht gefunden", "error"); + $this->redirect("AddressDB"); + } + } else { + $mode = "add"; + } + + + $unit_data["oaid"] = ($r->oaid) ? trim($r->oaid) : null; + $unit_data["extref"] = ($r->extref) ? trim($r->extref) : null; + $unit_data["block"] = ($r->block) ? trim($r->block) : null; + $unit_data["stiege"] = ($r->stiege) ? trim($r->stiege) : null; + $unit_data["stock"] = ($r->stock) ? trim($r->stock) : null; + $unit_data["tuer"] = ($r->tuer) ? trim($r->tuer) : null; + $unit_data["zusatz"] = ($r->zusatz) ? trim($r->zusatz) : null; + $unit_data["bezeichner"] = ($r->bezeichner) ? trim($r->bezeichner) : null; + + if($mode == "add") { + $unit = ADBWohneinheitModel::create($unit_data); + } else { + $unit->update($unit_data); + } + + if(!$unit->save()) { + $this->layout()->setFlash("Beim Speichern der Wohneinheit ist ein Fehler aufgetreten.", "error"); + $this->layout()->set("unit", $unit); + return $this->addAction(); + } + + $this->layout()->setFlash("Wohneinheit erfolgreich gespeichert.", "success"); + $this->redirect("AddressDB", "view", ["id" => $unit->hausnummer_id]); + } + } \ No newline at end of file diff --git a/application/ADBWohneinheit/ADBWohneinheitModel.php b/application/ADBWohneinheit/ADBWohneinheitModel.php index 17243b32c..aa3f0dfe0 100644 --- a/application/ADBWohneinheit/ADBWohneinheitModel.php +++ b/application/ADBWohneinheit/ADBWohneinheitModel.php @@ -1,6 +1,8 @@ id; $hausnummer_data['plz_id'] = $plz->id; diff --git a/application/AddressDB/AddressDBController.php b/application/AddressDB/AddressDBController.php index 850728fff..b722634ce 100644 --- a/application/AddressDB/AddressDBController.php +++ b/application/AddressDB/AddressDBController.php @@ -270,7 +270,7 @@ class AddressDBController extends mfBaseController { if(!$this->me->is("Admin")) { $required[] = "netzgebiet_id"; } - foreach(['adrcd','extref','netzgebiet_id','strasse','hausnummer','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count'] as $field) { + foreach(['adrcd','extref','rimo_id','netzgebiet_id','strasse','hausnummer','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count'] as $field) { if(in_array($field, $required)) { if(!trim($r->$field)) { $this->layout()->setFlash("'".ucfirst($field)."' darf nicht leer sein!", "error"); diff --git a/application/Productgroup/ProductgroupController.php b/application/Productgroup/ProductgroupController.php index 38a5cc812..c89e3dd18 100644 --- a/application/Productgroup/ProductgroupController.php +++ b/application/Productgroup/ProductgroupController.php @@ -87,6 +87,24 @@ class ProductgroupController extends mfBaseController { $group_data = []; $group_data['name'] = $name; + $group_data["matchcodeorigin"] = null; + + if($r->matchcodeorigin) { + switch($r->matchcodeorigin) { + case "address": + $group_data["matchcodeorigin"] = "address"; + break; + case "domain": + $group_data["matchcodeorigin"] = "domain"; + break; + case "terminationaddress": + $group_data["matchcodeorigin"] = "terminationaddress"; + break; + case "voicenumber": + $group_data["matchcodeorigin"] = "voicenumber"; + break; + } + } if($mode == "edit") { $group->update($group_data); diff --git a/application/Productgroup/ProductgroupModel.php b/application/Productgroup/ProductgroupModel.php index e418345d6..3bd4112e1 100644 --- a/application/Productgroup/ProductgroupModel.php +++ b/application/Productgroup/ProductgroupModel.php @@ -1,8 +1,9 @@ escape($filter['name']); + $where .= " AND XinonFibuMerge.name='$name'"; + } + } //var_dump($filter, $where);exit; return $where; diff --git a/db/migrations/20240118193741_productgroup_add_matchcodeorigin.php b/db/migrations/20240118193741_productgroup_add_matchcodeorigin.php new file mode 100644 index 000000000..df899e32e --- /dev/null +++ b/db/migrations/20240118193741_productgroup_add_matchcodeorigin.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + $table = $this->table("Productgroup"); + $table->addColumn("matchcodeorigin", "string", ["null" => true, "default" => null, "limit" => 64, "after" => "name"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $this->table("Productgroup")->removeColumn("matchcodeorigin")->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/lang/de.php b/lang/de.php index 9c5e67579..e734966c6 100644 --- a/lang/de.php +++ b/lang/de.php @@ -73,7 +73,7 @@ $l["cc.tschechien"] = "CZ"; $l["cc.czechia"] = "CZ"; $l["cc.tschechische republik"] = "CZ"; $l["cc.czech republic"] = "CZ"; -$l["cc.Česká republika"] = "CZ"; +$l["cc.Ceska republika"] = "CZ"; $l["cc.deutschland"] = "DE"; $l["cc.germany"] = "DE"; $l["cc.frankreich"] = "FR"; @@ -81,7 +81,6 @@ $l["cc.france"] = "FR"; $l["cc.francaise"] = "FR"; $l["cc.République française"] = "FR"; $l["cc.Republique francaise"] = "FR"; -$l["cc.großbritannien"] = "GB"; $l["cc.grossbritannien"] = "GB"; $l["cc.britain"] = "GB"; $l["cc.great britain"] = "GB"; @@ -89,7 +88,6 @@ $l["cc.uk"] = "GB"; $l["cc.united kingdom"] = "GB"; $l["cc.United Kingdom of Great Britain and Northern Ireland"] = "GB"; $l["cc.Vereinigtes Koenigreich"] = "GB"; -$l["cc.Vereinigtes Koenigreich Großbritannien und Nordirland"] = "GB"; $l["cc.Vereinigtes Koenigreich Grossbritannien und Nordirland"] = "GB"; $l["cc.ungarn"] = "HU"; $l["cc.hungary"] = "HU"; @@ -105,7 +103,6 @@ $l["cc.nihon"] = "JP"; $l["cc.日本"] = "JP"; $l["cc.日本国"] = "JP"; $l["cc.luxemburg"] = "LU"; -$l["cc.großherzogtum luxemburg"] = "LU"; $l["cc.grossherzogtum luxemburg"] = "LU"; $l["cc.luxembourg"] = "LU"; $l["cc.grand duchy of luxembourg"] = "LU"; @@ -126,17 +123,17 @@ $l["cc.slovenia"] = "SL"; $l["cc.slowakei"] = "SK"; $l["cc.slovakia"] = "SK"; $l["cc.slowakische republik"] = "SK"; -$l["cc.Slovak Republic"] = "SK"; -$l["cc.Vereinigte Staaten"] = "US"; -$l["cc.Vereinigte Staaten von Amerika"] = "US"; +$l["cc.slovak republic"] = "SK"; +$l["cc.vereinigte staaten"] = "US"; +$l["cc.vereinigte staaten von amerika"] = "US"; $l["cc.usa - vereinigte staaten"] = "US"; $l["cc.Amerika"] = "US"; -$l["cc.US"] = "US"; -$l["cc.USA"] = "US"; -$l["cc.U.S.A."] = "US"; -$l["cc.America"] = "US"; -$l["cc.United States"] = "US"; -$l["cc.United States of America"] = "US"; +$l["cc.us"] = "US"; +$l["cc.usa"] = "US"; +$l["cc.u.s.a."] = "US"; +$l["cc.america"] = "US"; +$l["cc.united states"] = "US"; +$l["cc.united states of america"] = "US"; $l["cc.mm"] = "CW"; $lang['de'] = $l; \ No newline at end of file diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index 9881ed950..f4564eb7f 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -288,7 +288,6 @@ function __($_string, $prefix = null) { $string = str_replace(["Ä","Ö","Ü","ß","ä","ö","ü","ß"], ["ae","oe","ue","ss","ae","oe","ue", "ss"], strtolower($_string)); - if(!$lang) { //mfLoghandler::singleton()->debug("Loading language file for __() function"); include(BASEDIR . "/lang/de.php"); From 791465c9a44d7c0bd88ee9f8547dca1ab3ef56f4 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 22:06:08 +0100 Subject: [PATCH 10/19] Not deleting OAID anymore when saving ADBWohneinheit --- application/ADBWohneinheit/ADBWohneinheitController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/ADBWohneinheit/ADBWohneinheitController.php b/application/ADBWohneinheit/ADBWohneinheitController.php index e1941ce1f..7906de192 100644 --- a/application/ADBWohneinheit/ADBWohneinheitController.php +++ b/application/ADBWohneinheit/ADBWohneinheitController.php @@ -77,7 +77,7 @@ class ADBWohneinheitController extends mfBaseController { } - $unit_data["oaid"] = ($r->oaid) ? trim($r->oaid) : null; + //$unit_data["oaid"] = ($r->oaid) ? trim($r->oaid) : null; $unit_data["extref"] = ($r->extref) ? trim($r->extref) : null; $unit_data["block"] = ($r->block) ? trim($r->block) : null; $unit_data["stiege"] = ($r->stiege) ? trim($r->stiege) : null; From a90de85ddfdec3ea489a0e800cbe3706848e6865 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Sat, 20 Jan 2024 09:17:26 +0100 Subject: [PATCH 11/19] Finished Preorder statistics / added statistics permission --- Layout/default/ADBWohneinheit/Form.php | 76 ++++++++++--------- Layout/default/AddressDB/View.php | 4 +- Layout/default/Dashboard/Dashboard.php | 48 ++++++------ Layout/default/User/Form.php | 13 +++- application/Dashboard/DashboardController.php | 5 +- application/User/UserController.php | 5 +- ...19124212_add_can_statistics_permission.php | 31 ++++++++ 7 files changed, 114 insertions(+), 68 deletions(-) create mode 100644 db/migrations/20240119124212_add_can_statistics_permission.php diff --git a/Layout/default/ADBWohneinheit/Form.php b/Layout/default/ADBWohneinheit/Form.php index b7a5b3a65..7773256c2 100644 --- a/Layout/default/ADBWohneinheit/Form.php +++ b/Layout/default/ADBWohneinheit/Form.php @@ -122,48 +122,52 @@ - -
-
-
+ + + + rimo_workorder) && $unit->rimo_workorder->id) || (is_array($unit->ftu_data) && $unit->ftu_data->id)): ?> +
+
+
-
+
-
-
- - - - - - - - - - - - - - - - - - - - - - - -

FTU

FTU Name:ftu_data["name"]?> -
FTU External IDftu_data["id"]?> -

Workorder

Namerimo_workorder->rimo_name?>
External IDrimo_workorder->rimo_id?>
Statusrimo_workorder->rimo_status?>
Erstelltrimo_workorder)) ? date("d.m.Y H:i:s", $unit->rimo_workorder->create) : ""?>
-
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +

FTU

FTU Name:ftu_data["name"]?> +
FTU External IDftu_data["id"]?> +

Workorder

Namerimo_workorder->rimo_name?>
External IDrimo_workorder->rimo_id?>
Statusrimo_workorder->rimo_status?>
Erstelltrimo_workorder)) ? date("d.m.Y H:i:s", $unit->rimo_workorder->create) : ""?>
- - +
+
+ +
diff --git a/Layout/default/AddressDB/View.php b/Layout/default/AddressDB/View.php index 669cd8829..f61d3d060 100644 --- a/Layout/default/AddressDB/View.php +++ b/Layout/default/AddressDB/View.php @@ -31,7 +31,7 @@
-
+
@@ -107,7 +107,7 @@
-
+
diff --git a/Layout/default/Dashboard/Dashboard.php b/Layout/default/Dashboard/Dashboard.php index 6ebac6122..f347982a9 100644 --- a/Layout/default/Dashboard/Dashboard.php +++ b/Layout/default/Dashboard/Dashboard.php @@ -66,7 +66,7 @@ $chartColors = [
-

Akquise Statistiken Momentan nur für Admins sichtbar

+

Akquise Statistiken

@@ -87,7 +87,7 @@ $chartColors = [
- +
Bestellungen

/

@@ -97,13 +97,28 @@ $chartColors = [
- + +
+
+
+
+
+ +
+
Aktive Anschlüsse
+

/

+
+ +
+
+
+
- +
Status BEP Installed (244, SD)

/

@@ -118,7 +133,7 @@ $chartColors = [
- +
Status OTO Installed (245, MD)

/

@@ -128,20 +143,7 @@ $chartColors = [
-
-
-
-
-
- -
-
Aktive Anschlüsse
-

/

-
- -
-
-
+
@@ -199,9 +201,9 @@ $chartColors = [ $count): ?>
##% () - " style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> + ##% () - ">
origin_id?> origin?> owner->getCompanyOrName()?>">adb_wohneinheit_id) ? $oaid->adb_wohneinheit_count."x" : ""?>"> + adb_wohneinheit_id) ? $oaid->adb_wohneinheit_count."x" : ""?> + termination_id): ?> termination) && $oaid->termination->building_id) ? $oaid->termination->building->getAddress() : ""?> termination->name) ? " - ".$oaid->termination->name : ""?> adb_wohneinheit_id && is_object($oaid->adb_wohneinheit)): ?> + [adb_wohneinheit->hausnummer->strasse->gemeinde->name?>] adb_wohneinheit->hausnummer->plz->plz?> adb_wohneinheit->hausnummer->ortschaft->name?>, diff --git a/application/AddressDB/AddressDBController.php b/application/AddressDB/AddressDBController.php index b722634ce..3670858c0 100644 --- a/application/AddressDB/AddressDBController.php +++ b/application/AddressDB/AddressDBController.php @@ -370,7 +370,9 @@ class AddressDBController extends mfBaseController { $this->layout()->setFlash("Fehler beim Erstellen einer Wohneinheit!", "warning"); return $this->addAction(); } - $wohneinheit->oaid = $wohneinheit->getNewOAID(); + if($hausnummer->netzgebiet->unit_create_oaid) { + $wohneinheit->oaid = $wohneinheit->getNewOAID(); + } $wohneinheit->save(); $w++; } @@ -472,6 +474,9 @@ class AddressDBController extends mfBaseController { case 'findBuildings': $return = $this->findBuildingsApi(); break; + case 'getUnit': + $return = $this->getUnitApi(); + break; case "findUnit": break; default: @@ -487,6 +492,18 @@ class AddressDBController extends mfBaseController { $this->returnJson($data); } + private function getUnitApi() { + $id = $this->request->id; + if(!$id) return false; + + $unit = new ADBWohneinheit($id); + if(!$unit->id) return false; + + $return = $unit->hausnummer->getAddress(); + if((string)$unit) $return .= " ".(string)$unit; + return["string" => $return]; + } + private function findAddressApi() { $addresses = []; $search = trim($this->request->q); diff --git a/application/OpenAccessId/OpenAccessId.php b/application/OpenAccessId/OpenAccessId.php index 252dc159a..17e191361 100644 --- a/application/OpenAccessId/OpenAccessId.php +++ b/application/OpenAccessId/OpenAccessId.php @@ -258,7 +258,7 @@ class OpenAccessId extends mfBaseModel { $exp_data_update->rimo->ftu_name = $ftu_data['name']; $exp_data_update->rimo->ftu_assigned_date = date("U"); $this->export_data = json_encode($ext_data_update); - $this-save(); + $this->save(); } } } diff --git a/application/OpenAccessId/OpenAccessIdController.php b/application/OpenAccessId/OpenAccessIdController.php index 457004963..a5cf3e77c 100644 --- a/application/OpenAccessId/OpenAccessIdController.php +++ b/application/OpenAccessId/OpenAccessIdController.php @@ -85,6 +85,79 @@ class OpenAccessIdController extends mfBaseController { return $new_filter; } + protected function changeADBWohneinheitAction() { + $this->layout()->setTemplate("OpenAccessId/ChangeUnit"); + $id = $this->request->id; + if(!$id || $id <1) { + $this->layout()->setFlash("Ungültige OAID", "error"); + $this->redirect("OpenAccessId"); + } + + $oaid = new OpenAccessId($id); + if(!$oaid->id) { + $this->layout()->setFlash("Ungültige OAID", "error"); + $this->redirect("OpenAccessId"); + } + + $this->layout()->set("oaid", $oaid); + + if(!$this->request->new_unit_id) { + return true; + } + + // get old and new unit_id + $old_unit = ADBWohneinheitModel::getFirst(["oaid" => $oaid->oaid]); + $new_unit = new ADBWohneinheit($this->request->new_unit_id); + + + + + + + if($old_unit) { + $old_preorder = PreorderModel::getFirst(["adb_wohneinheit_id" => $old_unit->id]); + if($old_preorder) { + // remove oaid from preorder + $old_preorder->oaid = null; + $old_preorder->save(); + } + // unassign oaid from rimo ftu + // get oaid from rimo + // unassign ftu from aoid + // remove oaid from old unit + + // remove meta data from oaid + $oaid->assigned = 0; + $oaid->adb_wohneinheit_id = null; + $oaid->termination_id = null; + $oaid->exported = 0; + $oaid->exported_to = null; + $oaid->exported_data = null; + $oaid->address = null; + $oaid->unit_string = null; + $oaid->save(); + } + + if($new_unit) { + $new_preorder = PreorderModel::getFirst(["adb_wohneinheit_id" => $new_unit->id]); + // add oaid to new unit + // assign oaid to new ftu in rimo + if($new_preorder) { + // add oaid to preorder + $new_preorder->oaid = $oaid->oaid; + } + // save metadata to oaid + $oaid->assigned = date("U"); + $oaid->adb_wohneinheit_id = $new_unit->id; + $oaid->termination_id = null; + $oaid->exported = date("U"); + + } + + + + } + protected function importerAction() { $this->layout()->setTemplate("OpenAccessId/Importer"); diff --git a/db/migrations/20240122150833_netzgebiet_add_unit_create_oaid.php b/db/migrations/20240122150833_netzgebiet_add_unit_create_oaid.php new file mode 100644 index 000000000..7c322799b --- /dev/null +++ b/db/migrations/20240122150833_netzgebiet_add_unit_create_oaid.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + $table = $this->table("Netzgebiet"); + $table->addColumn("unit_create_oaid", "integer", ["null" => false, "default" => 0, "after" => "unit_count"]); + $table->update(); + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + $this->table("Netzgebiet")->removeColumn("unit_create_oaid")->save(); + } + } +} From 5aa386c0f90d98ee46fe8e71e3ca3adb43c02754 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 23 Jan 2024 13:45:10 +0100 Subject: [PATCH 16/19] Fixed not showing non-Object OAIDs in ADB view --- Layout/default/AddressDB/View.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Layout/default/AddressDB/View.php b/Layout/default/AddressDB/View.php index 09d9325eb..7637bab06 100644 --- a/Layout/default/AddressDB/View.php +++ b/Layout/default/AddressDB/View.php @@ -128,8 +128,12 @@ $unit->id])?>"> id?> - oaid && OpenAccessIdModel::getFirst(["oaid" => $unit->oaid])): ?> - ["oaid" => $unit->oaid]])?>" class="text-pink" target="_blank">oaid?> + oaid): ?> + $unit->oaid])): ?> + ["oaid" => $unit->oaid]])?>" class="text-pink" target="_blank">oaid?> + + oaid?> + status->code?> - status->name?>
Lieferant Skonto % fibu_supplier_skonto_rate?>
Lieferant Zahlsperrefibu_supplier_paymentblock) ? " Automatische Zahlungen gesperrt" : "Nicht gesperrt"?>

Zusatzdaten