Lines 3244-3250
subtest 'Set waiting flag' => sub {
Link Here
|
3244 |
}; |
3244 |
}; |
3245 |
|
3245 |
|
3246 |
subtest 'Cancel transfers on lost items' => sub { |
3246 |
subtest 'Cancel transfers on lost items' => sub { |
3247 |
plan tests => 5; |
3247 |
plan tests => 6; |
3248 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
3248 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
3249 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
3249 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
3250 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
3250 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
Lines 3271-3285
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
3271 |
my $do_transfer = 1; |
3271 |
my $do_transfer = 1; |
3272 |
my ( $res, $rr ) = AddReturn( $item->barcode, $library_1->{branchcode} ); |
3272 |
my ( $res, $rr ) = AddReturn( $item->barcode, $library_1->{branchcode} ); |
3273 |
ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); |
3273 |
ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); |
3274 |
C4::Circulation::transferbook( $library_2->{branchcode}, $item->barcode ); |
3274 |
C4::Circulation::transferbook({ |
|
|
3275 |
from_branch => $library_1->{branchcode}, |
3276 |
to_branch => $library_2->{branchcode}, |
3277 |
barcode => $item->barcode, |
3278 |
}); |
3275 |
my $hold = Koha::Holds->find( $reserve_id ); |
3279 |
my $hold = Koha::Holds->find( $reserve_id ); |
3276 |
is( $hold->found, 'T', 'Hold is in transit' ); |
3280 |
is( $hold->found, 'T', 'Hold is in transit' ); |
3277 |
|
3281 |
|
3278 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3282 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3279 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3283 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3280 |
is( $tobranch, $library_2->{branchcode}, 'The transfer record exists in the branchtransfers table'); |
3284 |
is( $frombranch, $library_1->{branchcode}, 'The transfer is generated from the correct library'); |
|
|
3285 |
is( $tobranch, $library_2->{branchcode}, 'The transfer is generated to the correct library'); |
3281 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3286 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3282 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origin branch before it is marked as lost' ); |
3287 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origination branch before it is marked as lost' ); |
3283 |
|
3288 |
|
3284 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
3289 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
3285 |
$item->itemlost(1)->store; |
3290 |
$item->itemlost(1)->store; |