Lines 88-98
if ($writeoff_all) {
Link Here
|
88 |
writeoff_all(@names); |
88 |
writeoff_all(@names); |
89 |
} elsif ($writeoff_item) { |
89 |
} elsif ($writeoff_item) { |
90 |
my $accountlines_id = $input->param('accountlines_id'); |
90 |
my $accountlines_id = $input->param('accountlines_id'); |
91 |
my $itemno = $input->param('itemnumber'); |
|
|
92 |
my $account_type = $input->param('accounttype'); |
93 |
my $amount = $input->param('amountoutstanding'); |
91 |
my $amount = $input->param('amountoutstanding'); |
94 |
my $payment_note = $input->param("payment_note"); |
92 |
my $payment_note = $input->param("payment_note"); |
95 |
WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $account_type, $amount, $branch, $payment_note ); |
93 |
|
|
|
94 |
Koha::Account->new( { patron_id => $borrowernumber } )->pay( |
95 |
{ |
96 |
amount => $amount, |
97 |
lines => [Koha::Account::Lines->find($accountlines_id)], |
98 |
type => 'writeoff', |
99 |
note => $payment_note, |
100 |
library_id => $branch, |
101 |
} |
102 |
); |
96 |
} |
103 |
} |
97 |
|
104 |
|
98 |
for (@names) { |
105 |
for (@names) { |
Lines 153-159
sub add_accounts_to_template {
Link Here
|
153 |
sub get_for_redirect { |
160 |
sub get_for_redirect { |
154 |
my ( $name, $name_in, $money ) = @_; |
161 |
my ( $name, $name_in, $money ) = @_; |
155 |
my $s = q{&} . $name . q{=}; |
162 |
my $s = q{&} . $name . q{=}; |
156 |
my $value = $input->param($name_in); |
163 |
my $value = uri_escape_utf8( $input->param($name_in) ); |
157 |
if ( !defined $value ) { |
164 |
if ( !defined $value ) { |
158 |
$value = ( $money == 1 ) ? 0 : q{}; |
165 |
$value = ( $money == 1 ) ? 0 : q{}; |
159 |
} |
166 |
} |
Lines 175-182
sub redirect_to_paycollect {
Link Here
|
175 |
$redirect .= get_for_redirect( 'amount', "amount$line_no", 1 ); |
182 |
$redirect .= get_for_redirect( 'amount', "amount$line_no", 1 ); |
176 |
$redirect .= |
183 |
$redirect .= |
177 |
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); |
184 |
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); |
178 |
$redirect .= uri_escape_utf8( get_for_redirect( 'description', "description$line_no", 0 ) ); |
185 |
$redirect .= get_for_redirect( 'description', "description$line_no", 0 ); |
179 |
$redirect .= uri_escape_utf8( get_for_redirect( 'title', "title$line_no", 0 ) ); |
186 |
$redirect .= get_for_redirect( 'title', "title$line_no", 0 ); |
180 |
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); |
187 |
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); |
181 |
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); |
188 |
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); |
182 |
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); |
189 |
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); |
Lines 190-212
sub redirect_to_paycollect {
Link Here
|
190 |
sub writeoff_all { |
197 |
sub writeoff_all { |
191 |
my @params = @_; |
198 |
my @params = @_; |
192 |
my @wo_lines = grep { /^accountlines_id\d+$/ } @params; |
199 |
my @wo_lines = grep { /^accountlines_id\d+$/ } @params; |
|
|
200 |
|
201 |
my $borrowernumber = $input->param('borrowernumber'); |
202 |
|
193 |
for (@wo_lines) { |
203 |
for (@wo_lines) { |
194 |
if (/(\d+)/) { |
204 |
if (/(\d+)/) { |
195 |
my $value = $1; |
205 |
my $value = $1; |
196 |
my $accounttype = $input->param("accounttype$value"); |
206 |
my $amount = $input->param("amountoutstanding$value"); |
197 |
|
|
|
198 |
# my $borrowernum = $input->param("borrowernumber$value"); |
199 |
my $itemno = $input->param("itemnumber$value"); |
200 |
my $amount = $input->param("amountoutstanding$value"); |
201 |
my $accountlines_id = $input->param("accountlines_id$value"); |
207 |
my $accountlines_id = $input->param("accountlines_id$value"); |
202 |
my $payment_note = $input->param("payment_note_$value"); |
208 |
my $payment_note = $input->param("payment_note_$value"); |
203 |
WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount, $branch, $payment_note ); |
209 |
Koha::Account->new( { patron_id => $borrowernumber } )->pay( |
|
|
210 |
{ |
211 |
amount => $amount, |
212 |
lines => [ Koha::Account::Lines->find($accountlines_id) ], |
213 |
type => 'writeoff', |
214 |
note => $payment_note, |
215 |
library_id => $branch, |
216 |
} |
217 |
); |
204 |
} |
218 |
} |
205 |
} |
219 |
} |
206 |
|
220 |
|
207 |
$borrowernumber = $input->param('borrowernumber'); |
221 |
print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); |
208 |
print $input->redirect( |
|
|
209 |
"/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); |
210 |
return; |
222 |
return; |
211 |
} |
223 |
} |
212 |
|
224 |
|