From 3842ce90137345023a37e07b19a8f9ca6c85d73a Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Tue, 5 Aug 2025 17:04:20 -0400 Subject: [PATCH] Bug 21572: Dbrev - multi-selection for AllowItemsOnHoldCheckout sysprefs Update AllowItemsOnHoldCheckoutSIP and AllowItemsOnHoldCheckoutSCO to allow multiple selection, so that libraries can specify whether patrons should be allowed to check out items with found holds granularly according to hold status. The existing behavior for AllowItemsOnHoldCheckoutSIP is: Allow - allow items with pending holds (but no other hold status) to be checked out Don't allow - don't allow items to be checked out if any hold status is found (including pending/unassigned holds) The existing behavior for AllowItemsOnHoldCheckoutSCO is: Allow - allow items with holds in any status to be checked out Don't allow - don't allow items to be checked out if any hold status is found (including pending/unassigned holds) This patch retains existing behavior while giving libraries the opportunity to further customize which types of checkouts should be allowed in each case. This also resolves the behavior inconsistency between the SCO module and SIP-based self-checkouts. To test: 1. Before applying patch, go to Administration module and search for "AllowItemsOnHoldCheckout" in the system preference search 2. Set both preferences to Allow 3. Apply patch and updatedatabase 4. Search for "AllowItemsOnHoldCheckout" in the system preference search again (to reload the page without resubmitting) --> Confirm that both preferences now allow multiple selection --> Confirm that the system preferences have the following settings, to retain existing behavior: AllowItemsOnHoldCheckoutSIP - only Pending is checked AllowItemsOnHoldCheckoutSCO - all hold statuses are checked Bonus testing: Make some changes to the settings and run updatedatabase again. Confirm that your settings persist after the database update. --- .../data/mysql/atomicupdate/bug_21572.pl | 41 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 6 +-- .../admin/preferences/circulation.pref | 26 +++++++----- 3 files changed, 59 insertions(+), 14 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_21572.pl diff --git a/installer/data/mysql/atomicupdate/bug_21572.pl b/installer/data/mysql/atomicupdate/bug_21572.pl new file mode 100755 index 0000000000..dbcc391669 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21572.pl @@ -0,0 +1,41 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "21572", + description => "Update AllowItemsOnHoldCheckoutSIP and AllowItemsOnHoldCheckoutSCO to allow multiple selections", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Current behavior for AllowItemsOnHoldCheckoutSIP, if set to Allow, is to allow checkout of items with pending holds only + # Set the new value accordingly to preserve existing behavior on upgrade + $dbh->do( + q{ + UPDATE systempreferences + SET options='pending|processing|transferred|waiting', + value=CASE value WHEN '1' THEN 'pending' WHEN '0' THEN '' ELSE value END, + type='multiple', + explanation='When checking out an item via SIP, if a hold for another patron is found, allow the checkout for the following hold statuses' + WHERE variable='AllowItemsOnHoldCheckoutSIP' + } + ); + say_success( $out, "Updated system preference AllowItemsOnHoldCheckoutSIP" ); + + # Current behavior for AllowItemsOnHoldCheckoutSCO, if set to Allow, is to allow checkout of items with both pending and waiting holds + # Otherwise don't allow checkout of either + # Set the new value accordingly to preserve existing behavior on upgrade + $dbh->do( + q{ + UPDATE systempreferences + SET options='pending|processing|transferred|waiting', + value=CASE value WHEN '1' THEN 'pending,processing,transferred,waiting' WHEN '0' THEN '' ELSE value END, + type='multiple', + explanation='When checking out an item in SCO module, if a hold for another patron is found, allow the checkout for the following hold statuses' + WHERE variable='AllowItemsOnHoldCheckoutSCO' + } + ); + say_success( $out, "Updated system preference AllowItemsOnHoldCheckoutSCO" ); + + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 67cd533daf..5c56bb01c1 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -35,8 +35,8 @@ 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'), -('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'), +('AllowItemsOnHoldCheckoutSCO','','pending|processing|transferred|waiting','When checking out an item in SCO module, if a hold for another patron is found, allow the checkout for the following hold statuses','multiple'), +('AllowItemsOnHoldCheckoutSIP','','pending|processing|transferred|waiting','When checking out an item via SIP, if a hold for another patron is found, allow the checkout for the following hold statuses','multiple'), ('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'), ('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'), @@ -889,4 +889,4 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), ('z3950Status','','','This syspref allows to define custom YAML based rules for marking items unavailable in z3950 results.','Textarea') -; \ No newline at end of file +; 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 ef3c7acc01..1f297c2073 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 @@ -230,13 +230,14 @@ Circulation: 0: "Don't allow" - staff to renew items that are on hold by manually specifying a due date. - + - "When checking out an item via SIP, if a hold for another patron is found, allow the checkout for the following hold statuses:" - pref: AllowItemsOnHoldCheckoutSIP - choices: - 1: Allow - 0: "Don't allow" - - 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". + multiple: + pending: "Pending" + processing: "Processing" + transferred: "In transit" + waiting: "Waiting" + - . - - pref: AllowItemsOnLoanCheckoutSIP choices: @@ -246,11 +247,14 @@ Circulation: - If allowed do not generate ISSUED_TO_ANOTHER warning. - This allows self-checkouts for those items. - + - "When checking out an item in the SCO module, if a hold for another patron is found, allow the checkout for the following hold statuses:" - pref: AllowItemsOnHoldCheckoutSCO - choices: - 1: Allow - 0: "Don't allow" - - checkouts of items reserved to someone else in the SCO module. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self-checkouts for those items. + multiple: + pending: "Pending" + processing: "Processing" + transferred: "In transit" + waiting: "Waiting" + - . - - pref: AllFinesNeedOverride choices: @@ -1534,4 +1538,4 @@ Circulation: choices: 1: Enable 0: Disable - - "the curbside pickup module." \ No newline at end of file + - "the curbside pickup module." -- 2.34.1