Bug 5002: Show all patron categories after insert
[koha.git] / acqui / z3950_search.pl
index 647db8c..e30901a 100755 (executable)
@@ -28,10 +28,10 @@ use C4::Output;
 use C4::Context;
 use C4::Breeding;
 use C4::Koha;
-use C4::Bookseller qw/ GetBookSellerFromId /;
+
+use Koha::Acquisition::Bookseller;
 
 my $input           = new CGI;
-my $dbh             = C4::Context->dbh;
 my $biblionumber    = $input->param('biblionumber')||0;
 my $frameworkcode   = $input->param('frameworkcode')||'';
 my $title           = $input->param('title');
@@ -63,14 +63,13 @@ foreach my $thisframeworkcode ( keys %$frameworks ) {
     push @frameworkcodeloop, \%row;
 }
 
-my $vendor = GetBookSellerFromId($booksellerid);
+my $vendor = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
-        template_name   => "acqui/z3950_search.tmpl",
+        template_name   => "acqui/z3950_search.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 1,
         flagsrequired   => { acquisition => 'order_manage' },
     }
 );
@@ -93,11 +92,16 @@ $template->param(
 );
 
 if ( $op ne "do_search" ) {
-    my $sth = $dbh->prepare("select id,host,name,checked from z3950servers  order by host");
-    $sth->execute();
-    my $serverloop = $sth->fetchall_arrayref( {} );
+    my $schema = Koha::Database->new()->schema();
+    my $rs = $schema->resultset('Z3950server')->search(
+        {
+            recordtype => 'biblio',
+            servertype => ['zed', 'sru'],
+        },
+        { result_class => 'DBIx::Class::ResultClass::HashRefInflator' },
+    );
     $template->param(
-        serverloop   => $serverloop,
+        serverloop   => [ $rs->all ],
         opsearch     => "search",
     );
     output_html_with_http_headers $input, $cookie, $template->output;