From 5c1776b71fec3a117ae3ae0f192f8afa5a43c504 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 29 May 2014 11:15:57 -0400 Subject: [PATCH] Bug 6427 [Part 27] - Reimplement bug 11869 - Add more informations to the member printing pages --- C4/Members.pm | 5 +- .../prog/en/modules/members/moremember-print.tt | 79 +++++++++++++------- members/account.pl | 6 +- members/moremember.pl | 22 +++--- 4 files changed, 69 insertions(+), 43 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index b3df466..d530adb 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -354,9 +354,8 @@ sub GetMemberDetails { } my $borrower = $sth->fetchrow_hashref; return unless $borrower; - my ($amount) = GetMemberAccountRecords( $borrowernumber); - $borrower->{'amountoutstanding'} = $amount; - # FIXME - patronflags calls GetMemberAccountRecords... just have patronflags return $amount + $borrower->{amountoutstanding} = $borrower->{account_balance}; + # FIXME - find all references to $borrower->{amountoutstanding}, replace with $borrower->{account_balance} my $flags = patronflags( $borrower); my $accessflagshash; 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 eee5aef..062dc67 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,4 +1,5 @@ [% USE KohaDates %] +[% USE Currency %] [% INCLUDE 'doc-head-open.inc' %] Summary for [% firstname %] [% surname %] ([% cardnumber %]) @@ -91,35 +92,57 @@ [% END %] -[% IF ( accounts && ( totaldue != '0.00' ) ) %] - - - - - - - - - [% FOREACH account IN accounts %] - [% NEXT IF account.amountoutstanding == '0.00' %] - - - - - - +[% IF account_balance %] + [% IF account_debits %] +
Account fines and payments
Description of chargesDateAmountOutstanding
- [% IF ( account.itemnumber ) %][% END %] - [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] - [% IF ( account.itemnumber ) %][% END %] - [% account.date | $KohaDates %][% account.amount %][% account.amountoutstanding %]
+ + + + + + + + [% FOREACH d IN account_debits %] + [% IF d.amount_outstanding > 0 %] + + + + + + + [% END %] + [% END %] + + + + + + +
Account fees
DescriptionDateAmountOutstanding
[% d.description %][% d.created_on | $KohaDates %][% d.amount_original | $Currency %][% d.amount_outstanding | $Currency %]
Total due[% totaldue | $Currency %]
+ [% END %] + + [% FOREACH c IN account_credits %] + [% total_remaining = total_remaining + c.amount_remaining %] + [% END %] + [% IF total_remaining %] + + + + + + + + [% FOREACH c IN account_credits %] + [% IF c.amount_remaining > 0 %] + + + + + + [% END %] + [% END %] +
Account payments
DateAmountBalance remaining
[% c.created_on | $KohaDates %][% c.amount_paid | $Currency %][% c.amount_remaining | $Currency %]
[% END %] - - - Total due - [% totaldue %] - - - [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/members/account.pl b/members/account.pl index 6a9dd9c..af0186f 100755 --- a/members/account.pl +++ b/members/account.pl @@ -47,12 +47,14 @@ my $borrowernumber = $cgi->param('borrowernumber'); my $borrower = GetMember( 'borrowernumber' => $borrowernumber ); -my @debits = Koha::Database->new()->schema->resultset('AccountDebit')->search( +my $schema = Koha::Database->new()->schema(); + +my @debits = $schema->resultset('AccountDebit')->search( { 'me.borrowernumber' => $borrowernumber }, { prefetch => { account_offsets => 'credit' } } ); -my @credits = Koha::Database->new()->schema->resultset('AccountCredit')->search( +my @credits = $schema->resultset('AccountCredit')->search( { 'me.borrowernumber' => $borrowernumber }, { prefetch => { account_offsets => 'debit' } } ); diff --git a/members/moremember.pl b/members/moremember.pl index bde6a82..31dd162 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -232,16 +232,18 @@ $template->param( lib1 => $lib1 ) if ($lib1); $template->param( lib2 => $lib2 ) if ($lib2); # If printing a page, send the account informations to the template -if ($print eq "page") { - foreach my $accountline (@$accts) { - $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; - $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; +if ( $print eq "page" ) { + my $schema = Koha::Database->new()->schema(); - if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){ - $accountline->{printtitle} = 1; - } - } - $template->param( accounts => $accts ); + my @account_debits = $schema->resultset('AccountDebit') + ->search( { borrowernumber => $borrowernumber } ); + my @account_credits = $schema->resultset('AccountCredit') + ->search( { borrowernumber => $borrowernumber } ); + + $template->param( + account_debits => \@account_debits, + account_credits => \@account_credits, + ); } # Show OPAC privacy preference is system preference is set -- 1.7.2.5