From 978daf841293cd7fa7dae7163b672d130c006362 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 13 Aug 2020 17:52:18 +0100 Subject: [PATCH] Bug 25261: (QA follow-up) Add handling to SCI Test plan 1/ Enable the feature as per previous patches 2/ Attempt to return an item with materials attached via the SCI 3/ Note that the return is blocked with the message '(The item cannot be returned at a self service terminal, please see library staff for assistance)' 4/ Signoff Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../bootstrap/en/modules/sci/sci-main.tt | 2 ++ opac/sci/sci-main.pl | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt index d719cc07bc..2472c31f9a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt @@ -14,6 +14,8 @@ (Item is withdrawn and check-in blocked by policy, please see library staff for assistance) [% ELSIF messages.NotIssued %] (The book is not currently on loan, please see library staff for assistance) + [% ELSIF messages.additional_materials %] + (The item cannot be returned at a self service terminal, please see library staff for assistance) [% ELSE %] (There was a problem returning this item, please see library staff for assistance) [% END %] diff --git a/opac/sci/sci-main.pl b/opac/sci/sci-main.pl index 0128873487..e62f6a5c2f 100755 --- a/opac/sci/sci-main.pl +++ b/opac/sci/sci-main.pl @@ -22,6 +22,7 @@ use CGI qw ( -utf8 ); use C4::Auth qw(get_template_and_user checkpw); use C4::Circulation; use C4::Output; +use Koha::Items; use List::MoreUtils qw( uniq ); use Try::Tiny; @@ -64,8 +65,20 @@ if ( $op eq 'check_in' ) { # Return items foreach my $barcode (@barcodes) { try { - my ( $success, $messages, $checkout, $patron ) = - AddReturn( $barcode, $library ); + my ( $success, $messages, $checkout, $patron ); + my $item = Koha::Items->find( { barcode => $barcode } ); + my $human_required = 0; + if ( C4::Context->preference("CircConfirmItemParts") + && defined($item) + && $item->materials ) + { + $human_required = 1; + $success = 0; + $messages->{additional_materials} = 1; + } + + ( $success, $messages, $checkout, $patron ) = + AddReturn( $barcode, $library ) unless $human_required; if ($success) { push @success, { -- 2.39.5