From 6037307d9bc079e8e960739a0d783462621edffb Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Mon, 22 Apr 2024 16:28:12 +0200 Subject: [PATCH] 41191: insert an item group causes error --- .../ResourcesCommandActionHandler.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Services/COPage/PC/Resources/ResourcesCommandActionHandler.php b/Services/COPage/PC/Resources/ResourcesCommandActionHandler.php index 1a59baf54125..29548185e559 100644 --- a/Services/COPage/PC/Resources/ResourcesCommandActionHandler.php +++ b/Services/COPage/PC/Resources/ResourcesCommandActionHandler.php @@ -78,21 +78,31 @@ protected function insertCommand(array $body): Server\Response $res_type = $body["res_type"]; + $invalid = false; if ($res_type === "_other") { $res->setResourceListType("_other"); } elseif ($res_type === "_lobj") { $res->setResourceListType("_lobj"); } elseif ($res_type !== "itgr") { - $res->setResourceListType( - $body["type"] - ); + if (isset($body["type"])) { + $res->setResourceListType( + $body["type"] + ); + } else { + $invalid = true; + } } else { $res->setItemGroupRefId( - $body["itgr"] + (int) $body["itgr"] ); } - $updated = $page->update(); + if (!$invalid) { + $updated = $page->update(); + } else { + $page->buildDom(true); // rebuild dom (remove changes) + $updated = true; + } return $this->ui_wrapper->sendPage($this->page_gui, $updated); }