From 7f2d38d85e7b4e53217f060eda110e75e789f532 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 29 Jun 2023 08:06:51 -0400 Subject: [PATCH] Bug 34153: Add ability to allow items with additional materials notes to be checked out via SIP At this time, any item with an additional materials date is blocked from checkout via SIP with a screen message to take the item to a circulation desk for checkout. Some libraries wish to allow patrons to check out items via SIP even if the item has additional materials. Test Plan: 1) Create an item with an additional materials note 2) Attempt to check it out via SIP 3) Note the failure and message 4) Enable the new SIP account option "allow_additional_materials_checkout" 5) Restart the SIP server 6) Attempt the checkout again 7) Note the checkout success and new AF field message! 8) prove t/db_dependent/SIP/Message.t Signed-off-by: David Nind Signed-off-by: Victor Grousset/tuxayo Rebased-by: Victor Grousset/tuxayo Signed-off-by: Tomas Cohen Arazi --- C4/SIP/ILS/Transaction/Checkout.pm | 13 ++++++++++--- etc/SIPconfig.xml | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index f2b6007908..46674f7f9f 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -18,6 +18,7 @@ use C4::Context; use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ProcessOfflineIssue ); use C4::Members; use Koha::DateUtils qw( dt_from_string ); +use Koha::Items; use parent qw(C4::SIP::ILS::Transaction); @@ -48,6 +49,7 @@ sub do_checkout { my $patron = Koha::Patrons->find($self->{patron}->{borrowernumber}); my $overridden_duedate; # usually passed as undef to AddIssue my $prevcheckout_block_checkout = $account->{prevcheckout_block_checkout}; + my $allow_additional_materials_checkout = $account->{allow_additional_materials_checkout}; my ($issuingimpossible, $needsconfirmation, $messages) = _can_we_issue($patron, $barcode, 0); if ( $no_block_due_date ) { @@ -105,9 +107,14 @@ sub do_checkout { $noerror = 0 if ($prevcheckout_block_checkout); last; } elsif ( $confirmation eq 'ADDITIONAL_MATERIALS' ) { - $self->screen_msg('Item must be checked out at a circulation desk'); - $noerror = 0; - last; + if ( $allow_additional_materials_checkout ) { + my $item = Koha::Items->find({ barcode => $barcode }); + $self->screen_msg( 'Item has additional materials: ' . $item->materials ); + } else { + $self->screen_msg('Item must be checked out at a circulation desk'); + $noerror = 0; + last; + } } elsif ( $confirmation eq 'RECALLED' ) { $self->screen_msg('Item has been recalled for another patron'); $noerror = 0; diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 6f131f4ce8..c696c8376e 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -70,6 +70,7 @@ da_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]" av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" hide_fields="BD,BE,BF,PB" + allow_additional_materials_checkout="1" register_id='' holds_block_checkin="0" holds_get_captured="1" -- 2.39.5