Bugzilla – Attachment 119584 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.85 KB, created by
Martin Renvoize (ashimema)
on 2021-04-14 14:48:46 UTC
(
hide
)
Description:
Bug 23271: Remove 'selecteds' from Branches
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-04-14 14:48:46 UTC
Size:
5.85 KB
patch
obsolete
>From 3e7c2d7777e23a4314950adc9fc73fee52ccf0b5 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. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > 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 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 1a5faa0b6c..08c2e5c3f6 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 67392d31c3..c882c8f9f5 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 f87e9cf4d8..23b8a27e35 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