|
Lines 368-374
subtest 'store' => sub {
Link Here
|
| 368 |
|
368 |
|
| 369 |
subtest 'Full payment tests' => sub { |
369 |
subtest 'Full payment tests' => sub { |
| 370 |
|
370 |
|
| 371 |
plan tests => 14; |
371 |
plan tests => 16; |
| 372 |
|
372 |
|
| 373 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
373 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 374 |
|
374 |
|
|
Lines 455-460
subtest 'store' => sub {
Link Here
|
| 455 |
'The account line of type LOST_FOUND has an amountoutstanding of -99' |
455 |
'The account line of type LOST_FOUND has an amountoutstanding of -99' |
| 456 |
); |
456 |
); |
| 457 |
|
457 |
|
|
|
458 |
my $processing_return = Koha::Account::Lines->search( |
| 459 |
{ |
| 460 |
itemnumber => $item->itemnumber, |
| 461 |
credit_type_code => 'PROCESSING_FOUND' |
| 462 |
}, |
| 463 |
{ rows => 1 } |
| 464 |
)->single; |
| 465 |
ok( $processing_return, 'An account line of type PROCESSING_FOUND is added' ); |
| 466 |
is( $processing_return->amount + 0, |
| 467 |
-20.00, |
| 468 |
'The account line of type PROCESSING_FOUND has an amount of -20' ); |
| 469 |
|
| 458 |
$lost_fee_line->discard_changes; |
470 |
$lost_fee_line->discard_changes; |
| 459 |
is( $lost_fee_line->amountoutstanding + 0, |
471 |
is( $lost_fee_line->amountoutstanding + 0, |
| 460 |
0, 'Lost fee has no outstanding amount' ); |
472 |
0, 'Lost fee has no outstanding amount' ); |
|
Lines 463-470
subtest 'store' => sub {
Link Here
|
| 463 |
is( $lost_fee_line->status, 'FOUND', |
475 |
is( $lost_fee_line->status, 'FOUND', |
| 464 |
"Lost fee now has account status of FOUND" ); |
476 |
"Lost fee now has account status of FOUND" ); |
| 465 |
|
477 |
|
| 466 |
is( $patron->account->balance, -99, |
478 |
is( $patron->account->balance, -119, |
| 467 |
'The patron balance is -99, a credit that equals the lost fee payment' |
479 |
'The patron balance is -119, a credit that equals the lost fee payment and the processing fee' |
| 468 |
); |
480 |
); |
| 469 |
}; |
481 |
}; |
| 470 |
|
482 |
|
|
Lines 523-528
subtest 'store' => sub {
Link Here
|
| 523 |
$replacement_amount, |
535 |
$replacement_amount, |
| 524 |
'The right LOST amountountstanding is generated' ); |
536 |
'The right LOST amountountstanding is generated' ); |
| 525 |
|
537 |
|
|
|
538 |
# Set processingreturn_policy to '0' so processing fee is retained |
| 539 |
# these tests are just for lostreturn |
| 540 |
my $processingreturn_rule = $builder->build( |
| 541 |
{ |
| 542 |
source => 'CirculationRule', |
| 543 |
value => { |
| 544 |
branchcode => undef, |
| 545 |
categorycode => undef, |
| 546 |
itemtype => undef, |
| 547 |
rule_name => 'processingreturn', |
| 548 |
rule_value => '0' |
| 549 |
} |
| 550 |
} |
| 551 |
); |
| 552 |
|
| 526 |
# Simulate item marked as found |
553 |
# Simulate item marked as found |
| 527 |
$item->itemlost(0)->store; |
554 |
$item->itemlost(0)->store; |
| 528 |
is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' ); |
555 |
is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' ); |
| 529 |
- |
|
|