View | Details | Raw Unified | Return to bug 27196
Collapse All | Expand All

(-)a/C4/SIP/ILS/Transaction/Checkin.pm (-3 / +3 lines)
Lines 1-4 Link Here
1
#
1
2
# An object to handle checkin status
2
# An object to handle checkin status
3
#
3
#
4
4
Lines 121-129 sub do_checkin { Link Here
121
121
122
        } else {
122
        } else {
123
            $self->alert_type('02');
123
            $self->alert_type('02');
124
            ModReserveAffect( $messages->{ResFound}->{itemnumber},
124
            ModReserveAffect( $self->{item}->{itemnumber},
125
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
125
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
126
            ModItemTransfer( $messages->{ResFound}->{itemnumber},
126
            ModItemTransfer( $self->{item}->{itemnumber},
127
                $branch,
127
                $branch,
128
                $messages->{ResFound}->{branchcode}
128
                $messages->{ResFound}->{branchcode}
129
            );
129
            );
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +33 lines)
Lines 243-249 subtest do_hold => sub { Link Here
243
};
243
};
244
244
245
subtest do_checkin => sub {
245
subtest do_checkin => sub {
246
    plan tests => 11;
246
    plan tests => 12;
247
247
248
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
248
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
249
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
249
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
Lines 298-303 subtest do_checkin => sub { Link Here
298
    is_deeply($result,{ messages => { 'NotIssued' => $item->barcode, 'WasTransfered' => 1 } },"Messages show not issued and transferred");
298
    is_deeply($result,{ messages => { 'NotIssued' => $item->barcode, 'WasTransfered' => 1 } },"Messages show not issued and transferred");
299
    is( $ci_transaction->item->destination_loc,$library->branchcode,"Item destination correctly set");
299
    is( $ci_transaction->item->destination_loc,$library->branchcode,"Item destination correctly set");
300
300
301
    subtest 'Checkin an in transit item' => sub {
302
303
        plan tests => 5;
304
305
        my $library_1 = $builder->build_object({ class => 'Koha::Libraries' });
306
        my $library_2 = $builder->build_object({ class => 'Koha::Libraries' });
307
308
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {branchcode => $library_1->branchcode, }});
309
        my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
310
        my $item = $builder->build_sample_item({ library => $library_1->branchcode });
311
        my $sip_item   = C4::SIP::ILS::Item->new( $item->barcode );
312
313
        t::lib::Mocks::mock_userenv(
314
            { branchcode => $library_1->branchcode, flags => 1 } );
315
316
        my $reserve = AddReserve($library_1->branchcode,$patron->borrowernumber,$item->biblionumber);
317
318
        ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); # Mark waiting
319
320
        my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new();
321
        is( $ci_transaction->patron($sip_patron),
322
            $sip_patron, "Patron assigned to transaction" );
323
        is( $ci_transaction->item($sip_item),
324
            $sip_item, "Item assigned to transaction" );
325
326
        my $checkin = $ci_transaction->do_checkin($library_2->branchcode, C4::SIP::Sip::timestamp);
327
328
        my $hold = Koha::Holds->find($reserve);
329
        is( $hold->found, 'T', );
330
        is( $hold->itemnumber, $item->itemnumber, );
331
        is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, );
332
    };
301
};
333
};
302
334
303
subtest checkin_lost => sub {
335
subtest checkin_lost => sub {
304
- 

Return to bug 27196