display library name instead of code in limit description
authorGalen Charlton <galen.charlton@liblime.com>
Wed, 25 Feb 2009 19:29:41 +0000 (13:29 -0600)
committerGalen Charlton <galen.charlton@liblime.com>
Fri, 27 Feb 2009 21:11:37 +0000 (15:11 -0600)
The OPAC and staff search results page will now display
the library name instead of the library code in the limit
part of the search description, e.g.,

"kw,wrdl: cat branch:Centerville" instead of
"kw,wrdl: cat branch:CPL"

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/Search.pm

index c3b715a..8bcf238 100644 (file)
@@ -26,6 +26,7 @@ use C4::Search::PazPar2;
 use XML::Simple;
 use C4::Dates qw(format_date);
 use C4::XSLT;
+use C4::Branch;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
@@ -1125,7 +1126,17 @@ sub buildQuery {
             $limit .= " and " if $limit || $query;
             $limit      .= "$this_limit";
             $limit_cgi  .= "&limit=$this_limit";
-            $limit_desc .= " $this_limit";
+            if ($this_limit =~ /^branch:(.+)/) {
+                my $branchcode = $1;
+                my $branchname = GetBranchName($branchcode);
+                if (defined $branchname) {
+                    $limit_desc .= " branch:$branchname";
+                } else {
+                    $limit_desc .= " $this_limit";
+                }
+            } else {
+                $limit_desc .= " $this_limit";
+            }
         }
     }
     if ($group_OR_limits) {