Lines 272-278
subtest do_hold => sub {
Link Here
|
272 |
}; |
272 |
}; |
273 |
|
273 |
|
274 |
subtest do_checkin => sub { |
274 |
subtest do_checkin => sub { |
275 |
plan tests => 11; |
275 |
plan tests => 12; |
276 |
|
276 |
|
277 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
277 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
278 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
278 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
Lines 327-332
subtest do_checkin => sub {
Link Here
|
327 |
is_deeply($result,{ messages => { 'NotIssued' => $item->barcode, 'WasTransfered' => 1 } },"Messages show not issued and transferred"); |
327 |
is_deeply($result,{ messages => { 'NotIssued' => $item->barcode, 'WasTransfered' => 1 } },"Messages show not issued and transferred"); |
328 |
is( $ci_transaction->item->destination_loc,$library->branchcode,"Item destination correctly set"); |
328 |
is( $ci_transaction->item->destination_loc,$library->branchcode,"Item destination correctly set"); |
329 |
|
329 |
|
|
|
330 |
subtest 'Checkin an in transit item' => sub { |
331 |
|
332 |
plan tests => 5; |
333 |
|
334 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
335 |
my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); |
336 |
|
337 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {branchcode => $library_1->branchcode, }}); |
338 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
339 |
my $item = $builder->build_sample_item({ library => $library_1->branchcode }); |
340 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
341 |
|
342 |
t::lib::Mocks::mock_userenv( |
343 |
{ branchcode => $library_1->branchcode, flags => 1 } ); |
344 |
|
345 |
my $reserve = AddReserve( |
346 |
{ |
347 |
branchcode => $library_1->branchcode, |
348 |
borrowernumber => $patron->borrowernumber, |
349 |
biblionumber => $item->biblionumber, |
350 |
} |
351 |
); |
352 |
|
353 |
ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); # Mark waiting |
354 |
|
355 |
my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new(); |
356 |
is( $ci_transaction->patron($sip_patron), |
357 |
$sip_patron, "Patron assigned to transaction" ); |
358 |
is( $ci_transaction->item($sip_item), |
359 |
$sip_item, "Item assigned to transaction" ); |
360 |
|
361 |
my $checkin = $ci_transaction->do_checkin($library_2->branchcode, C4::SIP::Sip::timestamp); |
362 |
|
363 |
my $hold = Koha::Holds->find($reserve); |
364 |
is( $hold->found, 'T', ); |
365 |
is( $hold->itemnumber, $item->itemnumber, ); |
366 |
is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); |
367 |
}; |
330 |
}; |
368 |
}; |
331 |
|
369 |
|
332 |
subtest checkin_lost => sub { |
370 |
subtest checkin_lost => sub { |
333 |
- |
|
|