mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Show warning, if no valid entity was found to generate a label (don't throw an exception)
This commit is contained in:
parent
5a9be023b1
commit
c2db827c9d
1 changed files with 6 additions and 2 deletions
|
@ -108,8 +108,12 @@ class LabelController extends AbstractController
|
||||||
if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile !== null)) {
|
if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile !== null)) {
|
||||||
$target_id = (string) $form->get('target_id')->getData();
|
$target_id = (string) $form->get('target_id')->getData();
|
||||||
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
|
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
|
||||||
$pdf_data = $this->labelGenerator->generateLabel($form_options, $targets);
|
if (!empty($targets)) {
|
||||||
$filename = $this->getLabelName($targets[0], $profile);
|
$pdf_data = $this->labelGenerator->generateLabel($form_options, $targets);
|
||||||
|
$filename = $this->getLabelName($targets[0], $profile);
|
||||||
|
} else {
|
||||||
|
$this->addFlash('warning', 'label_generator.no_entities_found');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('LabelSystem/dialog.html.twig', [
|
return $this->render('LabelSystem/dialog.html.twig', [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue