From a899043b299d98a9160c7ae2e6cd5469e339017b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 25 Aug 2015 06:14:15 +0000 Subject: [PATCH] Bug 13961: Option to include patron's total amount of fines in notices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Possibility to show patrons's total amount of fines in notices. Test plan: 1. Apply patch 2. Modify some notice in Tools -> notices & slips 3. See that in the left side of where one can edit message's body is now also a new attribute that one can include to the text: borrowers.totalfine 4. Include that to the text and see it showing the patron's total amount of fines. Sponsored-by: Vaara-kirjastot Followed test plan, works as expected. Signed-off-by: Marc VĂ©ron --- C4/Letters.pm | 4 ++++ tools/letter.pl | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index f327890..2570081 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -660,6 +660,10 @@ sub GetPreparedLetter { my $OPACBaseURL = C4::Context->preference('OPACBaseURL'); $letter->{content} =~ s/<>/$OPACBaseURL/go; + my ($totalfine) = C4::Members::GetMemberAccountRecords($tables->{borrowers}); + $totalfine = sprintf("%.2f", $totalfine); + $letter->{content} =~ s/<>/$totalfine/go; + if ($want_librarian) { # parsing librarian name my $userenv = C4::Context->userenv; diff --git a/tools/letter.pl b/tools/letter.pl index 293072f..264db14 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -225,7 +225,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'); -- 1.7.10.4