@@ -, +, @@ --- C4/Letters.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/C4/Letters.pm +++ a/C4/Letters.pm @@ -675,11 +675,13 @@ sub GetPreparedLetter { my $currency_format = (defined($active_currency)) ? $active_currency->currency : undef; my $borrowernumber = $tables->{borrowers}; - my $lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber }); - my ($totalfine) = $lines->total_outstanding; - my $totalfine_formatted = currency_format($currency_format, "$totalfine", FMT_SYMBOL); - $totalfine_formatted = sprintf("%.2f", $totalfine) unless $totalfine_formatted; - $letter->{content} =~ s/<>/$totalfine_formatted/go; + if($borrowernumber && !ref($borrowernumber)){ + my $lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber }); + my ($totalfine) = $lines->total_outstanding; + my $totalfine_formatted = currency_format($currency_format, "$totalfine", FMT_SYMBOL); + $totalfine_formatted = sprintf("%.2f", $totalfine) unless $totalfine_formatted; + $letter->{content} =~ s/<>/$totalfine_formatted/go; + } if ($want_librarian) { # parsing librarian name --