Skip to content

Commit c9e519d

Browse files
committed
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
1 parent 273bde9 commit c9e519d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Controller/PartController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ public function createFromInfoProvider(Request $request, string $providerKey, st
229229
$dto = $infoRetriever->getDetails($providerKey, $providerId);
230230
$new_part = $infoRetriever->dtoToPart($dto);
231231

232+
if ($new_part->getCategory() === null || $new_part->getCategory()->getID() === null) {
233+
$this->addFlash('warning', t("part.create_from_info_provider.no_category_yet"));
234+
}
235+
232236
return $this->renderPartForm('new', $request, $new_part, [
233237
'info_provider_dto' => $dto,
234238
]);

translations/messages.en.xlf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12257,5 +12257,11 @@ Please note, that you can not impersonate a disabled user. If you try you will g
1225712257
<target>Update existing part from info provider</target>
1225812258
</segment>
1225912259
</unit>
12260+
<unit id="X5tEZJs" name="part.create_from_info_provider.no_category_yet">
12261+
<segment>
12262+
<source>part.create_from_info_provider.no_category_yet</source>
12263+
<target>Category could not be automatically determined by the info provider. Review the data and select the category manually.</target>
12264+
</segment>
12265+
</unit>
1226012266
</file>
1226112267
</xliff>

0 commit comments

Comments
 (0)