From b88730852bf14124913f0487c32b0c438598e2c0 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 28 Jan 2022 14:59:02 +0200 Subject: [PATCH] Bug 12285: Use accountlines date if issue is not found Printing fines slip would raise error if patron has manually created invoice. In these cases use accountlines date instead of issues date_due. Also silence error: "Argument "" isn't numeric in numeric comparison (<=>)" Sponsored-by: Koha-Suomi Oy Signed-off-by: Owen Leonard --- C4/Members.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 8e2f751cf0..2af537b246 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -708,7 +708,7 @@ sub FineSlip { $item = $item ? $item->unblessed : undef; my $issue = Koha::Checkouts->find({issue_id => $line->issue_id}) || Koha::Old::Checkouts->find({issue_id => $line->issue_id}); - my $dt = dt_from_string( $issue->date_due ); + my $dt = $issue ? dt_from_string( $issue->date_due ) : dt_from_string( $line->date ); $item->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 }); $item->{'amount'} = sprintf('%.2f', $line->amount); @@ -718,7 +718,7 @@ sub FineSlip { push @issueslist, $item; } - my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @issueslist; + my @issues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @issueslist; my %repeat = ( 'fines' => [ map { -- 2.20.1