|
Lines 712-718
subtest 'pay() tests' => sub {
Link Here
|
| 712 |
|
712 |
|
| 713 |
subtest 'pay() handles lost items when paying a specific lost fee' => sub { |
713 |
subtest 'pay() handles lost items when paying a specific lost fee' => sub { |
| 714 |
|
714 |
|
| 715 |
plan tests => 4; |
715 |
plan tests => 5; |
| 716 |
|
716 |
|
| 717 |
$schema->storage->txn_begin; |
717 |
$schema->storage->txn_begin; |
| 718 |
|
718 |
|
|
Lines 780-785
subtest 'pay() handles lost items when paying a specific lost fee' => sub {
Link Here
|
| 780 |
$checkout = Koha::Checkouts->find( $checkout->id ); |
780 |
$checkout = Koha::Checkouts->find( $checkout->id ); |
| 781 |
ok( !$checkout, 'Item was removed from patron account' ); |
781 |
ok( !$checkout, 'Item was removed from patron account' ); |
| 782 |
|
782 |
|
|
|
783 |
subtest 'item was not checked out to the same patron' => sub { |
| 784 |
plan tests => 1; |
| 785 |
|
| 786 |
my $patron_2 = $builder->build_object( |
| 787 |
{ |
| 788 |
class => 'Koha::Patrons', |
| 789 |
value => { branchcode => $library->branchcode } |
| 790 |
} |
| 791 |
); |
| 792 |
$item->itemlost('1')->store(); |
| 793 |
C4::Accounts::chargelostitem( $patron->borrowernumber, $item->itemnumber, 5, "lost" ); |
| 794 |
my $accountline = Koha::Account::Lines->search( |
| 795 |
{ |
| 796 |
borrowernumber => $patron->borrowernumber, |
| 797 |
itemnumber => $item->itemnumber, |
| 798 |
debit_type_code => 'LOST' |
| 799 |
} |
| 800 |
)->next; |
| 801 |
my $checkout = Koha::Checkout->new( |
| 802 |
{ |
| 803 |
borrowernumber => $patron_2->borrowernumber, |
| 804 |
itemnumber => $item->itemnumber, |
| 805 |
date_due => \'NOW()', |
| 806 |
branchcode => $patron_2->branchcode, |
| 807 |
issuedate => \'NOW()', |
| 808 |
} |
| 809 |
)->store(); |
| 810 |
|
| 811 |
$patron->account->pay( |
| 812 |
{ |
| 813 |
amount => 5, |
| 814 |
library_id => $library->branchcode, |
| 815 |
lines => [$accountline], |
| 816 |
} |
| 817 |
); |
| 818 |
|
| 819 |
ok( |
| 820 |
Koha::Checkouts->find( $checkout->issue_id ), |
| 821 |
'If the item is checked out to another patron, a lost item should not be returned if lost fee is paid' |
| 822 |
); |
| 823 |
|
| 824 |
}; |
| 825 |
|
| 783 |
$schema->storage->txn_rollback; |
826 |
$schema->storage->txn_rollback; |
| 784 |
}; |
827 |
}; |
| 785 |
|
828 |
|
| 786 |
- |
|
|