Jonathan Druart
51aa6db46c
The GetMemberAccountRecords may be a perf killer, it retrieves all the account lines of a patron and then the related item and biblio information. Most of the time we only want to know how much the patron owns to the library (sum of amountoutstanding). We already have this information in Koha::Patron->account->balance. This patch replaces the occurrences of this subroutine by fetching only the information we need, either the balance, the detail, or both. It removes the formatting done in the module, to use the TT plugin 'Price' instead. There is a very weird and error-prone behavior/feature in GetMemberAccountBalance (FIXME): as the accountlines.accounttype is a varchar(5), the value of the authorised value used for the ManInvInNoissuesCharge pref (category MANUAL_INV) is truncated to the 5 first characters. That could lead to unexpected behaviors. On the way, this patchset also replace the GetMemberAccountBalance subroutine, which returns the balance, the non issues charges and the other charges. We only need to have the balance and the non issues charges to calcul the third one. Test plan: Add several fees for a patron and play with HoldsInNoissuesCharge, RentalsInNoissuesCharge and ManInvInNoissuesCharge. The information (biblio and item info, as well as the account line) must be correctly displayed on the different screens: 'Fines' module, fine slips, circulation module Note that this patchset could introduce regression on price formatting, but will be easy to fix using the TT plugin. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
160 lines
7.1 KiB
Text
160 lines
7.1 KiB
Text
[% USE Koha %]
|
|
[% USE KohaDates %]
|
|
[% USE ColumnsSettings %]
|
|
[% USE Price %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
|
|
</head>
|
|
|
|
<body id="pat_borraccount" class="pat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Account for [% INCLUDE 'patron-title.inc' %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'members-toolbar.inc' %]
|
|
<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" /></form>
|
|
|
|
<!-- The manual invoice and credit buttons -->
|
|
<div class="statictabs">
|
|
<ul>
|
|
<li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a></li>
|
|
<li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a></li>
|
|
<li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a></li>
|
|
<li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a></li>
|
|
</ul>
|
|
<div class="tabs-container">
|
|
<!-- The table with the account items -->
|
|
<table id="table_account_fines">
|
|
<thead>
|
|
<tr>
|
|
<th class="title-string">Date</th>
|
|
<th>Description of charges</th>
|
|
<th>Note</th>
|
|
<th>Amount</th>
|
|
<th>Outstanding</th>
|
|
[% IF ( reverse_col ) %]
|
|
<th>Actions</th>
|
|
[% ELSE %]
|
|
<th> </th>
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
|
|
<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
|
|
[% FOREACH account IN accounts %]
|
|
|
|
<tr>
|
|
<td><span title="[% account.date %]">[% account.date |$KohaDates %]</span></td>
|
|
<td>
|
|
[% SWITCH account.accounttype %]
|
|
[% CASE 'Pay' %]Payment, thanks
|
|
[% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
|
|
[% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
|
|
[% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
|
|
[% CASE 'N' %]New card
|
|
[% CASE 'F' %]Fine
|
|
[% CASE 'A' %]Account management fee
|
|
[% CASE 'M' %]Sundry
|
|
[% CASE 'L' %]Lost item
|
|
[% CASE 'W' %]Writeoff
|
|
[% CASE 'FU' %]Accruing fine
|
|
[% CASE 'HE' %]Hold waiting too long
|
|
[% CASE 'Rent' %]Rental fee
|
|
[% CASE 'FOR' %]Forgiven
|
|
[% CASE 'LR' %]Lost item fee refund
|
|
[% CASE 'PF' %]Processing fee
|
|
[% CASE 'PAY' %]Payment
|
|
[% CASE 'WO' %]Writeoff
|
|
[% CASE 'C' %]Credit
|
|
[% CASE 'CR' %]Credit
|
|
[% CASE %][% account.accounttype %]
|
|
[%- END -%]
|
|
[%- IF account.description %], [% account.description %][% END %]
|
|
[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber %]&itemnumber=[% account.itemnumber %]">[% account.item.biblio.title |html %]</a>[% END %]</td>
|
|
<td>[% account.note | html_line_break %]</td>
|
|
[% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
|
|
[% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
|
|
<td class="actions">
|
|
[% IF ( account.payment ) %]
|
|
<a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
|
|
[% ELSE %]
|
|
<a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
|
|
[% END %]
|
|
[% IF ( reverse_col) %]
|
|
[% IF ( account.payment ) %]
|
|
<a href="boraccount.pl?action=reverse&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
|
|
[% ELSE %][% SET footerjs = 1 %]
|
|
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
|
|
[% END %]
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="4">Total due</td>
|
|
[% IF ( totalcredit ) %]
|
|
<td class="credit" style="text-align: right;">[% total | $Price %]</td>
|
|
[% ELSE %]
|
|
<td class="debit"style="text-align: right;">[% total | $Price %]</td>
|
|
[% END %]
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-b">
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% INCLUDE 'columns_settings.inc' %]
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
|
|
<script type="text/javascript">
|
|
var dateformat = "[% Koha.Preference('dateformat') %]";
|
|
$(document).ready(function() {
|
|
var txtActivefilter = _("Filter paid transactions");
|
|
var txtInactivefilter = _("Show all transactions");
|
|
var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') %];
|
|
var table_account_fines = KohaTable("table_account_fines", {
|
|
"sPaginationType": "four_button",
|
|
'aaSorting': [[0, 'desc']],
|
|
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
|
|
"aoColumnDefs": [
|
|
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
|
|
{ "bSortable": false, "bSearchable": false, "aTargets": [-1] }
|
|
]
|
|
}, columns_settings);
|
|
$("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
|
|
$('#filter_transacs').click(function(e) {
|
|
e.preventDefault();
|
|
if ($(this).hasClass('filtered')) {
|
|
var filteredValue = '';
|
|
$(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
|
|
} else { //Not filtered. Let's do it!
|
|
var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
|
|
$(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
|
|
}
|
|
table_account_fines.fnFilter(filteredValue, 4, true, false);
|
|
$(this).toggleClass('filtered');
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|