@@ -, +, @@ fines in notices also a new attribute that one can include to the text: borrowers.totalfine of fines. --- C4/Letters.pm | 6 ++++++ tools/letter.pl | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) --- a/C4/Letters.pm +++ a/C4/Letters.pm @@ -634,6 +634,12 @@ sub GetPreparedLetter { my $OPACBaseURL = C4::Context->preference('OPACBaseURL'); $letter->{content} =~ s/<>/$OPACBaseURL/go; + my $borrowernumber = $tables->{borrowers}; + my $lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber }); + my ($totalfine) = $lines->total_outstanding; + $totalfine = sprintf("%.2f", $totalfine); + $letter->{content} =~ s/<>/$totalfine/go; + if ($want_librarian) { # parsing librarian name my $userenv = C4::Context->userenv; --- a/tools/letter.pl +++ a/tools/letter.pl @@ -246,7 +246,8 @@ sub add_form { add_fields('items'), {value => 'items.content', text => 'items.content'}, {value => 'items.fine', text => 'items.fine'}, - add_fields('borrowers'); + add_fields('borrowers'), + {value => 'borrowers.totalfine', text => 'borrowers.totalfine' }; if ($module eq 'circulation') { push @{$field_selection}, add_fields('opac_news'); --