(bug #2956) fix another results calculation
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Thu, 12 Feb 2009 14:58:35 +0000 (15:58 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 17 Feb 2009 14:51:54 +0000 (15:51 +0100)
this patch fix more about 4XX plugin, for results display and calculation.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
cataloguing/value_builder/unimarc_field_4XX.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tmpl

index b97f27b..3148601 100755 (executable)
@@ -330,7 +330,7 @@ sub plugin {
         my $startfrom      = $query->param('startfrom');
         my $resultsperpage = $query->param('resultsperpage') || 20;
         my $orderby;
-        my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom, $resultsperpage );
+        my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
         my $total = scalar(@$results);
 
         #        warn " biblio count : ".$total;
@@ -414,11 +414,10 @@ sub plugin {
         my $from = $startfrom * $resultsperpage + 1;
         my $to;
 
-        if ( $total < ( ( $startfrom + 1 ) * $resultsperpage ) ) {
-            $to = $total;
-        }
-        else {
-            $to = ( ( $startfrom + 1 ) * $resultsperpage );
+        if ( $total_hits < $from + $resultsperpage ) {
+            $to = $total_hits;
+        }else{
+            $to = $from + $resultsperpage ;
         }
         my $defaultview =
           'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView');
index 0925847..cbcb961 100644 (file)
                                        <th>&nbsp;</th>
                                </tr>
                                <!-- TMPL_LOOP NAME="result" -->
+                               <!-- TMPL_IF NAME="title" -->
                                <tr>
                                     <td<!-- TMPL_IF NAME="even" --> class="hilighted"<!-- /TMPL_IF -->>
                                                             <!-- TMPL_IF name="MARC_ON" -->
                       <!--/TMPL_IF-->
                                        </td>
                                </tr>
+                               <!-- /TMPL_IF -->
                                <!-- /TMPL_LOOP -->
                        </table>
                </div>