From c9e519d0b5b9927a7f0a2eff553570723515c376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 31 Dec 2024 18:25:28 +0100 Subject: [PATCH] Show a warning flash, when creating a part from an info provider that has no category autoprovided This partially fixes the problems described in discussion #808 --- src/Controller/PartController.php | 4 ++++ translations/messages.en.xlf | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index d6acb36b..b11a5c90 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -229,6 +229,10 @@ class PartController extends AbstractController $dto = $infoRetriever->getDetails($providerKey, $providerId); $new_part = $infoRetriever->dtoToPart($dto); + if ($new_part->getCategory() === null || $new_part->getCategory()->getID() === null) { + $this->addFlash('warning', t("part.create_from_info_provider.no_category_yet")); + } + return $this->renderPartForm('new', $request, $new_part, [ 'info_provider_dto' => $dto, ]); diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index b63c1377..9c45b4be 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -12257,5 +12257,11 @@ Please note, that you can not impersonate a disabled user. If you try you will g Update existing part from info provider + + + part.create_from_info_provider.no_category_yet + Category could not be automatically determined by the info provider. Review the data and select the category manually. + +