Bug 17100: Do not display payments if patron has nothing to pay
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 <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> (cherry picked from commit492a64cef9) Signed-off-by: Frédéric Demians <f.demians@tamil.fr> (cherry picked from commit7602198e60) Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
parent
c149dab5e1
commit
0abbcf2c2c
|
|
@ -1,6 +1,7 @@
|
|||
[% USE Koha %]
|
||||
[% USE Branches %]
|
||||
[% USE KohaDates %]
|
||||
[% USE Price %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Summary for [% firstname %] [% surname %] ([% cardnumber %])</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
|
|
@ -71,7 +72,7 @@
|
|||
</table>
|
||||
[% END %]
|
||||
|
||||
[% IF ( accounts && ( totaldue != '0.00' ) ) %]
|
||||
[% IF accounts && ( totaldue < 0 || totaldue > 0 ) %]
|
||||
<table>
|
||||
<caption>Account fines and payments</caption>
|
||||
<tr>
|
||||
|
|
@ -82,23 +83,24 @@
|
|||
</tr>
|
||||
|
||||
[% FOREACH account IN accounts %]
|
||||
[% NEXT IF account.amountoutstanding == '0.00' %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&itemnumber=[% account.itemnumber %]">[% END %]
|
||||
[% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %]
|
||||
[% IF ( account.itemnumber ) %]</a>[% END %]
|
||||
</td>
|
||||
<td>[% account.date | $KohaDates %]</td>
|
||||
<td>[% account.amount %]</td>
|
||||
<td>[% account.amountoutstanding %]</td>
|
||||
</tr>
|
||||
[% IF ( account.amountoutstanding < 0 ) || ( account.amountoutstanding > 0 ) %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&itemnumber=[% account.itemnumber %]">[% END %]
|
||||
[% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %]
|
||||
[% IF ( account.itemnumber ) %]</a>[% END %]
|
||||
</td>
|
||||
<td>[% account.date | $KohaDates %]</td>
|
||||
<td style="text-align:right;">[% account.amount | $Price %]</td>
|
||||
<td style="text-align:right;">[% account.amountoutstanding | $Price %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">Total due</td>
|
||||
<td colspan="2">[% totaldue %]</td>
|
||||
<td colspan="2" style="text-align:right;">[% totaldue | $Price %]</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -43,11 +43,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' )
|
||||
{
|
||||
|
|
@ -56,8 +51,6 @@ foreach my $accountline (@$accts) {
|
|||
}
|
||||
|
||||
our $totalprice = 0;
|
||||
my $total_format = '';
|
||||
$total_format = sprintf( "%.2f", $total ) if ($total);
|
||||
|
||||
$template->param(
|
||||
%$data,
|
||||
|
|
@ -65,7 +58,7 @@ $template->param(
|
|||
borrowernumber => $borrowernumber,
|
||||
|
||||
accounts => $accts,
|
||||
totaldue => $total_format,
|
||||
totaldue => $total,
|
||||
|
||||
issues => build_issue_data( GetPendingIssues($borrowernumber) ),
|
||||
totalprice => $totalprice,
|
||||
|
|
|
|||
Loading…
Reference in New Issue