From ca27bd4547e81d9db3766a87efad2225bf72f9d8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 15 Aug 2025 11:16:49 +0000 Subject: [PATCH] Bug 40585: (follow-up) Display error if no records were found Signed-off-by: Paul Derscheid Signed-off-by: Lucas Gass (cherry picked from commit b9bf3609d1fdfbeee1d40e07515717c8024c4c60) Signed-off-by: Paul Derscheid (cherry picked from commit 5b92e3ba7f30032bc7b4244e960a53b2af807f6c) Signed-off-by: Fridolin Somers --- .../modules/virtualshelves/addbybiblionumber.tt | 3 ++- virtualshelves/addbybiblionumber.pl | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tt index 03c06326d1..ff45db0c91 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tt @@ -13,10 +13,11 @@
[% UNLESS (authorized) %] +

Error adding to list

-

Error adding to list

[% IF (errcode==1) %]

Could not create a new list. Please check the name.

[% END %] [% IF (errcode==2) %]

Sorry, you do not have permission to add items to this list.

[% END %] + [% IF (errcode==3) %]

The titles selected were not found

[% END %]
[% ELSE %] diff --git a/virtualshelves/addbybiblionumber.pl b/virtualshelves/addbybiblionumber.pl index a5e68d8295..ad5cd22877 100755 --- a/virtualshelves/addbybiblionumber.pl +++ b/virtualshelves/addbybiblionumber.pl @@ -197,14 +197,17 @@ for my $biblionumber (@biblionumbers) { } ); } -$template->param( - multiple => ( scalar(@biblios) > 1 ), - total => scalar @biblios, - biblios => \@biblios, -); + +if ( scalar(@biblios) < 1 ) { + $errcode = 3; + $authorized = 0; # trigger error screen +} $template->param( - newshelf => $newshelf || 0, + multiple => ( scalar(@biblios) > 1 ), + total => scalar @biblios, + biblios => \@biblios, + newshelf => $newshelf || 0, authorized => $authorized, errcode => $errcode, );