From fce57c870fb92b30a0040a54caaa9ed7ac65d3ca Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Wed, 1 Sep 2021 12:06:49 +0000
Subject: [PATCH] Bug 20256: (follow-up) Don't filter if no libraries are
 restricted

---
 cataloguing/additem.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index 640ef222f0..35db3c2476 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -194,7 +194,7 @@ sub generate_subfield_form {
             elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
                 my @allowed = $patron->libraries_where_can_edit_items;
                 foreach my $thisbranch (@$branches) {
-                    next unless any { /^$thisbranch->{branchcode}$/ } @allowed;
+                    next unless !@allowed || any { /^$thisbranch->{branchcode}$/ } @allowed;
                     push @authorised_values, $thisbranch->{branchcode};
                     $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
                     $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
-- 
2.20.1