From b4e465b4724e9911b75fd71324f192d6d783b254 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 29 Aug 2025 13:54:17 +0100 Subject: [PATCH] Bug 27834: Add CheckoutLimitScope system preference This adds a new system preference CheckoutLimitScope to control how checkout limits are calculated when CircControl is set to PickupLibrary or ItemHomeLibrary. The preference has two options: - branch_specific: Count only checkouts matching the circulation rule context (traditional PickupLibrary/ItemHomeLibrary behavior) - all: Count all patron checkouts regardless of branch (PatronLibrary behavior) Sponsored-by: University of the Arts London --- .../data/mysql/atomicupdate/bug_27834.pl | 22 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + 2 files changed, 23 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..6d8ccdca0ec --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27834.pl @@ -0,0 +1,22 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "27834", + description => + "Add CheckoutLimitScope system preference to separate circulation rule selection from checkout counting", + 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 + ('CheckoutLimitScope', 'branch_specific', 'all|branch_specific', 'Determines how checkout limits are calculated when CircControl is set to PickupLibrary or ItemHomeLibrary. "all" counts all patron checkouts regardless of branch (PatronLibrary behavior). "branch_specific" counts only checkouts matching the circulation rule context (traditional PickupLibrary/ItemHomeLibrary behavior).', 'Choice') + } + ); + + say_success( $out, "Added CheckoutLimitScope system preference" ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 7fb46c297ee..86d5673afc9 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'), +('CheckoutLimitScope', 'branch_specific', 'all|branch_specific', 'Determines how checkout limits are calculated when CircControl is set to PickupLibrary or ItemHomeLibrary. "all" counts all patron checkouts regardless of branch (PatronLibrary behavior). "branch_specific" counts only checkouts matching the circulation rule context (traditional PickupLibrary/ItemHomeLibrary behavior).', '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