Fix for Bug 4080, OPAC hold screen doesn't obey OPACDisplayRequestPriority pref
[koha.git] / opac / opac-reserve.pl
index be3c77a..675b901 100755 (executable)
@@ -45,7 +45,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
         debug           => 1,
     }
 );
-
+my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
 sub get_out ($$$) {
        output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output;
        exit;
@@ -167,7 +167,7 @@ if ( $query->param('place_reserve') ) {
         my $branch = $query->param('branch');
         $selectedItems = "$bib/$item/$branch/";
     }
-    
+
     my @selectedItems = split /\//, $selectedItems;
 
     # Make sure there is a biblionum/itemnum/branch triplet for each item.
@@ -190,7 +190,7 @@ if ( $query->param('place_reserve') ) {
 
         my $biblioData = $biblioDataHash{$biblioNum};
         my $found;
-        
+
        # Check for user supplied reserve date
        my $startdate;
        if (
@@ -216,7 +216,7 @@ if ( $query->param('place_reserve') ) {
             # Inserts a null into the 'itemnumber' field of 'reserves' table.
             $itemNum = undef;
         }
-        
+
         # Here we actually do the reserveration. Stage 3.
         AddReserve($branch, $borrowernumber, $biblioNum, 'a', [$biblioNum], $rank, $startdate, $notes,
                    $biblioData->{'title'}, $itemNum, $found) if ($canreserve);
@@ -333,12 +333,12 @@ foreach my $biblioNum (@biblionumbers) {
         my $fee = GetReserveFee(undef, $borrowernumber, $itemInfo->{'biblionumber'}, 'a',
                                 ( $itemInfo->{'biblioitemnumber'} ) );
         $itemInfo->{'reservefee'} = sprintf "%.02f", ($fee ? $fee : 0.0);
-        
+
         if ($itemLevelTypes && $itemInfo->{itype}) {
             $itemInfo->{description} = $itemTypes->{$itemInfo->{itype}}{description};
             $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$itemInfo->{itype}}{imageurl};
         }
-        
+
         if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
             $biblioLoopIter{forloan} = 1;
         }
@@ -449,13 +449,13 @@ foreach my $biblioNum (@biblionumbers) {
             $itemLoopIter->{waitingdate} = format_date($wait_hashref->{waitingdate});
         }
        $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
-     
+
     # Show serial enumeration when needed
     if ($itemLoopIter->{enumchron}) {
-        $itemdata_enumchron = 1;    
+        $itemdata_enumchron = 1;
     }
     $template->param( itemdata_enumchron => $itemdata_enumchron );
-        
+
         push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
     }
 
@@ -489,7 +489,7 @@ $template->param(itemtable_colspan => $itemTableColspan);
 
 # display infos
 $template->param(bibitemloop => $biblioLoop);
-
+$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
 # can set reserve date in future
 if (
     C4::Context->preference( 'AllowHoldDateInFuture' ) &&