From b59192c09a01902eb3a94df1c11b6cd08fe97796 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 13 Aug 2020 16:44:28 +0100 Subject: [PATCH] Bug 25261: (QA follow-up) Catch check in SIP Checkin Test plan 1/ Enable the feature as per previous patches 2/ Attempt to return an item with materials attached via a SIP unit 3/ Note that the return is blocked with an alert type of '99' 4/ Signoff Signed-off-by: Martin Renvoize --- C4/SIP/ILS/Transaction/Checkin.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 10cd87b5ad..ee5144a96d 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -16,6 +16,7 @@ use C4::Debug; use C4::Items qw( ModItemTransfer ); use C4::Reserves qw( ModReserveAffect ); use Koha::DateUtils qw( dt_from_string ); +use Koha::Items; use parent qw(C4::SIP::ILS::Transaction); @@ -71,8 +72,21 @@ sub do_checkin { $return_date = dt_from_string($return_date); } + my ( $return, $messages, $issue, $borrower ); + my $item = Koha::Items->find( { barcode => $barcode } ); + my $human_required = 0; + if ( C4::Context->preference("CircConfirmItemParts") + && defined($item) + && $item->materials ) + { + $human_required = 1; + $messages->{additional_materials} = 1; + } + $debug and warn "do_checkin() calling AddReturn($barcode, $branch)"; - my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, $return_date); + ( $return, $messages, $issue, $borrower ) = + AddReturn( $barcode, $branch, undef, $return_date ) + unless $human_required; if ( $checked_in_ok ) { delete $messages->{ItemLocationUpdated}; @@ -84,6 +98,9 @@ sub do_checkin { # biblionumber, biblioitemnumber, itemnumber # borrowernumber, reservedate, branchcode # cancellationdate, found, reservenotes, priority, timestamp + if ($messages->{additional_materials}) { + $self->alert_type('99'); + } if( $messages->{DataCorrupted} ) { $self->alert_type('98'); } -- 2.20.1