From dd9e387b68c01f731ec5f37443f98d26b1ef937c Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Thu, 6 Jun 2024 18:52:13 +0000 Subject: [PATCH] Bug 33462: DB Updates Signed-off-by: Laura_Escamilla Signed-off-by: Olivier V Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer --- .../data/mysql/atomicupdate/bug_33462.pl | 23 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + .../en/modules/admin/preferences/patrons.pref | 8 ++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33462.pl diff --git a/installer/data/mysql/atomicupdate/bug_33462.pl b/installer/data/mysql/atomicupdate/bug_33462.pl new file mode 100755 index 0000000000..d74effdfec --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33462.pl @@ -0,0 +1,23 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "33462", + description => "Force password reset for new patrons entered by staff", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) +VALUES ('ForcePasswordResetWhenSetByStaff', '0', NULL,'Force a staff created patron account to reset its password after its first OPAC login.', 'YesNo') + }); + say $out "Added new system preference 'ForcePasswordResetWhenSetByStaff'"; + + if( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) { + $dbh->do("ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password` -- if patrons of this category are required to reset password after being created by a staff member"); + } + + say $out "Added column to categories 'force_password_reset_when_set_by_staff'"; + + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 7d9abcd082..32c9cb8665 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1811,6 +1811,7 @@ CREATE TABLE `categories` ( `noissuescharge` int(11) DEFAULT NULL COMMENT 'define maximum amount outstanding before checkouts are blocked', `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', + `force_password_reset_when_set_by_staff` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category are required to reset password after being created by a staff member', PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 2fea4509c6..f593a80612 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -1,4 +1,4 @@ -Patrons: +fPatrons: General: - - pref: CheckPrevCheckout @@ -479,6 +479,12 @@ Patrons: - pref: FailedLoginAttempts class: integer - failed login attempts. + - + - pref: ForcePasswordResetWhenSetByStaff + choices: + 1: "Force" + 0: "Don't force" + - a staff created patron account to reset its password after its first OPAC login. - - pref: Pseudonymization choices: -- 2.39.5