Bug 26355: Add new columns to the patron categories table

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Matt Blenkinsop 2026-02-19 13:23:45 +00:00 committed by Lucas Gass
parent f0436bd140
commit dfcb16a9ce
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,78 @@
use Modern::Perl;
use Koha::Installer::Output qw(say_warning say_success say_info);
return {
bug_number => "26355",
description => "Patron self-renewal",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
unless ( column_exists( 'categories', 'self_renewal_enabled' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_enabled` tinyint(1) NOT NULL DEFAULT 0
COMMENT 'allow self renewal for this category'
AFTER `enforce_expiry_notice`
}
);
say_success( $out, "Added column 'self_renewal_enabled' to categories" );
}
unless ( column_exists( 'categories', 'self_renewal_availability_start' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_availability_start` smallint(6) DEFAULT NULL
COMMENT 'how long before the patron expiry date self-renewal should be made available (overrides system default of NotifyBorrowerDeparture)'
AFTER `self_renewal_enabled`
}
);
say_success( $out, "Added column 'self_renewal_availability_start' to categories" );
}
unless ( column_exists( 'categories', 'self_renewal_fines_block' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_fines_block` int(11) DEFAULT NULL
COMMENT 'the amount owed in fines before self renewal is blocked (overrides system default of noissuescharge)'
AFTER `self_renewal_availability_start`
}
);
say_success( $out, "Added column 'self_renewal_fines_block' to categories" );
}
unless ( column_exists( 'categories', 'self_renewal_if_expired' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_if_expired` smallint(6) DEFAULT 0
COMMENT 'how long after expiry a patron can self renew their account'
AFTER `self_renewal_fines_block`
}
);
say_success( $out, "Added column 'self_renewal_if_expired' to categories" );
}
unless ( column_exists( 'categories', 'self_renewal_failure_message' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_failure_message` mediumtext DEFAULT NULL
COMMENT 'the message to display if self renewal is not successful'
AFTER `self_renewal_fines_block`
}
);
say_success( $out, "Added column 'self_renewal_failure_message' to categories" );
}
unless ( column_exists( 'categories', 'self_renewal_information_message' ) ) {
$dbh->do(
q{
ALTER TABLE categories ADD COLUMN `self_renewal_information_message` mediumtext DEFAULT NULL
COMMENT 'the message to display if self renewal is not successful'
AFTER `self_renewal_failure_message`
}
);
say_success( $out, "Added column 'self_renewal_information_message' to categories" );
}
},
};

View File

@ -1827,6 +1827,12 @@ CREATE TABLE `categories` (
`noissueschargeguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantees of a patron in this category can have outstanding before checkouts are blocked',
`noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantors with guarantees of a patron in this category can have outstanding before checkouts are blocked',
`enforce_expiry_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'enforce the patron expiry notice for this category',
`self_renewal_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'allow self renewal for this category',
`self_renewal_availability_start` smallint(6) DEFAULT NULL COMMENT 'how long before the patron expiry date self-renewal should be made available (overrides system default of NotifyBorrowerDeparture)',
`self_renewal_fines_block` int(11) DEFAULT NULL COMMENT 'the amount owed in fines before self renewal is blocked (overrides system default of noissuescharge)',
`self_renewal_if_expired` smallint(6) DEFAULT 0 COMMENT 'how long after expiry a patron can self renew their account',
`self_renewal_failure_message` mediumtext DEFAULT NULL COMMENT 'the message to display if self renewal is not successful',
`self_renewal_information_message` mediumtext DEFAULT NULL COMMENT 'the message to display before the self renewal process starts',
PRIMARY KEY (`categorycode`),
UNIQUE KEY `categorycode` (`categorycode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;