From 08a0a95253e9a67c40c4603e19a9b3c6f01ef729 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 --- 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 2184f13e1b..4b75e324a7 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 b58114d802..cbbd860784 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`, ` ('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 40f2d65a81..fe5fa496a6 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.30.2