[Koha-patches] [PATCH] display library name instead of code in limit description

Galen Charlton galen.charlton at liblime.com
Wed Feb 25 20:29:41 CET 2009


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"
---
 C4/Search.pm |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index c3b715a..8bcf238 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -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) {
-- 
1.5.5.GIT




More information about the Koha-patches mailing list