Lines 2702-2708
subtest 'Set waiting flag' => sub {
Link Here
|
2702 |
}; |
2702 |
}; |
2703 |
|
2703 |
|
2704 |
subtest 'Cancel transfers on lost items' => sub { |
2704 |
subtest 'Cancel transfers on lost items' => sub { |
2705 |
plan tests => 5; |
2705 |
plan tests => 6; |
2706 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2706 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2707 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2707 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2708 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
2708 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
Lines 2733-2747
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
2733 |
my $do_transfer = 1; |
2733 |
my $do_transfer = 1; |
2734 |
my ( $res, $rr ) = AddReturn( $item->{barcode}, $library_1->{branchcode} ); |
2734 |
my ( $res, $rr ) = AddReturn( $item->{barcode}, $library_1->{branchcode} ); |
2735 |
ModReserveAffect( $item->{itemnumber}, undef, $do_transfer, $reserve_id ); |
2735 |
ModReserveAffect( $item->{itemnumber}, undef, $do_transfer, $reserve_id ); |
2736 |
C4::Circulation::transferbook( $library_2->{branchcode}, $item->{barcode} ); |
2736 |
C4::Circulation::transferbook({ |
|
|
2737 |
from_branch => $library_1->{branchcode}, |
2738 |
to_branch => $library_2->{branchcode}, |
2739 |
barcode => $item->{barcode}, |
2740 |
}); |
2737 |
my $hold = Koha::Holds->find( $reserve_id ); |
2741 |
my $hold = Koha::Holds->find( $reserve_id ); |
2738 |
is( $hold->found, 'T', 'Hold is in transit' ); |
2742 |
is( $hold->found, 'T', 'Hold is in transit' ); |
2739 |
|
2743 |
|
2740 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
2744 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
2741 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->{itemnumber}); |
2745 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->{itemnumber}); |
2742 |
is( $tobranch, $library_2->{branchcode}, 'The transfer record exists in the branchtransfers table'); |
2746 |
is( $frombranch, $library_1->{branchcode}, 'The transfer is generated from the correct library'); |
|
|
2747 |
is( $tobranch, $library_2->{branchcode}, 'The transfer is generated to the correct library'); |
2743 |
my $itemcheck = Koha::Items->find($item->{itemnumber}); |
2748 |
my $itemcheck = Koha::Items->find($item->{itemnumber}); |
2744 |
is( $itemcheck->holdingbranch, $library_2->{branchcode}, 'Items holding branch is the transfers destination branch before it is marked as lost' ); |
2749 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origination branch before it is marked as lost' ); |
2745 |
|
2750 |
|
2746 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
2751 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
2747 |
ModItem( { itemlost => 1 }, $biblio->{biblionumber}, $item->{itemnumber} ); |
2752 |
ModItem( { itemlost => 1 }, $biblio->{biblionumber}, $item->{itemnumber} ); |