From 79b65f536ba9297390272b655a5518f12100ab6d Mon Sep 17 00:00:00 2001 From: Victor Grousset/tuxayo Date: Sat, 23 Jan 2021 02:02:57 +0100 Subject: [PATCH] Revert "Bug 27196: [20.05.x] Don't explode if item that is waiting if checked in by SIP" Patch not working, forgot to undo the backport before pushing. This reverts commit e8ea682d492f029811d503dc2788a54a29a0bd35. Signed-off-by: Victor Grousset/tuxayo --- C4/SIP/ILS/Transaction/Checkin.pm | 6 ++--- t/db_dependent/SIP/Transaction.t | 40 +------------------------------ 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 3d5933de8d..ba1b35e3c0 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -1,4 +1,4 @@ - +# # An object to handle checkin status # @@ -121,9 +121,9 @@ sub do_checkin { } else { $self->alert_type('02'); - ModReserveAffect( $self->{item}->{itemnumber}, + ModReserveAffect( $messages->{ResFound}->{itemnumber}, $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id}); - ModItemTransfer( $self->{item}->{itemnumber}, + ModItemTransfer( $messages->{ResFound}->{itemnumber}, $branch, $messages->{ResFound}->{branchcode} ); diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 81e5de5b0c..5945188eae 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -243,7 +243,7 @@ subtest do_hold => sub { }; subtest do_checkin => sub { - plan tests => 12; + plan tests => 11; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); @@ -298,44 +298,6 @@ subtest do_checkin => sub { is_deeply($result,{ messages => { 'NotIssued' => $item->barcode, 'WasTransfered' => 1 } },"Messages show not issued and transferred"); is( $ci_transaction->item->destination_loc,$library->branchcode,"Item destination correctly set"); - subtest 'Checkin an in transit item' => sub { - - plan tests => 5; - - my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); - my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); - - my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {branchcode => $library_1->branchcode, }}); - my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); - my $item = $builder->build_sample_item({ library => $library_1->branchcode }); - my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); - - t::lib::Mocks::mock_userenv( - { branchcode => $library_1->branchcode, flags => 1 } ); - - my $reserve = AddReserve( - { - branchcode => $library_1->branchcode, - borrowernumber => $patron->borrowernumber, - biblionumber => $item->biblionumber, - } - ); - - ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); # Mark waiting - - my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new(); - is( $ci_transaction->patron($sip_patron), - $sip_patron, "Patron assigned to transaction" ); - is( $ci_transaction->item($sip_item), - $sip_item, "Item assigned to transaction" ); - - my $checkin = $ci_transaction->do_checkin($library_2->branchcode, C4::SIP::Sip::timestamp); - - my $hold = Koha::Holds->find($reserve); - is( $hold->found, 'T', ); - is( $hold->itemnumber, $item->itemnumber, ); - is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); - }; }; subtest checkin_lost => sub { -- 2.39.5