From 6a4849f385202a17f63b5184aaac15bee77def31 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 --- .../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 f7d166e715..e0167f728d 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 84d2a6cb67..d4c561a1a5 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; @@ -65,8 +66,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.20.1