Bug 10006 - holding branch is not available to XSLT display
[koha_fer] / C4 / Breeding.pm
index bb9054e..01aca21 100644 (file)
@@ -243,12 +243,12 @@ sub Z3950Search {
     my $lccn= $pars->{lccn};
     my $lccall= $pars->{lccall};
     my $controlnumber= $pars->{controlnumber};
-
+    my $srchany= $pars->{srchany};
+    my $stdid= $pars->{stdid};
 
     my $show_next       = 0;
     my $total_pages     = 0;
 
-    my $noconnection;
     my $attr = '';
     my $term;
     my $host;
@@ -259,7 +259,6 @@ sub Z3950Search {
     my @encoding;
     my @results;
     my $count;
-    my $toggle;
     my $record;
     my $oldbiblio;
     my @serverhost;
@@ -283,12 +282,10 @@ sub Z3950Search {
         $nterms++;
     }
     if ($title) {
-        utf8::decode($title);
         $query .= " \@attr 1=4 \"$title\" ";
         $nterms++;
     }
     if ($author) {
-        utf8::decode($author);
         $query .= " \@attr 1=1003 \"$author\" ";
         $nterms++;
     }
@@ -297,7 +294,6 @@ sub Z3950Search {
         $nterms++;
     }
     if ($subject) {
-        utf8::decode($subject);
         $query .= " \@attr 1=21 \"$subject\" ";
         $nterms++;
     }
@@ -313,6 +309,14 @@ sub Z3950Search {
         $query .= " \@attr 1=12 \"$controlnumber\" ";
         $nterms++;
     }
+    if($srchany) {
+        $query .= " \@attr 1=1016 \"$srchany\" ";
+        $nterms++;
+    }
+    if($stdid) {
+        $query .= " \@attr 1=1007 \"$stdid\" ";
+        $nterms++;
+    }
     for my $i (1..$nterms-1) {
         $query = "\@and " . $query;
     }
@@ -329,6 +333,7 @@ sub Z3950Search {
             $option1->option( 'password', $server->{password} )
               if $server->{password};
             $option1->option( 'preferredRecordSyntax', $server->{syntax} );
+            $option1->option( 'timeout', $server->{timeout} ) if $server->{timeout};
             $oConnection[$s] = create ZOOM::Connection($option1);
             $oConnection[$s]->connect( $server->{host}, $server->{port} );
             $serverhost[$s] = $server->{host};
@@ -338,7 +343,6 @@ sub Z3950Search {
         }    ## while fetch
     }    # foreach
     my $nremaining  = $s;
-    my $firstresult = 1;
 
     for ( my $z = 0 ; $z < $s ; $z++ ) {
         $oResult[$z] = $oConnection[$z]->search_pqf($query);
@@ -392,6 +396,8 @@ sub Z3950Search {
                             $row_data{lccn}         = $oldbiblio->{lccn};
                             $row_data{title}        = $oldbiblio->{title};
                             $row_data{author}       = $oldbiblio->{author};
+                            $row_data{date}         = $oldbiblio->{copyrightdate};
+                            $row_data{edition}      = $oldbiblio->{editionstatement};
                             $row_data{breedingid}   = $breedingid;
                             $row_data{biblionumber} = $biblionumber;
                             push( @breeding_loop, \%row_data );
@@ -403,29 +409,29 @@ sub Z3950Search {
                 }    #if $numresults
             }
         }    # if $k !=0
-        my $numberpending = $nremaining - 1;
-
-        my @servers = ();
-        foreach my $id (@id) {
-            push(@servers,{id => $id});
-        }
 
         $template->param(
-            breeding_loop => \@breeding_loop,
-            server        => $servername[$k],
-            numberpending => $numberpending,
+            numberpending => $nremaining,
             current_page => $page,
-            servers => \@servers,
             total_pages => $total_pages,
             show_nextbutton => $show_next?1:0,
             show_prevbutton => $page!=1,
         );
-        $firstresult++;
     } # while nremaining
 
+    #close result sets and connections
+    foreach(0..$s-1) {
+        $oResult[$_]->destroy();
+        $oConnection[$_]->destroy();
+    }
+
+    my @servers = ();
+    foreach my $id (@id) {
+        push @servers, {id => $id};
+    }
     $template->param(
         breeding_loop => \@breeding_loop,
-        numberpending => $nremaining > 0 ? $nremaining : 0,
+        servers => \@servers,
         errconn       => \@errconn
     );
 }