Bugzilla – Attachment 125019 Details for
Bug 28847
Branch limits while searching should be expanded in query building and not in CGI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT
Bug-28847-Cleanup-of-branch-limitsand-fix-OPACSEAR.patch (text/plain), 10.49 KB, created by
Joonas Kylmälä
on 2021-09-18 08:16:07 UTC
(
hide
)
Description:
Bug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-09-18 08:16:07 UTC
Size:
10.49 KB
patch
obsolete
>From 61f1410e31bf0303e57fb6b08d5b54855179a0a7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 12 Aug 2021 11:13:46 +0000 >Subject: [PATCH] Bug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The opac had 'branch_group_limit' parameters which can be simplified to more >closely match intranet code. > >Adjust C4::Auth for chaneg above to ensure dropdowns correctly populate > >Expand JS to prevent selection of single and multibranch limits > >To test: >1 - Enable OpacAddMastheadLibraryPulldown system preference >2 - Ensure branches and groups show as before patch >3 - Ensure single and multibranch limits from masthead apply as expected >4 - Test advanced search page, ensure you cannot select both single and multibranch limit >5 - Follow test plan on 28845 - ensure multibranch limit still correctly pre-selected > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >--- > C4/Auth.pm | 2 +- > .../prog/en/modules/catalogue/advsearch.tt | 31 +++++++++++++------ > .../bootstrap/en/includes/masthead.inc | 10 +++--- > .../bootstrap/en/modules/opac-advsearch.tt | 21 +++++++++++-- > 4 files changed, 46 insertions(+), 18 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index ac635b1a9c..816ae48ac1 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -559,7 +559,7 @@ sub get_template_and_user { > if ( > ( $opac_limit_override && $opac_search_limit && $opac_search_limit =~ /branch:([\w-]+)/ ) || > ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:([\w-]+)/ ) || >- ( $in->{'query'}->param('multibranchlimit') && $in->{'query'}->param('multibranchlimit') =~ /multibranchlimit-(\w+)/ ) >+ ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /multibranchlimit:(\w+)/ ) > ) { > $opac_name = $1; # opac_search_limit is a branch, so we use it. > } elsif ( $in->{'query'}->param('multibranchlimit') ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index a4d7c6d9d7..f46e93a93c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -289,17 +289,16 @@ > [%# FIXME Should not we filter the libraries displayed? %] > [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %] > </select></p> >- <!-- <input type="hidden" name="limit" value="branch: MAIN" /> --> > [% IF search_groups %] >- <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. --> >+ <p>OR</p> > > <p> > <label for="categoryloop">Groups of libraries: </label> >- <select name="multibranchlimit" id="categoryloop"> >+ <select name="limit" id="categoryloop"> > <option value=""> -- none -- </option> > [% FOREACH sg IN search_groups %] > [% UNLESS sg.branchcode %] >- <option value="[% sg.id | html %]">[% sg.title | html %]</option> >+ <option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option> > [% END %] > [% END %] > </select> >@@ -338,6 +337,7 @@ > dad.appendChild(line.cloneNode(true)); > line.removeChild(ButtonPlus); > } >+ > var Sticky; > $(document).ready(function() { > $("input[name=q]:eq(0)").focus(); >@@ -347,13 +347,24 @@ > stickTo: ".main", > stickyClass: "floating" > }); >- $("#branchloop").on("change",function(){ >- if( this.value != ""){ >- document.getElementById("categoryloop").disabled=true; >- } else { >- document.getElementById("categoryloop").disabled=false; >+ [% IF search_groups %] >+ function branch_limit() { >+ if( $("#branchloop").val() != "" ){ >+ $("#categoryloop").val("").prop('disabled',true); >+ } else { >+ $("#categoryloop").prop('disabled',false); >+ } >+ if ( $("#categoryloop").val() != "" ){ >+ $("#branchloop").val("").prop('disabled',true); >+ } else { >+ $("#branchloop").prop('disabled',false); >+ } > } >- }); >+ branch_limit(); >+ $("#branchloop,#categoryloop").on("change",function(){ >+ branch_limit(); >+ }); >+ [% END %] > > [% IF searchid %] > browser = KOHA.browser('[% searchid | html %]'); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 64448a05e8..10daac7367 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -234,7 +234,7 @@ > > [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] > <div class="col-sm col-md-3 col-lg-2 order-3 order-sm-4"> >- <select name="branch_group_limit" id="select_library" class="form-control"> >+ <select name="limit" id="select_library" class="form-control"> > <option value="">All libraries</option> > > [% IF LibrarySearchGroups %]<optgroup label="Libraries">[% END %] >@@ -252,9 +252,9 @@ > <optgroup label="Groups"> > [% FOREACH lsg IN LibrarySearchGroups %] > [% IF 'multibranchlimit-' _ lsg.id == opac_name || lsg.id == opac_name %] >- <option selected="selected" value="multibranchlimit-[% lsg.id | html %]">[% lsg.title | html %]</option> >+ <option selected="selected" value="multibranchlimit:[% lsg.id | html %]">[% lsg.title | html %]</option> > [% ELSE %] >- <option value="multibranchlimit-[% lsg.id | html %]">[% lsg.title | html %]</option> >+ <option value="multibranchlimit:[% lsg.id | html %]">[% lsg.title | html %]</option> > [% END # / bc.selected %] > [% END %] > </optgroup> >@@ -267,8 +267,8 @@ > [% ELSE %] > [% IF ( opac_limit_override ) %] > [% IF ( opac_search_limit ) %] >- [% IF ( multibranchlimit = opac_search_limit.match( 'branch:(multibranchlimit-\d+)' ) ) %] >- <input name="branch_group_limit" value="[% multibranchlimit.0 | html %]" type="hidden" /> >+ [% IF ( multibranchlimit = opac_search_limit.match( 'branch:multibranchlimit-(\d+)' ) ) %] >+ <input name="limit" value="multibranchlimit:[% multibranchlimit.0 | html %]" type="hidden" /> > [% ELSE %] > <input name="limit" value="[% opac_search_limit | html %]" type="hidden" /> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >index 273f19e070..7735d38b48 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -244,10 +244,10 @@ > [% IF search_groups %] > <p>OR</p> > <label for="categoryloop">Groups of libraries</label> >- <select name="multibranchlimit" id="categoryloop"> >+ <select name="limit" id="categoryloop"> > <option value=""> -- none -- </option> > [% FOREACH sg IN search_groups %] >- <option value="[% sg.id | html %]">[% sg.title | html %]</option> >+ <option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option> > [% END %] > </select> > [% END %] >@@ -455,7 +455,24 @@ > [% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %] > [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %] > <script> >+ function branch_limit() { >+ if( $("#branchloop").val() != "" ){ >+ $("#categoryloop").val("").prop('disabled',true); >+ } else { >+ $("#categoryloop").prop('disabled',false); >+ } >+ if ( $("#categoryloop").val() != "" ){ >+ $("#branchloop").val("").prop('disabled',true); >+ } else { >+ $("#branchloop").prop('disabled',false); >+ } >+ } > $(document).ready(function() { >+ branch_limit(); >+ $("#branchloop,#categoryloop").on("change",function(){ >+ branch_limit(); >+ }); >+ > $('#advsearches').tabs(); > jQuery.cookie.json = true; > //$('#advsearches > ul').tabs(); >-- >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 28847
:
123807
|
123808
|
123809
|
123830
|
123832
|
123833
|
123835
|
123836
|
123837
|
123841
|
124574
|
124575
|
124576
|
124577
|
124797
|
124831
|
125017
|
125018
| 125019 |
125020
|
125021
|
125022
|
126827