Lines 85-96
sub pay {
Link Here
|
85 |
|
85 |
|
86 |
my $patron = Koha::Patrons->find( $self->{patron_id} ); |
86 |
my $patron = Koha::Patrons->find( $self->{patron_id} ); |
87 |
|
87 |
|
88 |
# We should remove accountno, it is no longer needed |
|
|
89 |
my $last = $self->lines->search( |
90 |
{}, |
91 |
{ order_by => 'accountno' } )->next(); |
92 |
my $accountno = $last ? $last->accountno + 1 : 1; |
93 |
|
94 |
my $manager_id = $userenv ? $userenv->{number} : 0; |
88 |
my $manager_id = $userenv ? $userenv->{number} : 0; |
95 |
|
89 |
|
96 |
my @fines_paid; # List of account lines paid on with this payment |
90 |
my @fines_paid; # List of account lines paid on with this payment |
Lines 138-144
sub pay {
Link Here
|
138 |
new_amountoutstanding => 0, |
132 |
new_amountoutstanding => 0, |
139 |
amount_paid => $old_amountoutstanding, |
133 |
amount_paid => $old_amountoutstanding, |
140 |
accountlines_id => $fine->id, |
134 |
accountlines_id => $fine->id, |
141 |
accountno => $fine->accountno, |
|
|
142 |
manager_id => $manager_id, |
135 |
manager_id => $manager_id, |
143 |
note => $note, |
136 |
note => $note, |
144 |
} |
137 |
} |
Lines 189-195
sub pay {
Link Here
|
189 |
new_amountoutstanding => $fine->amountoutstanding, |
182 |
new_amountoutstanding => $fine->amountoutstanding, |
190 |
amount_paid => $amount_to_pay, |
183 |
amount_paid => $amount_to_pay, |
191 |
accountlines_id => $fine->id, |
184 |
accountlines_id => $fine->id, |
192 |
accountno => $fine->accountno, |
|
|
193 |
manager_id => $manager_id, |
185 |
manager_id => $manager_id, |
194 |
note => $note, |
186 |
note => $note, |
195 |
} |
187 |
} |
Lines 212-218
sub pay {
Link Here
|
212 |
my $payment = Koha::Account::Line->new( |
204 |
my $payment = Koha::Account::Line->new( |
213 |
{ |
205 |
{ |
214 |
borrowernumber => $self->{patron_id}, |
206 |
borrowernumber => $self->{patron_id}, |
215 |
accountno => $accountno, |
|
|
216 |
date => dt_from_string(), |
207 |
date => dt_from_string(), |
217 |
amount => 0 - $amount, |
208 |
amount => 0 - $amount, |
218 |
description => $description, |
209 |
description => $description, |
Lines 236-242
sub pay {
Link Here
|
236 |
type => $type, |
227 |
type => $type, |
237 |
amount => $amount, |
228 |
amount => $amount, |
238 |
borrowernumber => $self->{patron_id}, |
229 |
borrowernumber => $self->{patron_id}, |
239 |
accountno => $accountno, |
|
|
240 |
} |
230 |
} |
241 |
); |
231 |
); |
242 |
|
232 |
|
Lines 248-254
sub pay {
Link Here
|
248 |
{ |
238 |
{ |
249 |
action => "create_$type", |
239 |
action => "create_$type", |
250 |
borrowernumber => $self->{patron_id}, |
240 |
borrowernumber => $self->{patron_id}, |
251 |
accountno => $accountno, |
|
|
252 |
amount => 0 - $amount, |
241 |
amount => 0 - $amount, |
253 |
amountoutstanding => 0 - $balance_remaining, |
242 |
amountoutstanding => 0 - $balance_remaining, |
254 |
accounttype => $account_type, |
243 |
accounttype => $account_type, |
Lines 343-358
sub add_credit {
Link Here
|
343 |
|
332 |
|
344 |
$schema->txn_do( |
333 |
$schema->txn_do( |
345 |
sub { |
334 |
sub { |
346 |
# We should remove accountno, it is no longer needed |
|
|
347 |
my $last = $self->lines->search( |
348 |
{}, |
349 |
{ order_by => 'accountno' } )->next(); |
350 |
my $accountno = $last ? $last->accountno + 1 : 1; |
351 |
|
335 |
|
352 |
# Insert the account line |
336 |
# Insert the account line |
353 |
$line = Koha::Account::Line->new( |
337 |
$line = Koha::Account::Line->new( |
354 |
{ borrowernumber => $self->{patron_id}, |
338 |
{ borrowernumber => $self->{patron_id}, |
355 |
accountno => $accountno, |
|
|
356 |
date => \'NOW()', |
339 |
date => \'NOW()', |
357 |
amount => $amount, |
340 |
amount => $amount, |
358 |
description => $description, |
341 |
description => $description, |
Lines 380-386
sub add_credit {
Link Here
|
380 |
type => $type, |
363 |
type => $type, |
381 |
amount => $amount, |
364 |
amount => $amount, |
382 |
borrowernumber => $self->{patron_id}, |
365 |
borrowernumber => $self->{patron_id}, |
383 |
accountno => $accountno, |
|
|
384 |
} |
366 |
} |
385 |
) if grep { $type eq $_ } ('payment', 'writeoff') ; |
367 |
) if grep { $type eq $_ } ('payment', 'writeoff') ; |
386 |
|
368 |
|
Lines 391-397
sub add_credit {
Link Here
|
391 |
Dumper( |
373 |
Dumper( |
392 |
{ action => "create_$type", |
374 |
{ action => "create_$type", |
393 |
borrowernumber => $self->{patron_id}, |
375 |
borrowernumber => $self->{patron_id}, |
394 |
accountno => $accountno, |
|
|
395 |
amount => $amount, |
376 |
amount => $amount, |
396 |
description => $description, |
377 |
description => $description, |
397 |
amountoutstanding => $amount, |
378 |
amountoutstanding => $amount, |
Lines 476-485
sub add_debit {
Link Here
|
476 |
|
457 |
|
477 |
$schema->txn_do( |
458 |
$schema->txn_do( |
478 |
sub { |
459 |
sub { |
479 |
# We should remove accountno, it is no longer needed |
|
|
480 |
my $last = Koha::Account::Lines->search( { borrowernumber => $self->{patron_id} }, |
481 |
{ order_by => 'accountno' } )->next(); |
482 |
my $accountno = $last ? $last->accountno + 1 : 1; |
483 |
|
460 |
|
484 |
# Insert the account line |
461 |
# Insert the account line |
485 |
$line = Koha::Account::Line->new( |
462 |
$line = Koha::Account::Line->new( |
Lines 514-520
sub add_debit {
Link Here
|
514 |
Dumper( |
491 |
Dumper( |
515 |
{ action => "create_$type", |
492 |
{ action => "create_$type", |
516 |
borrowernumber => $self->{patron_id}, |
493 |
borrowernumber => $self->{patron_id}, |
517 |
accountno => $accountno, |
|
|
518 |
amount => $amount, |
494 |
amount => $amount, |
519 |
description => $description, |
495 |
description => $description, |
520 |
amountoutstanding => $amount, |
496 |
amountoutstanding => $amount, |