Lines 3475-3490
subtest 'Set waiting flag' => sub {
Link Here
|
3475 |
}; |
3475 |
}; |
3476 |
|
3476 |
|
3477 |
subtest 'Cancel transfers on lost items' => sub { |
3477 |
subtest 'Cancel transfers on lost items' => sub { |
3478 |
plan tests => 5; |
3478 |
plan tests => 6; |
3479 |
|
3479 |
|
3480 |
my $library_to = $builder->build_object( { class => 'Koha::Libraries' } ); |
3480 |
my $library_to = $builder->build_object( { class => 'Koha::Libraries' } ); |
3481 |
my $item = $builder->build_sample_item(); |
3481 |
my $item = $builder->build_sample_item(); |
|
|
3482 |
my $holdingbranch = $item->holdingbranch; |
3483 |
# Historic transfer (datearrived is defined) |
3482 |
my $old_transfer = $builder->build_object( |
3484 |
my $old_transfer = $builder->build_object( |
3483 |
{ |
3485 |
{ |
3484 |
class => 'Koha::Item::Transfers', |
3486 |
class => 'Koha::Item::Transfers', |
3485 |
value => { |
3487 |
value => { |
3486 |
itemnumber => $item->itemnumber, |
3488 |
itemnumber => $item->itemnumber, |
3487 |
frombranch => $item->holdingbranch, |
3489 |
frombranch => $holdingbranch, |
3488 |
tobranch => $library_to->branchcode, |
3490 |
tobranch => $library_to->branchcode, |
3489 |
reason => 'Manual', |
3491 |
reason => 'Manual', |
3490 |
datesent => \'NOW()', |
3492 |
datesent => \'NOW()', |
Lines 3494-3505
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
3494 |
} |
3496 |
} |
3495 |
} |
3497 |
} |
3496 |
); |
3498 |
); |
|
|
3499 |
# Queued transfer (datesent is undefined) |
3497 |
my $transfer_1 = $builder->build_object( |
3500 |
my $transfer_1 = $builder->build_object( |
3498 |
{ |
3501 |
{ |
3499 |
class => 'Koha::Item::Transfers', |
3502 |
class => 'Koha::Item::Transfers', |
3500 |
value => { |
3503 |
value => { |
3501 |
itemnumber => $item->itemnumber, |
3504 |
itemnumber => $item->itemnumber, |
3502 |
frombranch => $item->holdingbranch, |
3505 |
frombranch => $holdingbranch, |
3503 |
tobranch => $library_to->branchcode, |
3506 |
tobranch => $library_to->branchcode, |
3504 |
reason => 'Manual', |
3507 |
reason => 'Manual', |
3505 |
datesent => undef, |
3508 |
datesent => undef, |
Lines 3509-3520
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
3509 |
} |
3512 |
} |
3510 |
} |
3513 |
} |
3511 |
); |
3514 |
); |
|
|
3515 |
# In transit transfer (datesent is defined, datearrived and datecancelled are both undefined) |
3512 |
my $transfer_2 = $builder->build_object( |
3516 |
my $transfer_2 = $builder->build_object( |
3513 |
{ |
3517 |
{ |
3514 |
class => 'Koha::Item::Transfers', |
3518 |
class => 'Koha::Item::Transfers', |
3515 |
value => { |
3519 |
value => { |
3516 |
itemnumber => $item->itemnumber, |
3520 |
itemnumber => $item->itemnumber, |
3517 |
frombranch => $item->holdingbranch, |
3521 |
frombranch => $holdingbranch, |
3518 |
tobranch => $library_to->branchcode, |
3522 |
tobranch => $library_to->branchcode, |
3519 |
reason => 'Manual', |
3523 |
reason => 'Manual', |
3520 |
datesent => \'NOW()', |
3524 |
datesent => \'NOW()', |
Lines 3537-3542
subtest 'Cancel transfers on lost items' => sub {
Link Here
|
3537 |
is($transfer_2->cancellation_reason, 'ItemLost', "Cancellation reason was set to 'ItemLost'"); |
3541 |
is($transfer_2->cancellation_reason, 'ItemLost', "Cancellation reason was set to 'ItemLost'"); |
3538 |
$old_transfer->discard_changes; |
3542 |
$old_transfer->discard_changes; |
3539 |
is($old_transfer->datecancelled, undef, "Old transfers are unaffected"); |
3543 |
is($old_transfer->datecancelled, undef, "Old transfers are unaffected"); |
|
|
3544 |
$item->discard_changes; |
3545 |
is($item->holdingbranch, $holdingbranch, "Items holding branch remains unchanged"); |
3540 |
}; |
3546 |
}; |
3541 |
|
3547 |
|
3542 |
subtest 'CanBookBeIssued | is_overdue' => sub { |
3548 |
subtest 'CanBookBeIssued | is_overdue' => sub { |
3543 |
- |
|
|