Lines 2966-2972
subtest 'Set waiting flag' => sub {
Link Here
|
2966 |
}; |
2966 |
}; |
2967 |
|
2967 |
|
2968 |
subtest 'Cancel transfers on lost items' => sub { |
2968 |
subtest 'Cancel transfers on lost items' => sub { |
2969 |
plan tests => 5; |
2969 |
plan tests => 6; |
2970 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2970 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2971 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2971 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2972 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
2972 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
Lines 2993-3007
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
2993 |
my $do_transfer = 1; |
2993 |
my $do_transfer = 1; |
2994 |
my ( $res, $rr ) = AddReturn( $item->barcode, $library_1->{branchcode} ); |
2994 |
my ( $res, $rr ) = AddReturn( $item->barcode, $library_1->{branchcode} ); |
2995 |
ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); |
2995 |
ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); |
2996 |
C4::Circulation::transferbook( $library_2->{branchcode}, $item->barcode ); |
2996 |
C4::Circulation::transferbook({ |
|
|
2997 |
from_branch => $library_1->{branchcode}, |
2998 |
to_branch => $library_2->{branchcode}, |
2999 |
barcode => $item->barcode, |
3000 |
}); |
2997 |
my $hold = Koha::Holds->find( $reserve_id ); |
3001 |
my $hold = Koha::Holds->find( $reserve_id ); |
2998 |
is( $hold->found, 'T', 'Hold is in transit' ); |
3002 |
is( $hold->found, 'T', 'Hold is in transit' ); |
2999 |
|
3003 |
|
3000 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3004 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3001 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3005 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3002 |
is( $tobranch, $library_2->{branchcode}, 'The transfer record exists in the branchtransfers table'); |
3006 |
is( $frombranch, $library_1->{branchcode}, 'The transfer is generated from the correct library'); |
|
|
3007 |
is( $tobranch, $library_2->{branchcode}, 'The transfer is generated to the correct library'); |
3003 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3008 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3004 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origin branch before it is marked as lost' ); |
3009 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origination branch before it is marked as lost' ); |
3005 |
|
3010 |
|
3006 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
3011 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
3007 |
ModItem( { itemlost => 1 }, $item->biblionumber, $item->itemnumber ); |
3012 |
ModItem( { itemlost => 1 }, $item->biblionumber, $item->itemnumber ); |