|
Lines 551-559
subtest 'apply() tests' => sub {
Link Here
|
| 551 |
$schema->storage->txn_rollback; |
551 |
$schema->storage->txn_rollback; |
| 552 |
}; |
552 |
}; |
| 553 |
|
553 |
|
| 554 |
subtest 'Keep account info when related patron, staff or item is deleted' => sub { |
554 |
subtest 'Keep account info when related patron, staff, item or cash_register is deleted' => sub { |
| 555 |
|
555 |
|
| 556 |
plan tests => 3; |
556 |
plan tests => 4; |
| 557 |
|
557 |
|
| 558 |
$schema->storage->txn_begin; |
558 |
$schema->storage->txn_begin; |
| 559 |
|
559 |
|
|
Lines 566-571
subtest 'Keep account info when related patron, staff or item is deleted' => sub
Link Here
|
| 566 |
value => { itemnumber => $item->itemnumber } |
566 |
value => { itemnumber => $item->itemnumber } |
| 567 |
} |
567 |
} |
| 568 |
); |
568 |
); |
|
|
569 |
my $register = $builder->build_object({ class => 'Koha::Cash::Registers' }); |
| 570 |
|
| 569 |
my $line = Koha::Account::Line->new( |
571 |
my $line = Koha::Account::Line->new( |
| 570 |
{ |
572 |
{ |
| 571 |
borrowernumber => $patron->borrowernumber, |
573 |
borrowernumber => $patron->borrowernumber, |
|
Lines 575-580
subtest 'Keep account info when related patron, staff or item is deleted' => sub
Link Here
|
| 575 |
status => "RETURNED", |
577 |
status => "RETURNED", |
| 576 |
amount => 10, |
578 |
amount => 10, |
| 577 |
interface => 'commandline', |
579 |
interface => 'commandline', |
|
|
580 |
register_id => $register->id |
| 578 |
})->store; |
581 |
})->store; |
| 579 |
|
582 |
|
| 580 |
$issue->delete; |
583 |
$issue->delete; |
|
Lines 590-595
subtest 'Keep account info when related patron, staff or item is deleted' => sub
Link Here
|
| 590 |
$line = $line->get_from_storage; |
593 |
$line = $line->get_from_storage; |
| 591 |
is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete"); |
594 |
is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete"); |
| 592 |
|
595 |
|
|
|
596 |
$register->delete; |
| 597 |
$line = $line->get_from_storage; |
| 598 |
is( $line->register_id, undef, "The account line should not be deleted when the related cash register is delete"); |
| 599 |
|
| 593 |
$schema->storage->txn_rollback; |
600 |
$schema->storage->txn_rollback; |
| 594 |
}; |
601 |
}; |
| 595 |
|
602 |
|
| 596 |
- |
|
|