Bug 19537: (QA follow-up) Consistent structures
[koha.git] / authorities / blinddetail-biblio-search.pl
index cab9c74..9e7930d 100755 (executable)
@@ -58,14 +58,6 @@ my $authid       = $query->param('authid');
 my $index        = $query->param('index');
 my $tagid        = $query->param('tagid');
 my $relationship = $query->param('relationship');
-my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
-my $tagslib      = &GetTagsLabels( 1, $authtypecode );
-
-my $auth_type = Koha::Authority::Types->find($authtypecode);
-my $record;
-if ($authid) {
-    $record = GetAuthority($authid);
-}
 
 # open template
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@@ -82,6 +74,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 my @subfield_loop;
 my ($indicator1, $indicator2);
 if ($authid) {
+    my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
+    my $auth_type = Koha::Authority::Types->find($authtypecode);
+    my $record = GetAuthority($authid);
     my @fields = $record->field( $auth_type->auth_tag_to_report );
     my $repet = ($query->param('repet') || 1) - 1;
     my $field = $fields[$repet];
@@ -127,9 +122,9 @@ if ($authid) {
             $indicator2 = defined $thes_mapping{$thes_008_11} ? $thes_mapping{$thes_008_11} : $thes_008_11;
             if ($indicator2 eq '7') {
                 if ($thes_008_11 eq 'r') {
-                    $subfields{'2'} = ['aat'];
+                    push @subfield_loop, { marc_subfield => '2', marc_values => [ 'aat' ] };
                 } elsif ($thes_008_11 eq 's') {
-                    $subfields{'2'} = ['sears'];
+                    push @subfield_loop, { marc_subfield => '2', marc_values => [ 'sears' ] };
                 }
             }
         }