From ba466c9174fe1e392fe26b727bbd695e071c7c67 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 29 Aug 2025 13:54:17 +0100 Subject: [PATCH] Bug 27834: Database update - Add CircControlCheckoutLimitScope system preference This patch adds the database components for the new CircControlCheckoutLimitScope system preference. The preference provides three explicit options for controlling how checkout limits (maxissueqty and patron_maxissueqty) are calculated: * 'all' (default) - Count all patron checkouts across all libraries * 'item' - Count only checkouts of items from the same library as the item being checked out (follows HomeOrHoldingBranch preference) * 'checkout' - Count only checkouts made at the same library as the current checkout This gives libraries explicit control over checkout limit scope, independent of the CircControl preference. Sponsored-by: University of the Arts London --- .../data/mysql/atomicupdate/bug_27834.pl | 21 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + 2 files changed, 22 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_27834.pl diff --git a/installer/data/mysql/atomicupdate/bug_27834.pl b/installer/data/mysql/atomicupdate/bug_27834.pl new file mode 100755 index 00000000000..af9c320ad23 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27834.pl @@ -0,0 +1,21 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "27834", + description => "Add CircControlCheckoutLimitScope system preference with explicit scope options", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Add new system preference + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES + ('CircControlCheckoutLimitScope', 'all', 'all|item|checkout', 'Determines how checkout limits are calculated. "all" counts all patron checkouts across all libraries. "item" counts only checkouts of items from the same library as the item being checked out (uses HomeOrHoldingBranch preference). "checkout" counts only checkouts made at the same library as the current checkout.', 'Choice') + } + ); + + say_success( $out, "Added CircControlCheckoutLimitScope system preference" ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 0d77d5ba947..d65135ec99b 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -155,6 +155,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'), ('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'), ('ChargeFinesOnClosedDays','0',NULL,'Charge fines on days the library is closed.','YesNo'), +('CircControlCheckoutLimitScope', 'all', 'all|item|checkout', 'Determines how checkout limits are calculated. "all" counts all patron checkouts across all libraries. "item" counts only checkouts of items from the same library as the item being checked out (uses HomeOrHoldingBranch preference). "checkout" counts only checkouts made at the same library as the current checkout.', 'Choice'), ('CheckPrevCheckout','hardno','hardyes|softyes|softno|hardno','By default, for every item checked out, should we warn if the patron has borrowed that item in the past?','Choice'), ('CheckPrevCheckoutDelay','0', NULL,'Maximum number of days that will trigger a warning if the patron has borrowed that item in the past when CheckPrevCheckout is enabled.','free'), ('ChildNeedsGuarantor', 0, 'If ON, a child patron must have a guarantor when adding the patron.', '', 'YesNo'), -- 2.51.0