Bug 9801 - location facet shows even if no locations
Summary: location facet shows even if no locations
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact:
URL:
Keywords:
: 10479 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-03-12 17:01 UTC by Nicole C. Engard
Modified: 2014-12-07 20:02 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
locations label (13.49 KB, image/png)
2013-03-12 17:01 UTC, Nicole C. Engard
Details
Bug 9801 - location facet shows even if no locations (2.52 KB, patch)
2013-06-27 06:08 UTC, David Cook
Details | Diff | Splinter Review
[SIGNED OFF] Bug 9801 - location facet shows even if no locations (2.87 KB, patch)
2013-07-07 17:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 9801 - location facet shows even if no locations (2.92 KB, patch)
2013-07-12 17:30 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2013-03-12 17:01:54 UTC
Created attachment 16068 [details]
locations label

When in a single library the branches filter is replaced by locations - but if you have no shelving locations you still see the label for locations and shouldn't.
Comment 1 Owen Leonard 2013-03-20 18:30:33 UTC
Facets are built in Search.pm, so I'm recategorizing this bug.
Comment 2 Katrin Fischer 2013-06-26 05:37:23 UTC
*** Bug 10479 has been marked as a duplicate of this bug. ***
Comment 3 David Cook 2013-06-27 06:08:59 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2013-07-07 17:27:27 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2013-07-12 17:30:26 UTC
Created attachment 19610 [details] [review]
Bug 9801 - location facet shows even if no locations

Currently, the headings for facets (such as location) are showing even
if there are no actual values/links for that facet type.

This patch simply checks if the facet array contains any facets before
printing the heading and HTML for each facet value/link.

Test Plan:

Before applying:

0) If you want to check the location facet (which is easiest),
enable singlebranch  mode in the globals system preferences.

1) Do a search for records/items that you have no shelving location
specified (or simply remove the shelving location for a small range
of records that you can find in a search query).

2) Note that "Location" appears amongst the facets even though there
are no values/links present. (If you look at the HTML source, you'll
see some empty HTML tags have been printed out.)

Apply patch.

3) Flush your cache and refresh your page.
4) You should no longer see a "Location" facet (or those empty HTML
tags) on the facet sidebar.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template changes only.
Checked according to test plan, made sure location facet
still shows up when values exist, otherwise it's hidden.

It might make sense to add ids to the facets so libraries
can decide to hide some of them easily. Or alternatively
add a system preference to make that possible.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Galen Charlton 2013-07-19 00:32:09 UTC
Pushed to master.  Thanks, David!
Comment 7 Tomás Cohen Arazi 2013-08-14 14:30:26 UTC
This patch has been pushed to 3.12.x, will be in 3.12.4.

Thanks David!
Comment 8 Bernardo Gonzalez Kriegel 2013-09-13 21:25:59 UTC
Pushed to 3.10.x, will be in 3.10.11
Comment 9 Chris Hall 2013-09-15 08:01:53 UTC
Pushed to 3.8.x, will be in 3.8.18