Bug 7442 (follow-up) ensuring that summary is display when searching on all types...
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Thu, 18 Jul 2013 16:13:12 +0000 (18:13 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 16 Oct 2014 10:32:01 +0000 (12:32 +0200)
This patch corrects a small bug :

Authorities search on all types does not show summary because it is computed
with selected type (which is empty) instead of using found authority type.

Test plan :
- Go to intranet autorities search
- Perform a search on all authorities types
- Look at results
  => Without this patch, results rows do not display the autority summary, only
     authorized headings

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ebcb64e9fa51fd7f02918d9543abeeac4f8ab46d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

C4/AuthoritiesMarc.pm

index b74d3e4..ed86e8e 100644 (file)
@@ -274,8 +274,6 @@ sub SearchAuthorities {
         my %newline;
         $newline{authid} = $authid;
         if ( !$skipmetadata ) {
-            my $summary =
-              BuildSummary( $authrecord, $authid, GetAuthTypeCode($authid) );
             my $query_auth_tag =
 "SELECT auth_tag_to_report FROM auth_types WHERE authtypecode=?";
             my $sth = $dbh->prepare($query_auth_tag);
@@ -284,15 +282,18 @@ sub SearchAuthorities {
             my $reported_tag;
             my $mainentry = $authrecord->field($auth_tag_to_report);
             if ($mainentry) {
-
                 foreach ( $mainentry->subfields() ) {
                     $reported_tag .= '$' . $_->[0] . $_->[1];
                 }
             }
-            my $thisauthtype = GetAuthType(GetAuthTypeCode($authid));
+            my $thisauthtypecode = GetAuthTypeCode($authid);
+            my $thisauthtype = GetAuthType($thisauthtypecode);
             unless (defined $thisauthtype) {
-                $thisauthtype = GetAuthType($authtypecode) if $authtypecode;
+                $thisauthtypecode = $authtypecode;
+                $thisauthtype = GetAuthType($authtypecode);
             }
+            my $summary = BuildSummary( $authrecord, $authid, $thisauthtypecode );
+
             $newline{authtype}     = defined($thisauthtype) ?
                                         $thisauthtype->{'authtypetext'} : '';
             $newline{summary}      = $summary;