(bug #3395) fix unimarc plugin 225$a
[koha.git] / cataloguing / addbooks.pl
index e22556a..2f43feb 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl
 
-# $Id$
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -69,7 +68,7 @@ foreach my $thisframeworkcode ( keys %$frameworks ) {
 if ($query) {
 
     # find results
-    my ( $error, $marcresults ) = SimpleSearch($query);
+    my ( $error, $marcresults, $total_hits ) = SimpleSearch($query, $results_per_page * ($page - 1), $results_per_page);
 
     if ( defined $error ) {
         $template->param( error => $error );
@@ -78,26 +77,14 @@ if ($query) {
         exit;
     }
     
-       if(not defined $marcresults){
-               $template->param(query => $query);
-               warn "no result found";
-               output_html_with_http_headers $input, $cookie, $template->output;
-        exit;
-       }
-
     # format output
     my $total = scalar @$marcresults;
-    my @newresults = searchResults( $query, $total, $results_per_page, $page-1, @$marcresults );
+    my @newresults = searchResults( $query, $total, $results_per_page, $page-1, 0, @$marcresults );
     $template->param(
-        total       => $total,
-        query       => $query,
-        resultsloop => \@newresults,
-        pagination_bar => pagination_bar(
-                               "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&",
-                                getnbpages( $total, $results_per_page ),
-               $page,
-                       'page'
-               ),
+        total          => $total_hits,
+        query          => $query,
+        resultsloop    => \@newresults,
+        pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ),
     );
 }
 
@@ -134,6 +121,7 @@ for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
 
 $template->param(
     frameworkcodeloop => \@frameworkcodeloop,
+    breeding_count    => $countbr,
     breeding_loop     => \@breeding_loop,
 );