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 <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle M Hall 2023-06-29 08:06:51 -04:00 committed by Tomas Cohen Arazi
parent 7bb4d94930
commit 7f2d38d85e
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 11 additions and 3 deletions

View File

@ -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;

View File

@ -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"