From e31ca77c9ea0a04beaabd6f3c5f1b0be41c977d9 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 31 Jan 2019 16:25:59 -0300 Subject: [PATCH] Bug 21890: DB updates This patch adds a new column to the categories table: 'can_reset_password' which is a boolean, and represents, well... that. It also deletes the OpacResetPassword system preference, but first sets the OpacResetPassword value to all defined categories as it will be used in the same way. Signed-off-by: Kyle M Hall --- .../bug_21890_pwd_reset_by_category.perl | 29 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/sysprefs.sql | 1 - .../en/modules/admin/preferences/opac.pref | 8 ----- 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_21890_pwd_reset_by_category.perl diff --git a/installer/data/mysql/atomicupdate/bug_21890_pwd_reset_by_category.perl b/installer/data/mysql/atomicupdate/bug_21890_pwd_reset_by_category.perl new file mode 100644 index 0000000000..b39c4cd29d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21890_pwd_reset_by_category.perl @@ -0,0 +1,29 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + + if ( !column_exists( 'categories', 'can_reset_password' ) ) { + $dbh->do(q{ + ALTER TABLE categories + ADD COLUMN can_reset_password TINYINT(1) NOT NULL DEFAULT 0 + AFTER checkprevcheckout + }); + + # only change the values if the table + # didn't exits in the first place + $dbh->do(q{ + UPDATE categories + SET can_reset_password=( + SELECT COALESCE(value,'0') + FROM systempreferences + WHERE variable='OpacResetPassword') + }); + } + + $dbh->do(q{ + DELETE FROM systempreferences + WHERE variable='OpacResetPassword' + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 21890 - Patron password reset by category)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 89e71c94a5..16f9d5ae2a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -318,6 +318,7 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'. + `can_reset_password` TINYINT(1) NOT NULL DEFAULT 0, -- if patrons of this category can do the password reset flow PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d142b14a0e..433b34e031 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -397,7 +397,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'), ('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'), ('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|null','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'), -('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'), ('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'), ('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'), ('OPACSearchForTitleIn','
  • Other Libraries (WorldCat)
  • \n
  • Other Databases (Google Scholar)
  • \n
  • Online Stores (Bookfinder.com)
  • \n
  • Open Library (openlibrary.org)
  • ','70|10','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC. Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','Textarea'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index da1d86540c..4802ea8250 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -365,14 +365,6 @@ OPAC: yes: Allow no: "Don't allow" - patrons to change their own password on the OPAC. Note that this must be off to use LDAP authentication. - - - - "Library users are " - - pref: OpacResetPassword - default: 1 - choices: - yes: "allowed" - no: "not allowed" - - " to recover their password via e-mail in the OPAC" - - pref: OPACPatronDetails choices: -- 2.17.2 (Apple Git-113)