[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
<td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% 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>
+ [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
+ [% IF account.amountoutstanding <= 0 %]<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 ) %]
+ [% IF ( account.is_credit ) %]
<a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | html %]&borrowernumber=[% account.borrowernumber | html %]" 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 | html %]&borrowernumber=[% account.borrowernumber | html %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
[% END %]
<a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
[% IF ( reverse_col) %]
- [% IF account.object.is_credit %]
+ [% IF account.is_credit %]
<a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
[% ELSE %]
#get account details
my $total = $patron->account->balance;
-my $accts = Koha::Account::Lines->search(
+my @accountlines = Koha::Account::Lines->search(
{ borrowernumber => $patron->borrowernumber },
{ order_by => { -desc => 'accountlines_id' } }
);
}
my $reverse_col = 0; # Flag whether we need to show the reverse column
-my @accountlines;
-while ( my $line = $accts->next ) {
- # FIXME We should pass the $accts iterator to the template and do this formatting part there
- my $accountline = $line->unblessed;
- $accountline->{object} = $line;
- $accountline->{amount} += 0.00;
- if ($accountline->{amount} <= 0 ) {
- $accountline->{amountcredit} = 1;
- }
- $accountline->{amountoutstanding} += 0.00;
- if ( $accountline->{amountoutstanding} <= 0 ) {
- $accountline->{amountoutstandingcredit} = 1;
- }
-
- $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
- $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
- if ($accountline->{amount} < 0) {
- $accountline->{payment} = 1
- if ( $accountline->{accounttype} =~ /^Pay/ );
-
- $reverse_col = 1;
- }
-
- if ( $accountline->{itemnumber} ) {
- # Because we will not have access to the object from the template
- $accountline->{item} = $line->item;
- }
- push @accountlines, $accountline;
-}
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);