From c1388b7fe1bd374f8fecea53b580fb2158482cf2 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 21 Mar 2025 02:48:19 +0000 Subject: [PATCH] crash backup --- Controller/ApiAttributeController.php | 20 ++++++++++---------- Controller/ApiController.php | 2 +- Controller/BackendController.php | 8 ++++---- Theme/Backend/item-view.tpl.php | 8 ++++---- info.json | 1 + 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Controller/ApiAttributeController.php b/Controller/ApiAttributeController.php index 87714f8..69b74a8 100644 --- a/Controller/ApiAttributeController.php +++ b/Controller/ApiAttributeController.php @@ -243,7 +243,7 @@ final class ApiAttributeController extends Controller ->with('type') ->with('type/defaults') ->with('value') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->execute(); $new = $this->updateAttributeFromRequest($request, clone $old); @@ -291,7 +291,7 @@ final class ApiAttributeController extends Controller $itemAttribute = ItemAttributeMapper::get() ->with('type') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->execute(); if ($itemAttribute->type->isRequired) { @@ -327,7 +327,7 @@ final class ApiAttributeController extends Controller } /** @var BaseStringL11n $old */ - $old = ItemAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $old = ItemAttributeTypeL11nMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute(); $new = $this->updateAttributeTypeL11nFromRequest($request, clone $old); $this->updateModel($request->header->account, $old, $new, ItemAttributeTypeL11nMapper::class, 'item_attribute_type_l11n', $request->getOrigin()); @@ -357,7 +357,7 @@ final class ApiAttributeController extends Controller } /** @var BaseStringL11n $itemAttributeTypeL11n */ - $itemAttributeTypeL11n = ItemAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $itemAttributeTypeL11n = ItemAttributeTypeL11nMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute(); $this->deleteModel($request->header->account, $itemAttributeTypeL11n, ItemAttributeTypeL11nMapper::class, 'item_attribute_type_l11n', $request->getOrigin()); $this->createStandardDeleteResponse($request, $response, $itemAttributeTypeL11n); } @@ -385,7 +385,7 @@ final class ApiAttributeController extends Controller } /** @var AttributeType $old */ - $old = ItemAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('id'))->execute(); + $old = ItemAttributeTypeMapper::get()->with('defaults')->where('id', $request->getDataInt('id') ?? 0)->execute(); $new = $this->updateAttributeTypeFromRequest($request, clone $old); $this->updateModel($request->header->account, $old, $new, ItemAttributeTypeMapper::class, 'item_attribute_type', $request->getOrigin()); @@ -417,7 +417,7 @@ final class ApiAttributeController extends Controller } /** @var AttributeType $itemAttributeType */ - $itemAttributeType = ItemAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('id'))->execute(); + $itemAttributeType = ItemAttributeTypeMapper::get()->with('defaults')->where('id', $request->getDataInt('id') ?? 0)->execute(); $this->deleteModel($request->header->account, $itemAttributeType, ItemAttributeTypeMapper::class, 'item_attribute_type', $request->getOrigin()); $this->createStandardDeleteResponse($request, $response, $itemAttributeType); } @@ -445,7 +445,7 @@ final class ApiAttributeController extends Controller } /** @var AttributeValue $old */ - $old = ItemAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $old = ItemAttributeValueMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute(); /** @var \Modules\Attribute\Models\Attribute $attr */ $attr = ItemAttributeMapper::get() @@ -485,7 +485,7 @@ final class ApiAttributeController extends Controller // } // /** @var \Modules\ItemManagement\Models\ItemAttributeValue $itemAttributeValue */ - // $itemAttributeValue = ItemAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute(); + // $itemAttributeValue = ItemAttributeValueMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute(); // $this->deleteModel($request->header->account, $itemAttributeValue, ItemAttributeValueMapper::class, 'item_attribute_value', $request->getOrigin()); // $this->createStandardDeleteResponse($request, $response, $itemAttributeValue); } @@ -513,7 +513,7 @@ final class ApiAttributeController extends Controller } /** @var BaseStringL11n $old */ - $old = ItemAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id')); + $old = ItemAttributeValueL11nMapper::get()->where('id', $request->getDataInt('id') ?? 0); $new = $this->updateAttributeValueL11nFromRequest($request, clone $old); $this->updateModel($request->header->account, $old, $new, ItemAttributeValueL11nMapper::class, 'item_attribute_value_l11n', $request->getOrigin()); @@ -543,7 +543,7 @@ final class ApiAttributeController extends Controller } /** @var BaseStringL11n $itemAttributeValueL11n */ - $itemAttributeValueL11n = ItemAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $itemAttributeValueL11n = ItemAttributeValueL11nMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute(); $this->deleteModel($request->header->account, $itemAttributeValueL11n, ItemAttributeValueL11nMapper::class, 'item_attribute_value_l11n', $request->getOrigin()); $this->createStandardDeleteResponse($request, $response, $itemAttributeValueL11n); } diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 2a0538d..91b5c2a 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -580,7 +580,7 @@ final class ApiController extends Controller } $old = ItemL11nMapper::get() - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->execute(); $new = $this->updateItemL11nFromRequest($request, clone $old); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 67a0e4d..71dcbc6 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -107,7 +107,7 @@ final class BackendController extends Controller ->with('l11n') ->with('defaults') ->with('defaults/l11n') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->where('l11n/language', $response->header->l11n->language) ->where('defaults/l11n/language', [$response->header->l11n->language, null]) ->execute(); @@ -142,7 +142,7 @@ final class BackendController extends Controller $view->attribute = ItemAttributeValueMapper::get() ->with('l11n') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->where('l11n/language', [$response->header->l11n->language, null]) ->execute(); @@ -438,7 +438,7 @@ final class BackendController extends Controller ->with('attributes/type/l11n') ->with('attributes/value') ->with('attributes/value/l11n') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->where('l11n/language', $response->header->l11n->language) ->where('l11n/type/title', ['name1', 'name2'], 'IN') ->where('attributes/type/l11n/language', $response->header->l11n->language) @@ -863,7 +863,7 @@ final class BackendController extends Controller $view->data['type'] = MaterialTypeMapper::get() ->with('l11n') - ->where('id', (int) $request->getData('id')) + ->where('id', $request->getDataInt('id') ?? 0) ->where('l11n/language', $response->header->l11n->language) ->execute(); diff --git a/Theme/Backend/item-view.tpl.php b/Theme/Backend/item-view.tpl.php index 41b8546..cbfc6ab 100644 --- a/Theme/Backend/item-view.tpl.php +++ b/Theme/Backend/item-view.tpl.php @@ -37,10 +37,10 @@ $item = $this->data['item'] ?? new NullItem(); $isNew = $item->id === 0; $logs = $this->data['logs'] ?? []; -$itemImage = $this->getData('itemImage') ?? new NullMedia(); +$itemImage = $this->data['itemImage'] ?? new NullMedia(); $allInvoices = $this->data['allInvoices'] ?? []; -$topCustomers = $this->getData('topCustomers') ?? [[], []]; +$topCustomers = $this->data['topCustomers'] ?? [[], []]; $languages = ISO639Enum::getConstants(); $regions = RegionEnum::getConstants(); @@ -145,7 +145,7 @@ echo $this->data['nav']->render();
- +
@@ -684,7 +684,7 @@ echo $this->data['nav']->render();
- +
diff --git a/info.json b/info.json index 5bfbb66..27b05d5 100755 --- a/info.json +++ b/info.json @@ -25,6 +25,7 @@ "Editor": "*", "Media": "*", "Tag": "*", + "Workflow": "*", "Admin": "*" }, "load": [