From 7602198e60e0a43c1d35164db2c49d26412bfc08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Wed, 10 Aug 2016 11:42:28 +0200 Subject: [PATCH] Bug 17100: Do not display payments if patron has nothing to pay MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This alternative patch moves logic and formatting to the template file. To test: * without patch 1/ find a patron with no lines in accountlines table : print summary shows no "account fines and payments" => OK 2/ find a patron with some lines in accountlines table and the total amount > 0 : print summary shows a table "account fines and payments" with fines to recover => OK 3/ find a patron with some lines in accountlines table but the total amount = 0 : print summary shows a table "account fines and payments" with nothing in it => NOK * with the patch, same cases as before : 1/ same as without patch 2/ same as without patch 3/ print summary does not show "account fines and payments" - Additionally, verify that formatting follows syspref 'CurrencyFormat' - Verify that amount column is right-aligned Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 492a64cef95c6afb1644cbb4f1be181c2442cbd8) Signed-off-by: Frédéric Demians --- .../en/modules/members/moremember-print.tt | 29 ++++++++++--------- members/summary-print.pl | 9 +----- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt index f0877608fc..93b59d402b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -1,6 +1,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] +[% USE Price %] [% INCLUDE 'doc-head-open.inc' %] Summary for [% firstname %] [% surname %] ([% cardnumber %]) [% INCLUDE 'doc-head-close.inc' %] @@ -93,8 +94,7 @@ [% END %] [% END %] - - [% IF ( accounts && ( totaldue != '0.00' ) ) %] + [% IF accounts && ( totaldue < 0 || totaldue > 0 ) %] @@ -105,23 +105,24 @@ [% FOREACH account IN accounts %] - [% NEXT IF account.amountoutstanding == '0.00' %] - - - - - - + [% IF ( account.amountoutstanding < 0 ) || ( account.amountoutstanding > 0 ) %] + + + + + + + [% END %] [% END %] - +
Account fines and payments
- [% IF ( account.itemnumber ) %][% END %] - [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] - [% IF ( account.itemnumber ) %][% END %] - [% account.date | $KohaDates %][% account.amount %][% account.amountoutstanding %]
+ [% IF ( account.itemnumber ) %][% END %] + [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] + [% IF ( account.itemnumber ) %][% END %] + [% account.date | $KohaDates %][% account.amount | $Price %][% account.amountoutstanding | $Price %]
Total due[% totaldue %][% totaldue | $Price %]
diff --git a/members/summary-print.pl b/members/summary-print.pl index f1933f5961..82b1ca24dc 100755 --- a/members/summary-print.pl +++ b/members/summary-print.pl @@ -46,11 +46,6 @@ my $data = GetMember( 'borrowernumber' => $borrowernumber ); my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); foreach my $accountline (@$accts) { - $accountline->{amount} = sprintf( '%.2f', $accountline->{amount} ) - if ( $accountline->{amount} ) ; - $accountline->{amountoutstanding} = sprintf( '%.2f', $accountline->{amountoutstanding} ) - if ( $accountline->{amountoutstanding} ); - if ( $accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU' ) { @@ -59,8 +54,6 @@ foreach my $accountline (@$accts) { } our $totalprice = 0; -my $total_format = ''; -$total_format = sprintf( "%.2f", $total ) if ($total); my $holds_rs = Koha::Holds->search( { borrowernumber => $borrowernumber }, @@ -72,7 +65,7 @@ $template->param( borrowernumber => $borrowernumber, accounts => $accts, - totaldue => $total_format, + totaldue => $total, issues => build_issue_data( GetPendingIssues($borrowernumber) ), totalprice => $totalprice, -- 2.39.5