Bugzilla – Attachment 123830 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), 9.30 KB, created by
Nick Clemens (kidclamp)
on 2021-08-13 16:17:58 UTC
(
hide
)
Description:
Bug 28847: Cleanup of branch limitsand fix OPAC_SEARCH_LIMIT
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-08-13 16:17:58 UTC
Size:
9.30 KB
patch
obsolete
>From 25b6d8eb9c60d74d299a7e44c053f1f48a09b684 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 > >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 >--- > C4/Auth.pm | 2 +- > .../prog/en/modules/catalogue/advsearch.tt | 29 ++++++++++++------- > .../bootstrap/en/includes/masthead.inc | 12 ++++---- > .../bootstrap/en/modules/opac-advsearch.tt | 17 +++++++++++ > 4 files changed, 43 insertions(+), 17 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index fd327bf618..8203cfa51b 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -561,7 +561,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..744cd582e8 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,19 @@ > dad.appendChild(line.cloneNode(true)); > line.removeChild(ButtonPlus); > } >+ 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); >+ } >+ } >+ > var Sticky; > $(document).ready(function() { > $("input[name=q]:eq(0)").focus(); >@@ -347,12 +359,9 @@ > stickTo: ".main", > stickyClass: "floating" > }); >- $("#branchloop").on("change",function(){ >- if( this.value != ""){ >- document.getElementById("categoryloop").disabled=true; >- } else { >- document.getElementById("categoryloop").disabled=false; >- } >+ branch_limit(); >+ $("#branchloop,#categoryloop").on("change",function(){ >+ branch_limit(); > }); > > [% IF searchid %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index e959075339..fc82d8d19e 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 %] >@@ -251,10 +251,10 @@ > </optgroup> > <optgroup label="Groups"> > [% FOREACH lsg IN LibrarySearchGroups %] >- [% IF 'multibranchlimit-' _ lsg.id == opac_name %] >- <option selected="selected" value="multibranchlimit-[% lsg.id | html %]">[% lsg.title | html %]</option> >+ [% IF 'multibranchlimit-' _ lsg.id == opac_name || lsg.id == opac_name %] >+ <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 1edd102340..968dd1c4ba 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -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