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,
);