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 149-157 sub do_checkin { Link Here
149
        } else {
149
        } else {
150
            $self->hold($messages->{ResFound});
150
            $self->hold($messages->{ResFound});
151
            $self->alert_type('02');
151
            $self->alert_type('02');
152
            ModReserveAffect( $messages->{ResFound}->{itemnumber},
152
            ModReserveAffect( $item->itemnumber,
153
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
153
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
154
            ModItemTransfer( $messages->{ResFound}->{itemnumber},
154
            ModItemTransfer( $item->itemnumber,
155
                $branch,
155
                $branch,
156
                $messages->{ResFound}->{branchcode},
156
                $messages->{ResFound}->{branchcode},
157
                $messages->{TransferTrigger},
157
                $messages->{TransferTrigger},
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +40 lines)
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 => 8;
275
    plan tests => 9;
276
276
277
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
277
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
278
    my $patron = $builder->build_object(
278
    my $patron = $builder->build_object(
Lines 320-325 subtest do_checkin => sub { Link Here
320
    is( $patron->checkouts->count, 1, 'Checkout should have been done successfully');
320
    is( $patron->checkouts->count, 1, 'Checkout should have been done successfully');
321
    $ci_transaction->do_checkin($library->branchcode, undef);
321
    $ci_transaction->do_checkin($library->branchcode, undef);
322
    is( $patron->checkouts->count, 0, 'Checkin should have been done successfully');
322
    is( $patron->checkouts->count, 0, 'Checkin should have been done successfully');
323
324
    subtest 'Checkin an in transit item' => sub {
325
326
        plan tests => 5;
327
328
        my $library_1 = $builder->build_object({ class => 'Koha::Libraries' });
329
        my $library_2 = $builder->build_object({ class => 'Koha::Libraries' });
330
331
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {branchcode => $library_1->branchcode, }});
332
        my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
333
        my $item = $builder->build_sample_item({ library => $library_1->branchcode });
334
        my $sip_item   = C4::SIP::ILS::Item->new( $item->barcode );
335
336
        t::lib::Mocks::mock_userenv(
337
            { branchcode => $library_1->branchcode, flags => 1 } );
338
339
        my $reserve = AddReserve(
340
            {
341
                branchcode     => $library_1->branchcode,
342
                borrowernumber => $patron->borrowernumber,
343
                biblionumber   => $item->biblionumber,
344
            }
345
        );
346
347
        ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); # Mark waiting
348
349
        my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new();
350
        is( $ci_transaction->patron($sip_patron),
351
            $sip_patron, "Patron assigned to transaction" );
352
        is( $ci_transaction->item($sip_item),
353
            $sip_item, "Item assigned to transaction" );
354
355
        my $checkin = $ci_transaction->do_checkin($library_2->branchcode, C4::SIP::Sip::timestamp);
356
357
        my $hold = Koha::Holds->find($reserve);
358
        is( $hold->found, 'T', );
359
        is( $hold->itemnumber, $item->itemnumber, );
360
        is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, );
361
    };
323
};
362
};
324
363
325
subtest checkin_lost => sub {
364
subtest checkin_lost => sub {
326
- 

Return to bug 27196