From eae4e07302edbdcce9a487cbe86a5659b0ed9414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Thu, 16 Oct 2025 15:22:10 +0200 Subject: [PATCH] Add a message when `CommonDBChild` item creation is refused --- src/CommonDBChild.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CommonDBChild.php b/src/CommonDBChild.php index 23e60fdd944..fd5f19e6818 100644 --- a/src/CommonDBChild.php +++ b/src/CommonDBChild.php @@ -440,6 +440,11 @@ public function prepareInputForAdd($input) static::$mustBeAttached && !$this->getItemFromArray(static::$itemtype, static::$items_id, $input) ) { + Session::addMessageAfterRedirect( + __s('Parent item is invalid.'), + true, + ERROR + ); return false; } @@ -460,6 +465,7 @@ public function prepareInputForUpdate($input) static::$items_id, ]) ) { + // A message is already added by `self::checkAttachedItemChangesAllowed()` return false; }