diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm
index c2da80d8d6..58b84d18e0 100644
--- a/Koha/Template/Plugin/Branches.pm
+++ b/Koha/Template/Plugin/Branches.pm
@@ -58,8 +58,7 @@ sub GetURL {
sub all {
my ( $self, $params ) = @_;
- my $selected = $params->{selected};
- my $selecteds = $params->{selecteds};
+ my $selected = $params->{selected} || ();
my $unfiltered = $params->{unfiltered} || 0;
my $search_params = $params->{search_params} || {};
my $do_not_select_my_library = $params->{do_not_select_my_library} || 0; # By default we select the library of the logged in user if no selected passed
@@ -77,26 +76,18 @@ sub all {
? Koha::Libraries->search( $search_params, { order_by => ['branchname'] } )->unblessed
: Koha::Libraries->search_filtered( $search_params, { order_by => ['branchname'] } )->unblessed;
- if (defined $selecteds) {
- # For a select multiple, must be a Koha::Libraries
- my @selected_branchcodes = $selecteds ? $selecteds->get_column( ['branchcode'] ) : ();
- $libraries = [ map {
- my $l = $_;
- $l->{selected} = 1
- if grep { $_ eq $l->{branchcode} } @selected_branchcodes;
- $l;
- } @$libraries ];
- }
- else {
- for my $l ( @$libraries ) {
- if ( defined $selected and $l->{branchcode} eq $selected
- or not defined $selected and C4::Context->userenv and $l->{branchcode} eq ( C4::Context->userenv->{branch} // q{} )
- ) {
- $l->{selected} = 1;
- }
+ for my $l (@$libraries) {
+ if ( grep { $l->{branchcode} eq $_ } @selected
+ or not @selected
+ and not $do_not_select_my_library
+ and C4::Context->userenv
+ and $l->{branchcode} eq ( C4::Context->userenv->{branch} // q{} ) )
+ {
+ $l->{selected} = 1;
}
}
+
return $libraries;
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
index b8ea9b1fc8..768d1259fb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
@@ -218,7 +218,7 @@
Select All libraries if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
index 5f6b5603bf..cef07a000a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
@@ -376,7 +376,7 @@ Item types › Administration › Koha
Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.