From feb1ab6c3e1d3f4121dc95a35ed02b6f0b1fc1f2 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 19 Jul 2021 04:16:44 +0000 Subject: [PATCH] Bug 18317: Allow check out of already checked out items through SIP This patch allows checkouts to be processed via SIP even when the item is already checked out to a user. Test plan: 0) Apply the patch 1) koha-sip --stop kohadev 2) koha-sip --start kohadev 3) misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkout --patron koha --item 39999000001310 4) misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkout --patron 23529000035676 --item 39999000001310 5) Note the output includes "AFItem checked out to another patron" 6) Enable system preference "AllowItemsOnLoanCheckoutSIP" 7) misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkout --patron 23529000035676 --item 39999000001310 8) Note the output no longer includes "AFItem checked out to another patron" and the item has been checked out to patron 23529000035676 --- C4/SIP/ILS.pm | 3 +++ C4/SIP/ILS/Transaction/Checkout.pm | 4 +++- installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 3e5b6a4824..f936755cd3 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -19,6 +19,8 @@ use C4::SIP::ILS::Transaction::Hold; use C4::SIP::ILS::Transaction::Renew; use C4::SIP::ILS::Transaction::RenewAll; +use C4::Context; #BZ 18317 + my $debug = 0; my %supports = ( @@ -148,6 +150,7 @@ sub checkout { $circ->screen_msg("Invalid Item"); } elsif ( $item->{borrowernumber} + && ! C4::Context->preference('AllowItemsOnLoanCheckoutSIP') #BZ 18317 && !_ci_cardnumber_cmp( $item->{borrowernumber}, $patron->borrowernumber ) ) { $circ->screen_msg("Item checked out to another patron"); diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index 2386d90fa1..d3d153db00 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -80,7 +80,9 @@ sub do_checkout { $debug and warn "Item is on hold for another patron."; $self->screen_msg("Item is on hold for another patron."); $noerror = 0; - } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') { + } elsif ($confirmation eq 'ISSUED_TO_ANOTHER' and C4::Context->preference("AllowItemsOnLoanCheckoutSIP")) { #BZ 18317 + next; + } elsif ($confirmation eq 'ISSUED_TO_ANOTHER' and ! C4::Context->preference("AllowItemsOnLoanCheckoutSIP")) { #BZ 18317 $self->screen_msg("Item already checked out to another patron. Please return item for check-in."); $noerror = 0; last; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 0a86168ee0..f9bd16cae6 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -31,6 +31,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowHoldsOnPatronsPossessions','1',NULL,'Allow holds on records that patron have items of it','YesNo'), ('AllowCheckoutNotes', '0', NULL, 'Allow patrons to submit notes about checked out items.','YesNo'), ('AllowItemsOnHoldCheckoutSIP','0','','Do not generate RESERVED warning when checking out items reserved to someone else via SIP. This allows self checkouts for those items.','YesNo'), +('AllowItemsOnLoanCheckoutSIP','0','','Do not generate ISSUED_TO_ANOTHER warning when checking out items already checked out to someone else via SIP. This allows self checkouts for those items.','YesNo'), ('AllowItemsOnHoldCheckoutSCO','0','','Do not generate RESERVE_WAITING and RESERVED warning in the SCO module when checking out items reserved to someone else. This allows self checkouts for those items.','YesNo'), ('AllowMultipleCovers','0','1','Allow multiple cover images to be attached to each bibliographic record.','YesNo'), ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 0bf3b7c518..317edbf12b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -220,6 +220,14 @@ Circulation: - checkouts of items reserved to someone else via SIP checkout messages. - If allowed do not generate RESERVED warning. - This allows self checkouts for those items. If using the holds queue items with pending holds will be marked as "unavailable" if this set to "Don't allow". + - + - pref: AllowItemsOnLoanCheckoutSIP + choices: + 1: Allow + 0: "Don't allow" + - checkouts of items already checked out to someone else via SIP checkout messages. + - If allowed do not generate ISSUED_TO_ANOTHER warning. + - This allows self checkouts for those items. - - pref: AllowItemsOnHoldCheckoutSCO choices: -- 2.20.1