Bug 12336 - [SIGNED-OFF] Author of reserved book is not displayed in opac-user.pl
[koha_fer] / opac / opac-user.pl
index eed4439..beba580 100755 (executable)
@@ -64,7 +64,11 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     }
 );
 
-my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
+my $show_priority;
+for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
+    m/priority/ and $show_priority = 1;
+}
+
 my $patronupdate = $query->param('patronupdate');
 my $canrenew = 1;
 
@@ -106,6 +110,7 @@ if (  C4::Context->preference( 'OpacRenewalAllowed' ) && $borr->{amountoutstandi
     $canrenew = 0;
     $template->param(
         renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
+        renewal_blocked_fines_amountoutstanding => sprintf( '%.02f', $borr->{amountoutstanding} ),
     );
 }
 
@@ -158,7 +163,7 @@ my $issues = GetPendingIssues($borrowernumber);
 if ($issues){
     foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
         # check for reserves
-        my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
+        my $restype = GetReserveStatus( $issue->{'itemnumber'} );
         if ( $restype ) {
             $issue->{'reserved'} = 1;
         }
@@ -170,6 +175,8 @@ if ($issues){
                 $charges += $ac->{'amountoutstanding'}
                   if $ac->{'accounttype'} eq 'F';
                 $charges += $ac->{'amountoutstanding'}
+                  if $ac->{'accounttype'} eq 'FU';
+                $charges += $ac->{'amountoutstanding'}
                   if $ac->{'accounttype'} eq 'L';
             }
         }
@@ -272,8 +279,10 @@ foreach my $res (@reserves) {
     $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
     my $biblioData = GetBiblioData($res->{'biblionumber'});
     $res->{'reserves_title'} = $biblioData->{'title'};
-    if ($OPACDisplayRequestPriority) {
-        $res->{'priority'} = '' if $res->{'priority'} eq '0';
+    $res->{'author'} = $biblioData->{'author'};
+
+    if ($show_priority) {
+        $res->{'priority'} ||= '';
     }
     $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
 }
@@ -283,7 +292,7 @@ foreach my $res (@reserves) {
 
 $template->param( RESERVES       => \@reserves );
 $template->param( reserves_count => $#reserves+1 );
-$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
+$template->param( showpriority=>$show_priority );
 
 my @waiting;
 my $wcount = 0;