From 8c561d950f511423f88da9917aa44325f244ab39 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 Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- 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 3e77abf602..e3bbedebb8 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -20,6 +20,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 %supports = ( 'magnetic media' => 1, 'security inhibit' => 0, @@ -161,6 +163,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 c13e568260..40165a9e53 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -88,7 +88,9 @@ sub do_checkout { { $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 9972bc4972..03d72afbb7 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -34,6 +34,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowHoldPolicyOverride','0',NULL,'Allow staff to override hold policies when placing holds','YesNo'), ('AllowHoldsOnDamagedItems','1','','Allow hold requests to be placed on damaged items','YesNo'), ('AllowHoldsOnPatronsPossessions','1',NULL,'Allow holds on records that patron have items of it','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'), ('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'), ('AllowMultipleCovers','0','1','Allow multiple cover images to be attached to each bibliographic record.','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 3ba6d9b036..76983576a6 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 @@ -226,6 +226,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.39.5