Lines 273-279
subtest "Tests for needs_advancing." => sub {
Link Here
|
273 |
}; |
273 |
}; |
274 |
|
274 |
|
275 |
subtest "Tests for advance." => sub { |
275 |
subtest "Tests for advance." => sub { |
276 |
plan tests => 44; |
276 |
plan tests => 48; |
277 |
$schema->storage->txn_begin; |
277 |
$schema->storage->txn_begin; |
278 |
|
278 |
|
279 |
my $sritem_1 = $builder->build_object( |
279 |
my $sritem_1 = $builder->build_object( |
Lines 463-468
subtest "Tests for advance." => sub {
Link Here
|
463 |
$transfer_request->datearrived(dt_from_string())->store; |
463 |
$transfer_request->datearrived(dt_from_string())->store; |
464 |
$sritem_1->itemnumber->holdingbranch($srstage_2->branchcode_id)->store; |
464 |
$sritem_1->itemnumber->holdingbranch($srstage_2->branchcode_id)->store; |
465 |
|
465 |
|
|
|
466 |
# Checked out item, advanced to next stage, checkedout from next stage |
467 |
# transfer should be generated, but not initiated |
468 |
my $issue = $builder->build_object({ |
469 |
class => 'Koha::Checkouts', |
470 |
value => { |
471 |
branchcode => $srstage_1->branchcode_id, |
472 |
itemnumber => $sritem_1->itemnumber->itemnumber, |
473 |
returndate => undef |
474 |
} |
475 |
}); |
476 |
$sritem_1->itemnumber->holdingbranch($srstage_1->branchcode_id)->store; |
477 |
ok($sritem_1->advance, "Advancement done."); |
478 |
$transfer_request = $sritem_1->itemnumber->get_transfer; |
479 |
is($transfer_request->frombranch, $srstage_1->branchcode_id, "Origin correct."); |
480 |
is($transfer_request->tobranch, $srstage_1->branchcode_id, "Target correct."); |
481 |
is($transfer_request->datesent, undef, "Transfer waiting to initiate until return."); |
482 |
|
483 |
$issue->delete; #remove issue |
484 |
$sritem_1->advance; #advance back to second stage |
485 |
# Set arrived |
486 |
$transfer_request->datearrived(dt_from_string())->store; |
487 |
$sritem_1->itemnumber->holdingbranch($srstage_2->branchcode_id)->store; |
488 |
|
489 |
|
466 |
$srstage_1->rota->cyclical(0)->store; # Set Rota to non-cyclical. |
490 |
$srstage_1->rota->cyclical(0)->store; # Set Rota to non-cyclical. |
467 |
|
491 |
|
468 |
my $srstage_3 = $builder->build_object({ |
492 |
my $srstage_3 = $builder->build_object({ |
469 |
- |
|
|