From d33d93867f2170a605ffc908da2127fdc0555d7d Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Mon, 31 Mar 2025 14:22:44 +0200 Subject: [PATCH] Fixed Article Packets and Shipping Note Text Entry --- .../WarehouseArticle/WarehouseArticleController.php | 6 +++--- application/WarehouseArticle/WarehouseArticleModel.php | 6 +++--- .../WarehouseArticlePacketController.php | 8 +++++--- .../pages/WarehouseShippingNote/WarehouseShippingNote.js | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/application/WarehouseArticle/WarehouseArticleController.php b/application/WarehouseArticle/WarehouseArticleController.php index 93eae95cc..aef8d13df 100644 --- a/application/WarehouseArticle/WarehouseArticleController.php +++ b/application/WarehouseArticle/WarehouseArticleController.php @@ -18,9 +18,9 @@ class WarehouseArticleController extends TTCrud { ['key' => 'cheapestSellPrice', 'text' => 'Verkauf', 'modal' => false, 'table' => ['class' => 'text-center', 'suffix' => ' €']], ['key' => 'warningAmount', 'text' => 'Warnmenge', 'required' => true,'modal' => ['type' => 'number'], 'table' => ['class' => 'text-center']], // Stock/inventory related ['key' => 'criticalAmount', 'text' => 'Kritische Menge', 'required' => true,'modal' => ['type' => 'number'], 'table' => ['class' => 'text-center']], // Stock/inventory related - ['key' => 'isSerialDocumentation', 'text' => 'Seriennummern', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value - ['key' => 'isEShop', 'text' => 'Ist E-Shop', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value - ['key' => 'isEShopHide', 'text' => 'E-Shop Versteckt', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value + ['key' => 'isSerialDocumentation', 'text' => 'Seriennummern', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value + ['key' => 'isEShop', 'text' => 'Ist E-Shop', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value + ['key' => 'isEShopHide', 'text' => 'E-Shop Versteckt', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value ['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center', 'priority' => 8]] ]; diff --git a/application/WarehouseArticle/WarehouseArticleModel.php b/application/WarehouseArticle/WarehouseArticleModel.php index cb2c6da23..549e5bc08 100644 --- a/application/WarehouseArticle/WarehouseArticleModel.php +++ b/application/WarehouseArticle/WarehouseArticleModel.php @@ -10,10 +10,10 @@ class WarehouseArticleModel extends TTCrudBaseModel { public ?string $cheapestSellPrice; public int $warningAmount; public int $criticalAmount; - public int $isEShop; - public int $isEShopHide; + public ?int $isEShop; + public ?int $isEShopHide; public string $unit; - public int $isSerialDocumentation; + public ?int $isSerialDocumentation; public int $revenueAccount; diff --git a/application/WarehouseArticlePacket/WarehouseArticlePacketController.php b/application/WarehouseArticlePacket/WarehouseArticlePacketController.php index 918721360..64fe77836 100644 --- a/application/WarehouseArticlePacket/WarehouseArticlePacketController.php +++ b/application/WarehouseArticlePacket/WarehouseArticlePacketController.php @@ -47,11 +47,13 @@ class WarehouseArticlePacketController extends TTCrud { foreach ($subItems as $subItem) { $article = WarehouseArticleModel::get($subItem->id); - $cheapestSellPrices = json_decode($article->cheapestSellPrice); + $cheapestSellPrices = json_decode($article->cheapestSellPrice, true); // find in array cheapestSellPrices by title === 'Energie Steiermark' and get the price $articlePrice = array_values(array_filter($cheapestSellPrices, function ($cheapestSellPrice) { - return $cheapestSellPrice->title === 'Energie Steiermark'; - }))[0]->price; + return $cheapestSellPrice['title'] === 'Energie Steiermark'; + })); + + $articlePrice = $articlePrice[0]['price'] ?? 0; $calculatedSellPrice += $subItem->amount * $articlePrice; } diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.js b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.js index 3005d133e..adb6159d6 100644 --- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.js +++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.js @@ -64,7 +64,7 @@ Vue.component('warehouse-shipping-note-positions', {