Bugzilla – Attachment 119537 Details for
Bug 23271
Koha::Patron::Category should use Koha::Object::Limit::Library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23271: Remove 'selecteds' from Branches
Bug-23271-Remove-selecteds-from-Branches.patch (text/plain), 5.79 KB, created by
Jonathan Druart
on 2021-04-13 13:52:43 UTC
(
hide
)
Description:
Bug 23271: Remove 'selecteds' from Branches
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-04-13 13:52:43 UTC
Size:
5.79 KB
patch
obsolete
>From 0b6ddf85908f09904067ffb180715230e5b622ef Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 13 Apr 2021 15:47:30 +0200 >Subject: [PATCH] Bug 23271: Remove 'selecteds' from Branches > >Restoring the first version of this from the first patch and reverting >what hit master first. >--- > Koha/Template/Plugin/Branches.pm | 29 +++++++------------ > .../prog/en/modules/admin/categories.tt | 2 +- > .../prog/en/modules/admin/itemtypes.tt | 2 +- > .../en/modules/admin/patron-attr-types.tt | 2 +- > 4 files changed, 13 insertions(+), 22 deletions(-) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index c2da80d8d64..58b84d18e05 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 1a5faa0b6c2..08c2e5c3f6c 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 @@ > <li><label for="branches">Library limitations: </label> > <select id="branches" name="branches" multiple size="10"> > <option value="">All libraries</option> >- [% PROCESS options_for_libraries libraries => Branches.all( selecteds => category.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => category.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] > </select> > <span>Select <em>All libraries</em> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value. > </span> >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 67392d31c3f..c882c8f9f50 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -377,7 +377,7 @@ Data deleted > <li><label for="branches">Library limitation: </label> > <select id="branches" name="branches" multiple size="10"> > <option value="">All libraries</option> >- [% PROCESS options_for_libraries libraries => Branches.all( selecteds => itemtype.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => itemtype.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] > </select> > <span class="hint">Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.</span> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >index f87e9cf4d87..23b8a27e359 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >@@ -214,7 +214,7 @@ > <li><label for="branches">Library limitation: </label> > <select id="branches" name="branches" multiple size="10"> > <option value="">All libraries</option> >- [% PROCESS options_for_libraries libraries => Branches.all( selecteds => attribute_type.library_limits ) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => attribute_type.library_limits ) %] > </select> > <div class="hint">Select "All libraries" if this attribute type should always be displayed. Otherwise select libraries you want to associate with this value. > </div> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23271
:
94292
|
94293
|
94294
|
119503
|
119504
|
119505
|
119529
|
119530
|
119531
|
119532
|
119533
|
119537
|
119579
|
119580
|
119581
|
119582
|
119583
|
119584
|
119772
|
119773
|
119774
|
119775
|
119776
|
119777
|
119939
|
119956
|
119957
|
120054