@@ -, +, @@
---
C4/Members.pm | 5 +-
.../prog/en/modules/members/moremember-print.tt | 85 ++++++++++++-------
members/account.pl | 6 +-
members/moremember.pl | 22 +++---
4 files changed, 72 insertions(+), 46 deletions(-)
--- a/C4/Members.pm
+++ a/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;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
@@ -1,13 +1,14 @@
[% USE KohaDates %]
+[% USE Currency %]
[% INCLUDE 'doc-head-open.inc' %]
Summary for [% firstname %] [% surname %] ([% cardnumber %])
@@ -91,35 +92,57 @@
[% END %]
-[% IF ( accounts && ( totaldue != '0.00' ) ) %]
-
- Account fines and payments
-
- Description of charges |
- Date |
- Amount |
- Outstanding |
-
- [% FOREACH account IN accounts %]
- [% NEXT IF account.amountoutstanding == '0.00' %]
-
-
- [% 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_balance %]
+ [% IF account_debits %]
+
+ Account fees
+
+ Description |
+ Date |
+ Amount |
+ Outstanding |
+
+ [% FOREACH d IN account_debits %]
+ [% IF d.amount_outstanding > 0 %]
+
+ [% d.description %] |
+ [% d.created_on | $KohaDates %] |
+ [% d.amount_original | $Currency %] |
+ [% d.amount_outstanding | $Currency %] |
+
+ [% END %]
+ [% END %]
+
+
+ Total due |
+ [% totaldue | $Currency %] |
+
+
+
+ [% END %]
+
+ [% FOREACH c IN account_credits %]
+ [% total_remaining = total_remaining + c.amount_remaining %]
+ [% END %]
+ [% IF total_remaining %]
+
+ Account payments
+
+ Date |
+ Amount |
+ Balance remaining |
+
+ [% FOREACH c IN account_credits %]
+ [% IF c.amount_remaining > 0 %]
+
+ [% c.created_on | $KohaDates %] |
+ [% c.amount_paid | $Currency %] |
+ [% c.amount_remaining | $Currency %] |
+
+ [% END %]
+ [% END %]
+
[% END %]
-
-
- Total due |
- [% totaldue %] |
-
-
-
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]
--- a/members/account.pl
+++ a/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' } }
);
--- a/members/moremember.pl
+++ a/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
--