Bug 8479 Calculate rank irrespective of display option
[koha.git] / opac / opac-reserve.pl
index 3844bc1..2bbb4be 100755 (executable)
@@ -1,5 +1,8 @@
 #!/usr/bin/perl
 
+# Copyright Katipo Communications 2002
+# Copyright Koha Development team 2012
+#
 # This file is part of Koha.
 #
 # Koha is free software; you can redistribute it and/or modify it under the
@@ -11,9 +14,9 @@
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
 use warnings;
@@ -54,7 +57,7 @@ for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
     m/priority/ and $show_priority = 1;
 }
 
-sub get_out ($$$) {
+sub get_out {
        output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output;
        exit;
 }
@@ -144,22 +147,20 @@ foreach my $biblioNumber (@biblionumbers) {
         $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
     }
 
-    if ($show_holds_count) {
-        # Compute the priority rank.
-        my ( $rank, $reserves ) = GetReservesFromBiblionumber($biblioNumber,1);
-        $biblioData->{reservecount} = 1; # new reserve
-        foreach my $res (@$reserves) {
-            my $found = $res->{'found'};
-            if ( $found && ($found eq 'W') ) {
-                $rank--;
-            }
-            else {
-                $biblioData->{reservecount}++;
-            }
+    # Compute the priority rank.
+    my ( $rank, $reserves ) =
+      GetReservesFromBiblionumber( $biblioNumber, 1 );
+    $biblioData->{reservecount} = 1;    # new reserve
+    foreach my $res (@{$reserves}) {
+        my $found = $res->{found};
+        if ( $found && $found eq 'W' ) {
+            $rank--;
+        }
+        else {
+            $biblioData->{reservecount}++;
         }
-        $rank++;
-        $biblioData->{rank} = $rank;
     }
+    $biblioData->{rank} = $rank + 1;
 }
 
 #