Lines 29-34
use C4::Output;
Link Here
|
29 |
use CGI qw ( -utf8 ); |
29 |
use CGI qw ( -utf8 ); |
30 |
use C4::Members; |
30 |
use C4::Members; |
31 |
use C4::Accounts; |
31 |
use C4::Accounts; |
|
|
32 |
use C4::Letters; |
32 |
use Koha::Account::Lines; |
33 |
use Koha::Account::Lines; |
33 |
use Koha::DateUtils; |
34 |
use Koha::DateUtils; |
34 |
use Koha::Patrons; |
35 |
use Koha::Patrons; |
Lines 59-65
my $total = $patron->account->balance;
Link Here
|
59 |
|
60 |
|
60 |
# FIXME This whole stuff is ugly and should be rewritten |
61 |
# FIXME This whole stuff is ugly and should be rewritten |
61 |
# FIXME We should pass the $accts iterator to the template and do this formatting part there |
62 |
# FIXME We should pass the $accts iterator to the template and do this formatting part there |
62 |
my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed; |
63 |
my $accountline_object = Koha::Account::Lines->find($accountlines_id); |
|
|
64 |
my $accountline = $accountline_object->unblessed; |
63 |
my $totalcredit; |
65 |
my $totalcredit; |
64 |
if($total <= 0){ |
66 |
if($total <= 0){ |
65 |
$totalcredit = 1; |
67 |
$totalcredit = 1; |
Lines 75-98
if ( $accountline->{'amountoutstanding'} <= 0 ) {
Link Here
|
75 |
$accountline->{'amountoutstandingcredit'} = 1; |
77 |
$accountline->{'amountoutstandingcredit'} = 1; |
76 |
} |
78 |
} |
77 |
|
79 |
|
78 |
my %row = ( |
80 |
my $letter_code = $accountline_object->accounttype eq 'WO' ? 'ACCOUNT_WRITEOFF' : 'ACCOUNT_PAYMENT'; |
79 |
'date' => dt_from_string( $accountline->{'date'} ), |
81 |
my $letter = C4::Letters::getletter( 'circulation', $letter_code, C4::Context::mybranch, 'print', $patron->lang ); |
80 |
'amountcredit' => $accountline->{'amountcredit'}, |
|
|
81 |
'amountoutstandingcredit' => $accountline->{'amountoutstandingcredit'}, |
82 |
'description' => $accountline->{'description'}, |
83 |
'amount' => $accountline->{'amount'}, |
84 |
'amountoutstanding' => $accountline->{'amountoutstanding'}, |
85 |
accounttype => $accountline->{accounttype}, |
86 |
'note' => $accountline->{'note'}, |
87 |
); |
88 |
|
82 |
|
|
|
83 |
my @account_offsets = Koha::Account::Offsets->search( { credit_id => $accountline_object->id } ); |
89 |
|
84 |
|
90 |
$template->param( |
85 |
$template->param( |
91 |
patron => $patron, |
86 |
letter => $letter, |
92 |
finesview => 1, |
87 |
patron => $patron, |
93 |
total => $total, |
88 |
library => C4::Context::mybranch, |
94 |
totalcredit => $totalcredit, |
89 |
offsets => \@account_offsets, |
95 |
accounts => [$accountline], # FIXME There is always only 1 row! |
90 |
credit => $accountline_object, |
|
|
91 |
|
92 |
finesview => 1, |
93 |
total => $total, |
94 |
totalcredit => $totalcredit, |
95 |
accounts => [$accountline], # FIXME There is always only 1 row! |
96 |
); |
96 |
); |
97 |
|
97 |
|
98 |
output_html_with_http_headers $input, $cookie, $template->output; |
98 |
output_html_with_http_headers $input, $cookie, $template->output; |
99 |
- |
|
|