From 52b8462afc8d1713d097c1591fa75fa51797aeb2 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 8 May 2025 20:08:09 +0200 Subject: [PATCH 1/3] WIP Mass Productchange --- .../default/Admin/MassProductchange/Index.php | 107 ++++++++++++++++++ .../Admin/functions/MassProductchange.php | 75 ++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 Layout/default/Admin/MassProductchange/Index.php create mode 100644 application/Admin/functions/MassProductchange.php diff --git a/Layout/default/Admin/MassProductchange/Index.php b/Layout/default/Admin/MassProductchange/Index.php new file mode 100644 index 000000000..50c26009d --- /dev/null +++ b/Layout/default/Admin/MassProductchange/Index.php @@ -0,0 +1,107 @@ + + + +
+
+
+
+ +
+

Massenproduktwechsel

+
+
+
+ + +
+
+

Produktwechsel erstellen

+
+
+ +
+
+ +
+ Sucht alle aktiven Contracts mit bisherigem Produkt und erstellt jeweils einen Produktwechsel. +
+ +
"create"])?>"> +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ + +
+ +
+ + +
+ + +
+
+
+ +
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/application/Admin/functions/MassProductchange.php b/application/Admin/functions/MassProductchange.php new file mode 100644 index 000000000..47e39f09a --- /dev/null +++ b/application/Admin/functions/MassProductchange.php @@ -0,0 +1,75 @@ +request = $request; + $this->db = FronkDB::singleton(); + $this->log = mfLoghandler::singleton(); + + } + + public function runRequest() { + $action = $this->request->do; + if(!$action) { + return $this->indexAction(); + } else { + $method = $action."Action"; + if(method_exists($this, $method)) { + return $this->$method(); + } else { + throw new Exception("Method not found", "404"); + } + } + } + + public function indexAction() { + + return [ + "template" => "Admin/MassProductchange/Index", + "redirect" => "", + "templateVars" => [] + ]; + } + + public function createAction() { + $this->log->debug("Create action called"); + $this->log->debug($this->request->getPost()); + + $old_product_id = $this->request->getPost("old_product_id"); + $new_product_id = $this->request->getPost("new_product_id"); + + if(!$old_product_id || !$new_product_id) { + $this->flash[] = "Beide Produkte werden benötigt."; + return [ + "template" => "Admin/MassProductchange/Index", + "redirect" => "", + "templateVars" => [] + ]; + } + + $contracts = ContractModel::searchActive(["product_id" => $old_product_id]); + + + + if($this->request->preview) { + return [ + "template" => "Admin/MassProductchange/Index", + "redirect" => "", + "templateVars" => ["contracts" => $contracts] + ]; + } + + return [ + "template" => "Admin/MassProductchange/Index", + "redirect" => "", + "templateVars" => [] + ]; + } + +} \ No newline at end of file From 615b1434a23688a94a0090da23943b1d9b9c81ee Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Fri, 9 May 2025 13:28:42 +0200 Subject: [PATCH 2/3] added "after" to woker_add_active migration --- db/migrations/20250314130000_woker_add_active.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrations/20250314130000_woker_add_active.php b/db/migrations/20250314130000_woker_add_active.php index b653fa26f..c72b6aea4 100644 --- a/db/migrations/20250314130000_woker_add_active.php +++ b/db/migrations/20250314130000_woker_add_active.php @@ -7,7 +7,7 @@ final class WokerAddActive extends AbstractMigration { if ($this->getEnvironment() == "thetool") { $workerTable = $this->table("Worker"); $workerTable - ->addColumn("active", "integer", ['default' => 1]) + ->addColumn("active", "integer", ['default' => 1, "after" => "id"]) ->save(); } } From 797c8424aedf3fb55f071fb5bbb1067b49b17002 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 14 May 2025 12:45:09 +0200 Subject: [PATCH 3/3] RimoImport: Service Port DN: Treat SpliceBox like Shelf --- scripts/adb-rimo-import/rimo-import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/adb-rimo-import/rimo-import.php b/scripts/adb-rimo-import/rimo-import.php index 2b77ffa3f..66f94e1f3 100755 --- a/scripts/adb-rimo-import/rimo-import.php +++ b/scripts/adb-rimo-import/rimo-import.php @@ -893,5 +893,9 @@ function getServiceDnValues($dn) } } + if(!array_key_exists("Shelf", $fields) && array_key_exists("SpliceBox", $fields)) { + $fields['Shelf'] = $fields['SpliceBox']; + } + return $fields; }