(bug #4522) fix plugin unimarc 210$c
[koha.git] / cataloguing / value_builder / unimarc_field_210c.pl
index 6779999..431011b 100755 (executable)
@@ -138,9 +138,10 @@ my ($input) = @_;
                                             $startfrom*$resultsperpage, $resultsperpage,$authtypecode, $orderby);
 
        # Getting the $b if it exists
-       foreach my $_ (@$results) {
-               if ($_->{reported_tag} =~ m/^\$b/) {
-                   $_->{to_report} = substr($_->{reported_tag}, 2);
+       for (@$results) {
+           my $authority = GetAuthority($_->{authid});
+               if ($authority->field('200') and $authority->subfield('200','b')) {
+                   $_->{to_report} = $authority->subfield('200','b');
            }
        }
 
@@ -183,7 +184,7 @@ my ($input) = @_;
             $to = (($startfrom+1)*$resultsperpage);
         }
         my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&authtypecode=EDITORS&and_or=$and_or&marclist=$marclist&operator=$operator&orderby=$orderby&excluding=$excluding&".join("&",map {"value=".$_} @value)."&op=do_search&type=intranet&index=$index";
-        warn "$link ,".getnbpages($total, $resultsperpage);
+
         $template->param(result => $results) if $results;
         $template->param('index' => $query->param('index'));
         $template->param(startfrom=> $startfrom,