Bug 27196: Don't explode if item that is waiting if checked in by SIP
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6b9b7d8e77)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
b14cf9f64b
commit
034194c8fd
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
|
||||
# An object to handle checkin status
|
||||
#
|
||||
|
||||
|
|
@ -149,9 +149,9 @@ sub do_checkin {
|
|||
} else {
|
||||
$self->hold($messages->{ResFound});
|
||||
$self->alert_type('02');
|
||||
ModReserveAffect( $messages->{ResFound}->{itemnumber},
|
||||
ModReserveAffect( $item->itemnumber,
|
||||
$messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
|
||||
ModItemTransfer( $messages->{ResFound}->{itemnumber},
|
||||
ModItemTransfer( $item->itemnumber,
|
||||
$branch,
|
||||
$messages->{ResFound}->{branchcode},
|
||||
$messages->{TransferTrigger},
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ subtest do_hold => sub {
|
|||
};
|
||||
|
||||
subtest do_checkin => sub {
|
||||
plan tests => 11;
|
||||
plan tests => 12;
|
||||
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
|
|
@ -327,6 +327,44 @@ 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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue