When using search via commandline scripts, branch facets are sometimes
failing badly.
Not a HASH reference at
C4/Search.pm line 557,
This patch prevents this
---
 C4/Search.pm |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 83a8455..b794f74 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -513,8 +513,17 @@ sub getRecords {
 
                             # if it's a branch, label by the name, not the 
code,
                             if ( $link_value =~ /branch/ ) {
-                                $facet_label_value =
-                                  $branches->{$one_facet}->{'branchname'};
+                                                               if (defined 
$branches 
+                                                                       && 
ref($branches) eq "HASH" 
+                                                                       && 
defined $branches->{$one_facet} 
+                                                                       && ref 
($branches->{$one_facet}) eq "HASH")
+                                                               {
+                                       $facet_label_value =
+                                               
$branches->{$one_facet}->{'branchname'};
+                                                               }
+                                                               else {
+                                                                       
$facet_label_value = "*";
+                                                               }
                             }
 
                             # but we're down with the whole label being in the 
link's title.
-- 
1.6.0.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to