From 643f7dfb67f3aa0a24ae3ceb8bb2535d2f470a0f 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 --- .../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 14cef909b3..c0784c492a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1806,6 +1806,7 @@ 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', + `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 d2976e2d43..6d8ccf1183 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 @@ -472,6 +472,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.2