From fa617c6b8e4a24b6b8da393c36e20a8f90c7823a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 18 Jan 2019 13:18:03 -0500 Subject: [PATCH] Bug 22173: Search Groups broken by change in expected structure The original logic of Search Groups using the heirarchical library groups was to enable search groups on a root group and have each sub group be a search group listed in the pulldown: RootGroup: SearchGroup1: LibraryA LibraryB SearchGroup2: LibraryC LibraryD SearchGroup3: LibraryE LibraryF At some point, the code was changed to expect the each search group to be the root group: RootSearchGroup1: LibraryA LibraryB RootSearchGroup2: LibraryC LibraryD RootSearchGroup3: LibraryE LibraryF It's likely that both styles are being used in production now with different versions. If a library upgrades, their search groups will be broken. If we revert the change, currently up to date libraries will have search groups broken. Instead, we should accommodate both configurations. So, if a root group has libraries as direct children, it should be displayed as a search group. If it does not, we should display the child search groups instead. Test Plan: 1) Set up a root group with multiple subgroups each with libraries, enable staff and opac search groups for that root group 2) Note the root group is displayed in all the search pulldowns instead of the subgroups 3) Apply this patch 4) Restart all the things! 5) Note the search pulldowns now contain the subgroups instead 6) Create another root group, add only libraries to it. Set it as a search group for staff and opac. 7) Note the search pulldowns now contain this group as well! --- .../prog/en/modules/catalogue/advsearch.tt | 12 ++++++++++-- .../opac-tmpl/bootstrap/en/includes/masthead.inc | 16 ++++++++++++---- .../bootstrap/en/modules/opac-advsearch.tt | 10 +++++++++- 3 files changed, 31 insertions(+), 7 deletions(-) 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 e6a143f149..02f3ca511c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt @@ -253,8 +253,16 @@ diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 9466c2d9c6..ae64a909ba 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -232,11 +232,19 @@ [% FOREACH lsg IN LibrarySearchGroups %] - [% IF lsg.id == opac_name %] - + [% IF lsg.libraries %] + [% SET groups = lsg %] [% ELSE %] - - [% END # / bc.selected %] + [% SET groups = lsg.children %] + [% END %] + + [% FOREACH g IN groups %] + [% IF g.id == opac_name %] + + [% ELSE %] + + [% END # / bc.selected %] + [% END %] [% END %] [% END # / BranchCategoriesLoop %] 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 1d7aada994..d27edc0080 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -232,7 +232,15 @@ [% END %] -- 2.17.2 (Apple Git-113)