From 4285c9223e0ea73959910477693ae63c53a46357 Mon Sep 17 00:00:00 2001
From: Srdjan <srdjan@catalyst.net.nz>
Date: Fri, 1 Nov 2013 21:05:09 +1300
Subject: [PATCH] [SIGNED OFF] bug_11183: get rid of some warnings

To test in OPAC:
* With the OPAC System Preference EnableOpacSearchHistory set to Keep,
  a simple search triggers the warning patched on line 626 of opac-search.pl
* Selecting a search result item with no Collection Code set triggers
  the warning patched on line 576 of opac-detail.pl
* Collection Code is set by editing an item in the staff client (952$8)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
---
 opac/opac-detail.pl |    2 +-
 opac/opac-search.pl |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 41de4fd..51d40bc 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -573,7 +573,7 @@ for my $itm (@items) {
 
     # get collection code description, too
     my $ccode = $itm->{'ccode'};
-    $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
+    $itm->{'ccode'} = $collections->{$ccode} if $ccode && $collections && $collections->{$ccode};
     my $copynumber = $itm->{'copynumber'};
     $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
     if ( defined $itm->{'location'} ) {
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 2854da6..8604d0f 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -623,7 +623,7 @@ for (my $i=0;$i<@servers;$i++) {
             my $query_cgi_history = $cgi->url(-query=>1);
             $query_cgi_history =~ s/^$path_info\?//;
             $query_cgi_history =~ s/;/&/g;
-            my $query_desc_history = "$query_desc, $limit_desc";
+            my $query_desc_history = join ", ", grep { defined $_ } $query_desc, $limit_desc;
 
             if (!$borrowernumber || $borrowernumber eq '') {
                 # To a cookie (the user is not logged in)
-- 
1.7.9.5