From 3172dc1a0d56484399385adf1cc6ab0bdc293480 Mon Sep 17 00:00:00 2001
From: Jared Camins-Esakov <jcamins@cpbibliography.com>
Date: Tue, 13 Nov 2012 11:02:24 -0500
Subject: [PATCH] Bug 9070: authority searches in auth_finder error out

When using authority records imported into Koha from elsewhere, you
can get an error like:
    Can't use string ("HASH(0xbc6c{30)") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/AuthoritiesMarc.pm line 363.
in authorities/auth_finder.pl. This patch fixes that error.

To test:
1) You will need records imported from elsewhere.
2) Use the authority control plugin in a bib record to search for one of
   those headings.
3) Observe you get a nasty error.
4) Apply patch.
5) Repeat step 2.
6) Observe the error is gone.
7) Sign off.
---
 C4/AuthoritiesMarc.pm |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index db340ba..c8183c1 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -359,8 +359,10 @@ sub SearchAuthorities {
                     }
                 }
                 my $thisauthtype = GetAuthType(GetAuthTypeCode($authid));
-                $thisauthtype |= GetAuthType($authtypecode) if $authtypecode;
-                $newline{authtype}     = defined ($thisauthtype) ?
+                unless (defined $thisauthtype) {
+                    $thisauthtype = GetAuthType($authtypecode) if $authtypecode;
+                }
+                $newline{authtype}     = defined($thisauthtype) ?
                                             $thisauthtype->{'authtypetext'} : '';
                 $newline{summary}      = $summary;
                 $newline{even}         = $counter % 2;
-- 
1.7.9.5