Bug 20832: Fix opac user profile page when there is overdue fine and no rental charge
authorJosef Moravec <josef.moravec@gmail.com>
Tue, 29 May 2018 11:48:14 +0000 (11:48 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 15 Jun 2018 10:10:59 +0000 (10:10 +0000)
Test plan:
0) Do not apply the patch
1) Have an overdue fine linked with specific item currently checked out
to your patron
2) Do not have any unpaid rental fees
3) Go to this patron profile in opac - page opac-user.pl
4) The page crashes with "Can't call method "get_column" on an undefined
value at
/usr/share/koha/opac/cgi-bin/opac/opac-user.pl line 217" in log
5) Apply the patch
6) Restart plack
7) The page should working and show the right amounts for fines

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
opac/opac-user.pl

index 60a5df9..4e54afc 100755 (executable)
@@ -214,7 +214,7 @@ if ( $pending_checkouts->count ) { # Useless test
                 as     => ['rental_fines']
             }
         );
-        $issue->{rentalfines} = $charges->count ? $charges->next->get_column('rental_fines') : 0;
+        $issue->{rentalfines} = $rental_fines->count ? $rental_fines->next->get_column('rental_fines') : 0;
 
         my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} });
         $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'}));