From 5c9855b85f74ac1d6a806ced7f4237bfcea4002e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com>
Date: Thu, 27 Feb 2014 15:54:01 -0500
Subject: [PATCH] Add more informations to the account printing pages.

---
 .../prog/en/modules/members/moremember-print.tt    |   36 ++++++++++++++++++++
 .../prog/en/modules/members/moremember-receipt.tt  |    4 +-
 members/moremember.pl                              |   14 ++++++++
 3 files changed, 52 insertions(+), 2 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 4642628..8b36afd 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
@@ -23,6 +23,12 @@
 <li>[% IF ( email ) %][% email %][% ELSE %](no primary email on file)[% END %]</li>
 [% IF ( emailpro ) %]<li>[% emailpro %]</li>[% END %]
 </ul>
+<ul>
+<li>Registration date: [% dateenrolled %]</li>
+<li>Expiration date: [% dateexpiry %]</li>
+<li>Library: [% branchname %]</li>
+<li>Category: [% description %]</li>
+</ul>
 
 [% IF ( issueloop ) %]
 <table>
@@ -86,4 +92,34 @@
 </table>
 [% END %]
 
+[% IF ( accounts ) %]
+<table>
+    <caption>Account fines and payments</caption>
+    <tr>
+        <th>Description of charges</th>
+        <th>Date</th>
+        <th>Amount</th>
+        <th>Outstanding</th>
+    </tr>
+    [% FOREACH account IN accounts %]
+    <tr>
+        <td>
+            [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% END %]
+            [% account.description %]&nbsp;[% IF ( account.printtitle ) %] [% account.title |html %][% END %]
+            [% IF ( account.itemnumber ) %]</a>[% END %]
+        </td>
+        <td>[% account.date %]</td>
+        <td>[% account.amount %]</td>
+        <td>[% account.amountoutstanding %]</td>
+    </tr>
+    [% END %]
+    <tfoot>
+        <tr>
+            <td colspan="3">Total due</td>
+            <td colspan="2">[% totaldue %]</td>
+        </tr>
+    </tfoot>
+</table>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
index 80d3dc0..b843449 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt
@@ -18,9 +18,9 @@
 <h3>[% LibraryName %]</h3>
 [% IF ( branchname ) %][% branchname %]<br />[% END %]
 Checked out to [% firstname %] [% surname %] <br />
-(<a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">[% cardnumber %]</a>)<br />
-
+Address: [% address %]<br />
 [% todaysdate %]<br />
+(<a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">[% cardnumber %]</a>)<br />
 
 [% IF ( quickslip ) %]
 <h4>Checked out today</h4>
diff --git a/members/moremember.pl b/members/moremember.pl
index 86c61c1..58136f5 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -229,6 +229,20 @@ my $lib2 = &GetSortDetails( "Bsort2", $data->{'sort2'} );
 $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->{date} = C4::Dates::format_date($accountline->{date});
+        $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
+        $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
+
+        if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){
+            $accountline->{printtitle} = 1;
+        }
+    }
+    $template->param( accounts => $accts );
+}
+
 # Show OPAC privacy preference is system preference is set
 if ( C4::Context->preference('OPACPrivacy') ) {
     $template->param( OPACPrivacy => 1);
-- 
1.7.2.5