Bugzilla – Attachment 132057 Details for
Bug 17018
Split AdvancedSearchTypes for staff and OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17018: Split AdvancedSearchTypes for staff and OPAC
Bug-17018-Split-AdvancedSearchTypes-for-staff-and-.patch (text/plain), 12.76 KB, created by
Owen Leonard
on 2022-03-23 15:38:38 UTC
(
hide
)
Description:
Bug 17018: Split AdvancedSearchTypes for staff and OPAC
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2022-03-23 15:38:38 UTC
Size:
12.76 KB
patch
obsolete
>From a76bcaad659e5400db519f8659b65b0a6766bfdb Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 14 Feb 2022 19:18:15 +0000 >Subject: [PATCH] Bug 17018: Split AdvancedSearchTypes for staff and OPAC > >This patch adds a new system preference, OpacAdvancedSearchTypes, as an >OPAC-specific version of the AdvancedSearchTypes preference. Values from >AdvancedSearchTypes are copied to OpacAdvancedSearchTypes so that >behavior is consistent. > >The patch also alters the output of the "Most popular" page so that: >1. The page heading is correct ("Most popular titles" instead of "Top >issues"). >2. The table show both item type and collection whether or not the user >has submitted query with one of those fields as a filter. > >To test, apply the patch and run the database update process. > >- Go to Administration -> System preferences. >- Search for AdvancedSearchTypes. You should get two results, one for > the OPAC preference and one for the staff interface. >- Check that the OpacAdvancedSearchTypes settings match the > AdvancedSearchTypes settings. >- View the advanced search pages in the staff interface and OPAC to > confirm that the tabs look correct. >- Change the OpacAdvancedSearchTypes and AdvancedSearchTypes settings to > be different and confirm that each is applied separately to each > interface. >- Enable the OpacTopissue system preference. >- View the "Most popular" page in the OPAC. > - The page heading should be correct. > - The OpacAdvancedSearchTypes settings should be reflected in the > "Refine your search" sidebar: If "Collection" is checked, a filter > for collection should appear. If "Item types" is checked, a filter > for item types should appear. > - The output of your search should include collection and item type > regardless of what filters you've submitted. >--- > .../data/mysql/atomicupdate/bug-17018.pl | 13 ++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/opac.pref | 6 ++++++ > .../modules/admin/preferences/searching.pref | 4 ++-- > .../bootstrap/en/includes/opac-topissues.inc | 6 +++--- > .../bootstrap/en/modules/opac-topissues.tt | 21 ++++++++++--------- > opac/opac-search.pl | 2 +- > opac/opac-topissues.pl | 2 +- > 8 files changed, 38 insertions(+), 17 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug-17018.pl > >diff --git a/installer/data/mysql/atomicupdate/bug-17018.pl b/installer/data/mysql/atomicupdate/bug-17018.pl >new file mode 100755 >index 0000000000..58facba735 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-17018.pl >@@ -0,0 +1,13 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "17018", >+ description => "Split AdvancedSearchTypes for staff and OPAC", >+ up => sub { >+ my ($args) = @_; >+ my $dbh = $args->{dbh}; >+ >+ $dbh->do( "INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) SELECT 'OpacAdvancedSearchTypes', `value`, `options`, 'Select which set of fields are available as limits on the OPAC advanced search page', `type` FROM systempreferences WHERE variable = 'AdvancedSearchTypes'" ); >+ >+ }, >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index deaf6b6fc2..9890ab5252 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -389,6 +389,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'), > ('OpacAdvSearchMoreOptions','pubdate,itemtype,language,subtype,sorting,location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'), > ('OpacAdvSearchOptions','pubdate,itemtype,language,sorting,location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'), >+('OpacAdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields are available as limits on the OPAC advanced search page','Choice'), > ('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'), > ('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'), > ('OpacAllowSharingPrivateLists','0',NULL,'If set, allows opac users to share private lists with other patrons','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index a214dae954..fe83eb4a23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -876,6 +876,12 @@ OPAC: > subtype: Subtypes > sorting: Sorting > location: Location and availability >+ - >+ - Show tabs in the OPAC advanced search for limiting searches on the >+ - pref: OpacAdvancedSearchTypes >+ class: long >+ - "fields (separate values with |). Tabs appear in the order listed.<br/>" >+ - "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection, (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)." > Authentication: > - > - pref: OPACShibOnly >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index a0d7ec430d..310a3fe72a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -96,11 +96,11 @@ Searching: > 0: "Don't add" > - search history of the unlogged user to the next patron logging in. > - >- - Show tabs in the OPAC and staff interface advanced search for limiting searches on the >+ - Show tabs in the staff interface advanced search for limiting searches on the > - pref: AdvancedSearchTypes > class: long > - "fields (separate values with |). Tabs appear in the order listed.<br/>" >- - "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection Codes (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)." >+ - "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection, (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)." > - > - Limit the languages listed in the advanced search drop-down to the > - pref: AdvancedSearchLanguages >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 11e0b4cf6d..2deef2e69b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >@@ -25,8 +25,8 @@ > </select></li> > [% END %] > >- [% AdvancedSearchTypes = Koha.Preference('AdvancedSearchTypes').split('\|') %] >- [% IF AdvancedSearchTypes.grep('^itemtypes$').size %] >+ [% OpacAdvancedSearchTypes = Koha.Preference('OpacAdvancedSearchTypes').split('\|') %] >+ [% IF OpacAdvancedSearchTypes.grep('^itemtypes$').size %] > <li> > <label for="itemtype">Limit to: </label> > <select name="itemtype" id="itemtype"> >@@ -44,7 +44,7 @@ > </li> > [% END %] > >- [% IF AdvancedSearchTypes.grep('^ccode$').size %] >+ [% IF OpacAdvancedSearchTypes.grep('^ccode$').size %] > <li> > <label for="ccode">Limit to:</label> > <select name="ccode" id="ccode"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >index 68e9dc3839..6c4b668be8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >@@ -65,9 +65,10 @@ > <div class="col-10 order-first order-md-first order-lg-2"> > <div id="topissues" class="maincontent"> > >- <h1>Top issues</h1> >+ <h1>Most popular</h1> > > [% IF ( results ) %] >+ [% OpacAdvancedSearchTypes = Koha.Preference('OpacAdvancedSearchTypes').split('\|') %] > <table id="topissuest" class="table table-bordered table-striped"> > <caption> > The [% limit | html %] most checked-out >@@ -87,7 +88,8 @@ > <thead> > <tr> > <th class="anti-the">Title</th> >- <th>[% IF ( ccodesearch ) %]Collection[% ELSE %]Item type[% END %]</th> >+ <th>Item type</th> >+ <th>Collection</th> > <th>Checkouts</th> > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > <th class="NoSort"> </th> >@@ -110,13 +112,12 @@ > [% IF ( result.item('size') ) %][% result.item('size') | html %][% END %]</p> > </td> > <td> >- [% IF Koha.Preference('AdvancedSearchTypes') == 'ccode' %] >- <span class="tdlabel">Collection</span> >- [% AuthorisedValues.GetByCode('ccode', result.ccode, 1) | html %] >- [% ELSE %] >- <span class="tdlabel">Item type</span> >- [% ItemTypes.GetDescription(result.itemtype) | html %] >- [% END %] >+ <span class="tdlabel">Item type</span> >+ [% ItemTypes.GetDescription(result.itemtype) | html %] >+ </td> >+ <td> >+ <span class="tdlabel">Collection</span> >+ [% AuthorisedValues.GetByCode('ccode', result.ccode, 1) | html %] > </td> > <td data-order="[% result.count | html %]"> > <span class="tdlabel">Checkouts: </span> >@@ -150,7 +151,7 @@ > <script> > $(function() { > $("#topissuest").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sorting": [[2, "desc"]], >+ "sorting": [[3, "desc"]], > "columnDefs": [ > { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] }, > { "type": "anti-the", "targets" : [ "anti-the" ] } >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 230cc266e9..15fd6e52d2 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -239,7 +239,7 @@ foreach my $itemtype ( keys %{$itemtypes} ) { > my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; > my @advancedsearchesloop; > my $cnt; >-my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; >+my $advanced_search_types = C4::Context->preference("OpacAdvancedSearchTypes") || "itemtypes"; > my @advanced_search_types = split(/\|/, $advanced_search_types); > > my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {}; >diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl >index f185702e32..43830ccfd5 100755 >--- a/opac/opac-topissues.pl >+++ b/opac/opac-topissues.pl >@@ -64,7 +64,7 @@ if (!$do_it && C4::Context->userenv && C4::Context->userenv->{'branch'} ) { > } > my $itemtype = $input->param('itemtype') || ''; > my $timeLimit = $input->param('timeLimit') || 3; >-my $advanced_search_types = C4::Context->preference('AdvancedSearchTypes'); >+my $advanced_search_types = C4::Context->preference('OpacAdvancedSearchTypes'); > my @advanced_search_types = split /\|/, $advanced_search_types; > > my $params = { >-- >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 17018
:
129497
|
129590
|
129604
|
129968
|
130569
|
131783
|
132057
|
132058
|
132799