From fc3c3de604102832528609038a639a8f1593fb6a Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 22:02:43 +0100 Subject: [PATCH] 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 @@ + +
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");