Lines 29-34
Link Here
|
29 |
use strict; |
29 |
use strict; |
30 |
use warnings; |
30 |
use warnings; |
31 |
|
31 |
|
|
|
32 |
use URI::Escape; |
32 |
use C4::Context; |
33 |
use C4::Context; |
33 |
use C4::Auth; |
34 |
use C4::Auth; |
34 |
use C4::Output; |
35 |
use C4::Output; |
Lines 90-96
if ($writeoff_all) {
Link Here
|
90 |
my $itemno = $input->param('itemnumber'); |
91 |
my $itemno = $input->param('itemnumber'); |
91 |
my $account_type = $input->param('accounttype'); |
92 |
my $account_type = $input->param('accounttype'); |
92 |
my $amount = $input->param('amount'); |
93 |
my $amount = $input->param('amount'); |
93 |
writeoff( $accountno, $itemno, $account_type, $amount ); |
94 |
my $payment_note = $input->param("payment_note"); |
|
|
95 |
writeoff( $accountno, $itemno, $account_type, $amount, $payment_note ); |
94 |
} |
96 |
} |
95 |
|
97 |
|
96 |
for (@names) { |
98 |
for (@names) { |
Lines 110-116
add_accounts_to_template();
Link Here
|
110 |
output_html_with_http_headers $input, $cookie, $template->output; |
112 |
output_html_with_http_headers $input, $cookie, $template->output; |
111 |
|
113 |
|
112 |
sub writeoff { |
114 |
sub writeoff { |
113 |
my ( $accountnum, $itemnum, $accounttype, $amount ) = @_; |
115 |
my ( $accountnum, $itemnum, $accounttype, $amount, $payment_note ) = @_; |
|
|
116 |
$payment_note = "" unless defined $payment_note; |
114 |
|
117 |
|
115 |
# if no item is attached to fine, make sure to store it as a NULL |
118 |
# if no item is attached to fine, make sure to store it as a NULL |
116 |
$itemnum ||= undef; |
119 |
$itemnum ||= undef; |
Lines 118-124
sub writeoff {
Link Here
|
118 |
$writeoff_sth->execute( $accountnum, $borrowernumber ); |
121 |
$writeoff_sth->execute( $accountnum, $borrowernumber ); |
119 |
|
122 |
|
120 |
my $acct = getnextacctno($borrowernumber); |
123 |
my $acct = getnextacctno($borrowernumber); |
121 |
$add_writeoff_sth->execute( $borrowernumber, $acct, $itemnum, $amount ); |
124 |
$add_writeoff_sth->execute( $borrowernumber, $acct, $itemnum, $amount, $payment_note); |
122 |
|
125 |
|
123 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
126 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
124 |
|
127 |
|
Lines 180-190
sub redirect_to_paycollect {
Link Here
|
180 |
$redirect .= |
183 |
$redirect .= |
181 |
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); |
184 |
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); |
182 |
$redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 ); |
185 |
$redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 ); |
183 |
$redirect .= get_for_redirect( 'description', "description$line_no", 0 ); |
|
|
184 |
$redirect .= get_for_redirect( 'title', "title$line_no", 0 ); |
186 |
$redirect .= get_for_redirect( 'title', "title$line_no", 0 ); |
185 |
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); |
187 |
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); |
186 |
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); |
188 |
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); |
187 |
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); |
189 |
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); |
|
|
190 |
$redirect .= q{&} . 'payment_note' . q{=} . uri_escape $input->param("payment_note_$line_no"); |
188 |
$redirect .= '&remote_user='; |
191 |
$redirect .= '&remote_user='; |
189 |
$redirect .= $user; |
192 |
$redirect .= $user; |
190 |
return print $input->redirect($redirect); |
193 |
return print $input->redirect($redirect); |
Lines 202-208
sub writeoff_all {
Link Here
|
202 |
my $itemno = $input->param("itemnumber$value"); |
205 |
my $itemno = $input->param("itemnumber$value"); |
203 |
my $amount = $input->param("amount$value"); |
206 |
my $amount = $input->param("amount$value"); |
204 |
my $accountno = $input->param("accountno$value"); |
207 |
my $accountno = $input->param("accountno$value"); |
205 |
writeoff( $accountno, $itemno, $accounttype, $amount ); |
208 |
my $payment_note = $input->param("payment_note_$value"); |
|
|
209 |
writeoff( $accountno, $itemno, $accounttype, $amount, $payment_note ); |
206 |
} |
210 |
} |
207 |
} |
211 |
} |
208 |
|
212 |
|
Lines 282-289
sub get_writeoff_sth {
Link Here
|
282 |
. 'WHERE accountno=? and borrowernumber=?'; |
286 |
. 'WHERE accountno=? and borrowernumber=?'; |
283 |
$writeoff_sth = $dbh->prepare($sql); |
287 |
$writeoff_sth = $dbh->prepare($sql); |
284 |
my $insert = |
288 |
my $insert = |
285 |
q{insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)} |
289 |
q{insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype,note)} |
286 |
. q{values (?,?,?,now(),?,'Writeoff','W')}; |
290 |
. q{values (?,?,?,now(),?,'Writeoff','W',?)}; |
287 |
$add_writeoff_sth = $dbh->prepare($insert); |
291 |
$add_writeoff_sth = $dbh->prepare($insert); |
288 |
} |
292 |
} |
289 |
return; |
293 |
return; |