Bugzilla – Attachment 172524 Details for
Bug 36742
Improve OPAC behavior for instances with only one library, including libraries page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36742: Do not show library selection options if there is one or fewer public libraries
Bug-36742-Do-not-show-library-selection-options-if.patch (text/plain), 19.34 KB, created by
Marcel de Rooy
on 2024-10-08 13:35:13 UTC
(
hide
)
Description:
Bug 36742: Do not show library selection options if there is one or fewer public libraries
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-10-08 13:35:13 UTC
Size:
19.34 KB
patch
obsolete
>From 83a63071431c186a333f44dcadfb5feb55b8fc8f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 27 Jun 2024 19:15:11 +0000 >Subject: [PATCH] Bug 36742: Do not show library selection options if there is > one or fewer public libraries >Content-Type: text/plain; charset=utf-8 > >If a system has only one library or only one library which is public we >don't need to show library-selection menus. It doesn't make sense to >show a dropdown with only one choice. > >This patch updates instances of Branches.all to add a "public => 1" >parameter. > >To test, apply the patch and start with a set of multiple public >libraries in your system (where public means the entry in Administration >-> Libraries for that library has the "Public" option set to "Yes"). > >Log in to the OPAC test these pages, in each case confirming that the >the library dropdown appears correctly. > >- OPAC home page (with OpacAddMastheadLibraryPulldown enabled) >- OPAC news section (with existing news items and OpacNewsLibrarySelect > enabled) >- Advanced search (Location and availability section) >- The "Most popular" page (with OpacTopissue enabled) >- The suggestion entry form (with suggestion enabled) >- The article request entry form (with ArticleRequests enabled and > circulation rules configured to allow requests) > >Test again with only one library or only one public library. >Test again with no public libraries. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../bootstrap/en/includes/masthead.inc | 10 ++--- > .../bootstrap/en/includes/opac-topissues.inc | 15 ++++--- > .../bootstrap/en/modules/opac-advsearch.tt | 44 +++++++++++-------- > .../bootstrap/en/modules/opac-main.tt | 5 ++- > .../en/modules/opac-request-article.tt | 25 ++++++----- > .../bootstrap/en/modules/opac-suggestions.tt | 7 +-- > 6 files changed, 61 insertions(+), 45 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index b9fcf6fb02..e284d1ec9b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -16,6 +16,7 @@ > [% SET OpacMoreSearches = AdditionalContents.get( location => "OpacMoreSearches", lang => lang, library => branchcode || default_branch ) %] > [% SET CookieConsentBar = AdditionalContents.get( location => "CookieConsentBar", lang => lang, library => branchcode || default_branch ) %] > [% SET CookieConsentPopup = AdditionalContents.get( location => "CookieConsentPopup", lang => lang, library => branchcode || default_branch ) %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 }, selected => opac_name ) %] > > <button id="scrolltocontent">Skip to main content</button> > <div id="wrapper"> >@@ -257,15 +258,14 @@ > [% END # /ms_value %] > </div> <!-- /.col --> > >- [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >+ [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 && AllPublicBranches.size > 1 ) %] > <div class="col-sm col-md-3 col-lg-2 order-3 order-sm-4"> > <select name="limit" id="select_library" class="form-select"> > <option value="">All libraries</option> > > [% IF LibrarySearchGroups %]<optgroup label="Libraries">[% END %] > >- [% FOREACH library IN Branches.all( selected => opac_name ) %] >- [% NEXT UNLESS library.public %] >+ [% FOREACH library IN AllPublicBranches %] > [% IF library.selected %] > <option selected="selected" value="branch:[% library.branchcode | html %]">[% library.branchname | html %]</option> > [% ELSE %] >@@ -370,10 +370,10 @@ > </li> > [% END %] > [% END %] >- [% IF ( Koha.Preference('OPACShowLibraries') ) %] >+ [% IF ( Koha.Preference('OPACShowLibraries') && AllPublicBranches.size > 0 ) %] > <li class="nav-item"> > <a id="library_page" href="/cgi-bin/koha/opac-library.pl"> >- [% IF ( singleBranchMode ) %] >+ [% IF ( singleBranchMode || AllPublicBranches.size == 1 ) %] > <span>Library</span> > [% ELSE %] > <span>Libraries</span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >index 2deef2e69b..e11db58545 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >@@ -1,6 +1,7 @@ > [% USE Koha %] > [% USE Branches %] > [% PROCESS 'html_helpers.inc' %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 }, selected => branch ) %] > > <div id="search-facets"> > <form method="get" action="/cgi-bin/koha/opac-topissues.pl"> >@@ -17,12 +18,14 @@ > [% IF ( limit == 100 ) %]<option value ="100" selected="selected">100 titles</option>[% ELSE %]<option value="100">100 titles</option>[% END %] > </select></li> > >- [% IF Branches.all.size > 1 %] >- <li><label for="branch">From: </label> >- <select name="branch" id="branch"> >- <option value="">All libraries</option> >- [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] >- </select></li> >+ [% IF AllPublicBranches.size > 1 %] >+ <li> >+ <label for="branch">From: </label> >+ <select name="branch" id="branch"> >+ <option value="">All libraries</option> >+ [% PROCESS options_for_libraries libraries => AllPublicBranches %] >+ </select> >+ </li> > [% END %] > > [% OpacAdvancedSearchTypes = Koha.Preference('OpacAdvancedSearchTypes').split('\|') %] >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 d0c1517c25..6dadbe0e53 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -14,6 +14,8 @@ > </head> > [% INCLUDE 'bodytag.inc' bodyid='advsearch' bodyclass='scrollto' %] > [% INCLUDE 'masthead.inc' %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 } ) %] >+ > <form id="advsearch_form" action="/cgi-bin/koha/opac-search.pl" method="get"> > <input type="hidden" name="advsearch" value="1"/> > <div class="main"> >@@ -232,27 +234,33 @@ > <!-- AVAILABILITY LIMITS --> > <div id="location" class="advsearch_limit"> > <fieldset> >- <label for="branchloop">Location and availability:</label> >- <select class="form-select" name="limit" id="branchloop"> >- <option value="">All libraries</option> >- [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %] >- [% NEXT UNLESS BranchesLoo.public %] >- [% IF BranchesLoo.selected %] >- <option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option> >- [% ELSE %] >- <option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option> >- [% END %] >+ [% IF AllPublicBranches.size > 1 %] >+ <label for="branchloop">Location and availability:</label> >+ [% ELSE %] >+ <label for="branchloop">Availability:</label> > [% END %] >- </select> >- [% IF search_groups %] >- <p>OR</p> >- <label for="categoryloop">Groups of libraries</label> >- <select class="form-select" name="limit" id="categoryloop"> >- <option value=""> -- none -- </option> >- [% FOREACH sg IN search_groups %] >- <option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option> >+ >+ [% IF AllPublicBranches.size > 1 %] >+ <select class="form-select" name="limit" id="branchloop"> >+ <option value="">All libraries</option> >+ [% FOREACH BranchesLoo IN AllPublicBranches %] >+ [% IF BranchesLoo.selected %] >+ <option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option> >+ [% ELSE %] >+ <option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option> > [% END %] >+ [% END %] > </select> >+ [% IF search_groups %] >+ <p>OR</p> >+ <label for="categoryloop">Groups of libraries</label> >+ <select class="form-select" name="limit" id="categoryloop"> >+ <option value=""> -- none -- </option> >+ [% FOREACH sg IN search_groups %] >+ <option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option> >+ [% END %] >+ </select> >+ [% END %] > [% END %] > <div style="margin-top:.4em"> > <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >index 75182f9149..211e1e1419 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -12,6 +12,7 @@ > [% SET OpacNavRight = AdditionalContents.get( location => "OpacNavRight", lang => lang, library => logged_in_user.branchcode || default_branch ) %] > [% SET OpacMainUserBlock = AdditionalContents.get( location => "OpacMainUserBlock", lang => lang, library => logged_in_user.branchcode || default_branch ) %] > [% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode || default_branch ) %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 }, selected => branchcode ) %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> > <link rel="canonical" href="[% OPACBaseURL | url %]/" /> >@@ -64,7 +65,7 @@ > > <h1 class="sr-only">Koha home</h1> > >- [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %] >+ [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) && AllPublicBranches.size > 1 %] > [% UNLESS news_id %] > <form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl"> > <legend class="sr-only">News</legend> >@@ -75,7 +76,7 @@ > [% ELSE %] > <option value="">System-wide only</option> > [% END %] >- [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %] >+ [% PROCESS options_for_libraries libraries => AllPublicBranches %] > </select> > </form> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >index b646fa577d..41f9beba6e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >@@ -16,6 +16,7 @@ > [% INCLUDE 'masthead.inc' %] > > [% SET disclaimer = AdditionalContents.get( location => "ArticleRequestsDisclaimerText", lang => lang, library => logged_in_user.branchcode || default_branch ) %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 } ) %] > > <div class="main"> > [% WRAPPER breadcrumbs %] >@@ -163,18 +164,20 @@ > </select> > </li> > >- <li> >- <label for="branchcode">Pickup library:</label> >- <select name="branchcode" id="branchcode" required="required"> >- [% FOREACH b IN Branches.all %] >- [% IF b.branchcode == Branches.GetLoggedInBranchcode %] >- <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option> >- [% ELSE %] >- <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option> >+ [% IF AllPublicBranches.size > 1 %] >+ <li> >+ <label for="branchcode">Pickup library:</label> >+ <select name="branchcode" id="branchcode" required="required"> >+ [% FOREACH b IN AllPublicBranches %] >+ [% IF b.branchcode == Branches.GetLoggedInBranchcode %] >+ <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option> >+ [% ELSE %] >+ <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option> >+ [% END %] > [% END %] >- [% END %] >- </select> >- </li> >+ </select> >+ </li> >+ [% END %] > </ul> > </fieldset> > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 8febcbcc3a..645dab4914 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -8,6 +8,7 @@ > [% SET opacsuggestion = AdditionalContents.get( location => "OpacSuggestioninstructions", lang => lang, library => logged_in_user.branchcode || default_branch ) %] > [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] > [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% SET AllPublicBranches = Branches.all( search_params => { public => 1 }, selected => logged_in_user.branchcode ) %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( op_add_form ) %]Enter a new purchase suggestion[% END %] > [% IF ( op_else ) %]Purchase suggestions[% END %] › >@@ -219,19 +220,19 @@ > [% END %] > </li> > [% END %] >- [% UNLESS ( branchcode_hidden )%] >+ [% UNLESS ( branchcode_hidden || AllPublicBranches.size < 2 )%] > <li> > [% IF ( branchcode_required ) %] > <label for="branch" class="required">Library:</label> > <select name="branchcode" id="branch" required="required"> > <option value=""></option> >- [% PROCESS options_for_libraries libraries => Branches.all( selected => logged_in_user.branchcode ) %] >+ [% PROCESS options_for_libraries libraries => AllPublicBranches %] > </select> > <div class="required_label required">Required</div> > [% ELSE %] > <label for="branch">Library:</label> > <select name="branchcode" id="branch"> >- [% PROCESS options_for_libraries libraries => Branches.all( selected => logged_in_user.branchcode ) %] >+ [% PROCESS options_for_libraries libraries => AllPublicBranches %] > </select> > [% END %] > </li> >-- >2.39.5
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 36742
:
168267
|
168317
|
168377
|
172520
|
172521
| 172524 |
172525