[Koha-patches] [PATCH] Bug 10078 - show location facet for all

Srdjan srdjan at catalyst.net.nz
Mon Aug 5 08:14:11 CEST 2013


From: David Cook <dcook at prosentient.com.au>

Currently, the location facet only shows if you have singlebranch
mode enabled. In other words, you can either see the library branch
or the shelving location.

This patch simply changes the location facet so that it will always
show the shelving location (if one is available), regardless of the
singlebranch system preference.

Test Plan:

BEFORE APPLYING:

0) Disable singlebranch mode if it is on
1) Do an OPAC or Staff Client search for a record that has items with
shelving locations.
2) Note that you can see the library branch facet under Libraries
but no shelving locations.
3) Enable singlebranch mode
4) Repeat your search
5) Note that you can no longer see the library branch facet under
Libraries. However, you can see the shelving location under Location

N.B. If you don't have more than one branch or the search results
are all from one branch, you might not get a library branch facet.

If this is the case, create additional branches and/or change the
branch for items in your search results so that you have multiple
branches to prompt the appearance of a library branch facet.

AFTER APPLYING

1) Do an OPAC or Staff Client search for a record that has items with
shelving locations.
2) Note that you see a facet under Location on the left sidebar,
regardless of there being a singlebranch mode or the number of branches
there are being represented in the search results.

Signed-off-by: Srdjan <srdjan at catalyst.net.nz>
---
 C4/Koha.pm | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/C4/Koha.pm b/C4/Koha.pm
index ea8c2a6..1021ef2 100644
--- a/C4/Koha.pm
+++ b/C4/Koha.pm
@@ -730,6 +730,11 @@ sub getFacets {
                 tags  => [ qw/ 225a / ],
                 sep   => ', ',
             },
+            {
+                idx  => 'location',
+                label => 'Location',
+                tags        => [ qw/ 995c / ],
+            }
             ];
 
             my $library_facet;
@@ -739,12 +744,6 @@ sub getFacets {
                     label => 'Libraries',
                     tags        => [ qw/ 995b / ],
                 };
-            } else {
-                $library_facet = {
-                    idx  => 'location',
-                    label => 'Location',
-                    tags        => [ qw/ 995c / ],
-                };
             }
             push( @$facets, $library_facet );
     }
@@ -792,6 +791,11 @@ sub getFacets {
                 tags  => [ qw/ 952y 942c / ],
                 sep   => ', ',
             },
+            {
+                idx => 'location',
+                label => 'Location',
+                tags => [ qw / 952c / ],
+            },
             ];
 
             my $library_facet;
@@ -801,12 +805,6 @@ sub getFacets {
                     label => 'Libraries',
                     tags        => [ qw / 952b / ],
                 };
-            } else {
-                $library_facet = {
-                    idx => 'location',
-                    label => 'Location',
-                    tags => [ qw / 952c / ],
-                };
             }
             push( @$facets, $library_facet );
     }
-- 
1.8.1.2


More information about the Koha-patches mailing list