use Modern::Perl;
use utf8;
-use Test::More tests => 65;
+use Test::More tests => 66;
use Test::Exception;
use Test::MockModule;
use Test::Deep qw( cmp_deeply );
[ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages");
};
+subtest 'Tests for transfer not in transit' => sub {
+
+ plan tests => 2;
+
+
+ # These tests are to ensure a 'pending' transfer, generated by
+ # stock rotation, will be advanced when checked in
+
+ my $item = $builder->build_sample_item();
+ my $transfer = $builder->build_object({ class => 'Koha::Item::Transfers', value => {
+ itemnumber => $item->id,
+ reason => 'StockrotationRepatriation',
+ datesent => undef,
+ frombranch => $item->homebranch,
+ }});
+ my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
+ is_deeply(
+ \@return,
+ [ 0, { WasTransfered => $transfer->tobranch, TransferTrigger => 'StockrotationRepatriation', NotIssued => $item->barcode }, undef, {} ], "Item is reported to have been transferred");
+
+ $transfer->discard_changes;
+ ok( $transfer->datesent, 'The datesent field is populated, i.e. transfer is initiated');
+
+};
+
$schema->storage->txn_rollback;
C4::Context->clear_syspref_cache();
$branches = Koha::Libraries->search();
materials => undef,
more_subfields_xml => undef,
},
+ Branchtransfer => {
+ daterequested => dt_from_string(),
+ datesent => dt_from_string(),
+ datearrived => undef,
+ datecancelled => undef,
+ reason => undef,
+ withdrawn => 0,
+ restricted => 0,
+ damaged => 0,
+ materials => undef,
+ more_subfields_xml => undef,
+ },
Category => {
enrolmentfee => 0,
reservefee => 0,