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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2020-08-13 17:52:18 +01:00 committed by Jonathan Druart
parent e510386879
commit 978daf8412
2 changed files with 17 additions and 2 deletions

View File

@ -14,6 +14,8 @@
<span>(Item is withdrawn and check-in blocked by policy, please see library staff for assistance)</span>
[% ELSIF messages.NotIssued %]
<span>(The book is not currently on loan, please see library staff for assistance)</span>
[% ELSIF messages.additional_materials %]
<span>(The item cannot be returned at a self service terminal, please see library staff for assistance)</span>
[% ELSE %]
<span>(There was a problem returning this item, please see library staff for assistance)</span>
[% END %]

View File

@ -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,
{