From 77569e30fe4b354a44e18a906106d23633e6382d Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 22 Jan 2024 12:14:02 +0000 Subject: [PATCH] Bug 28924: Add 3 new columns to categories table This patch adds three new columns to the patron categories table: noissuescharge noissueschargegurantees noissueschargeguarantorswithguarantees These values will allow charge limits to be set at category level rather than globally for all patrons. If the values are not set at category level then the system will use the global level values Sponsored-by: Cuyahoga County Public Library Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- .../atomicupdate/bug_28924-noissuescharges.pl | 30 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 3 ++ 2 files changed, 33 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_28924-noissuescharges.pl diff --git a/installer/data/mysql/atomicupdate/bug_28924-noissuescharges.pl b/installer/data/mysql/atomicupdate/bug_28924-noissuescharges.pl new file mode 100755 index 0000000000..d3ca993ffe --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_28924-noissuescharges.pl @@ -0,0 +1,30 @@ +use Modern::Perl; + +return { + bug_number => "28924", + description => "Adds columns to patron categories to allow category level values for the no issue charge sysprefs", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + unless ( column_exists( 'categories', 'noissuescharge' ) ) { + $dbh->do( + q{ ALTER TABLE categories ADD COLUMN `noissuescharge` int(11) AFTER `exclude_from_local_holds_priority` } + ); + + say $out "Added column 'noissuescharge' to categories"; + } + unless ( column_exists( 'categories', 'noissueschargeguarantees' ) ) { + $dbh->do(q{ ALTER TABLE categories ADD COLUMN `noissueschargeguarantees` int(11) AFTER `noissuescharge` }); + + say $out "Added column 'noissueschargeguarantees' to categories"; + } + unless ( column_exists( 'categories', 'noissueschargeguarantorswithguarantees' ) ) { + $dbh->do( + q{ ALTER TABLE categories ADD COLUMN `noissueschargeguarantorswithguarantees` int(11) AFTER `noissueschargeguarantees` } + ); + + say $out "Added column 'noissueschargeguarantorswithguarantees' to categories"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 7499810da8..4715341cd1 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1806,6 +1806,9 @@ CREATE TABLE `categories` ( `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category', `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category', `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority', + `noissuescharge` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', + `noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', + `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount withstanding before checkouts are blocked', PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;