Lines 3426-3442
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
3426 |
is( $hold->found, 'T', 'Hold is in transit' ); |
3426 |
is( $hold->found, 'T', 'Hold is in transit' ); |
3427 |
|
3427 |
|
3428 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3428 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
3429 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3429 |
my $transfer = $item->get_transfer; |
3430 |
is( $frombranch, $library_1->{branchcode}, 'The transfer is generated from the correct library'); |
3430 |
is( $transfer->frombranch, $library_1->{branchcode}, 'The transfer is generated from the correct library'); |
3431 |
is( $tobranch, $library_2->{branchcode}, 'The transfer is generated to the correct library'); |
3431 |
is( $transfer->tobranch, $library_2->{branchcode}, 'The transfer is generated to the correct library'); |
3432 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3432 |
my $itemcheck = Koha::Items->find($item->itemnumber); |
3433 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origination branch before it is marked as lost' ); |
3433 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origination branch before it is marked as lost' ); |
3434 |
|
3434 |
|
3435 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
3435 |
#Simulate item being marked as lost and confirm the transfer is cancelled and the items holding branch is the transfers source branch |
3436 |
$item->itemlost(1)->store; |
3436 |
$item->itemlost(1)->store; |
3437 |
LostItem( $item->itemnumber, 'test', 1 ); |
3437 |
LostItem( $item->itemnumber, 'test', 1 ); |
3438 |
($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); |
3438 |
$transfer = $item->get_transfer; |
3439 |
is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled'); |
3439 |
is( $transfer, undef, 'The transfer on the lost item has been cancelled as the LostItemCancelOutstandingTransfer is enabled'); |
3440 |
$itemcheck = Koha::Items->find($item->itemnumber); |
3440 |
$itemcheck = Koha::Items->find($item->itemnumber); |
3441 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' ); |
3441 |
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' ); |
3442 |
|
3442 |
|
3443 |
- |
|
|