From ca6b284b590994ff8185b2e288aa097cf2bf517b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 4 Jun 2018 13:11:58 +0200 Subject: [PATCH] Bug 20819: Dbrev for new table patron_consent and sysprefs Content-Type: text/plain; charset=utf-8 [1] We add table patron_consent. It allows for future extension. We could e.g. save consent for newsletter etc. [2] Add one field to borrower_modifications Datetime the patron who self-registered, gave consent. [3] Syspref PrivacyPolicyURL [4] Syspref GDPR_Policy: enforced, permissive or disabled. Test plan: [1] Run the dbrev or do a new install. [2] Look at the description of the new prefs in Administration. Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/bug_20819.perl | 22 ++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 16 ++++++++++++++++ installer/data/mysql/sysprefs.sql | 2 ++ .../prog/en/modules/admin/preferences/patrons.pref | 13 +++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_20819.perl diff --git a/installer/data/mysql/atomicupdate/bug_20819.perl b/installer/data/mysql/atomicupdate/bug_20819.perl new file mode 100644 index 0000000..99ffc08 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_20819.perl @@ -0,0 +1,22 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + # Add table and add column + $dbh->do(q| +CREATE TABLE patron_consent (id int AUTO_INCREMENT, borrowernumber int NOT NULL, type enum('GDPR_PROCESSING' ), given_on datetime, refused_on datetime, PRIMARY KEY (id), FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE ) + |); + $dbh->do(q| +ALTER TABLE borrower_modifications ADD COLUMN gdpr_proc_consent datetime + |); + + # Add two sysprefs too + $dbh->do(q| +INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free') + |); + $dbh->do(q| +INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('GDPR_Policy','','Enforced\|Permissive\|Disabled','General Data Protection Regulation - policy', 'Choice') + |); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 20819: Add patron_consent)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 909eda2..6e81a07 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3452,6 +3452,7 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` ( `smsalertnumber` varchar(50) DEFAULT NULL, `privacy` int(11) DEFAULT NULL, `extended_attributes` MEDIUMTEXT DEFAULT NULL, + `gdpr_proc_consent` datetime, -- data processing consent PRIMARY KEY (`verification_token` (191),`borrowernumber`), KEY `verification_token` (`verification_token` (191)), KEY `borrowernumber` (`borrowernumber`) @@ -3508,6 +3509,21 @@ CREATE TABLE IF NOT EXISTS plugin_data ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- +-- Table structure for table patron_consent +-- + +DROP TABLE IF EXISTS patron_consent; +CREATE TABLE patron_consent ( + id int AUTO_INCREMENT, + borrowernumber int NOT NULL, + type enum('GDPR_PROCESSING' ), -- allows for future extension + given_on datetime, + refused_on datetime, + PRIMARY KEY (id), + FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- -- Table structure for table `patron_lists` -- diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ea76a4..755e3d6 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -175,6 +175,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('FinesLog','1',NULL,'If ON, log fines','YesNo'), ('finesMode','test','off|test|production','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines). Requires accruefines cronjob.','Choice'), ('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), +('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'), ('gist','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'), ('GoogleIndicTransliteration','0','','GoogleIndicTransliteration on the OPAC.','YesNo'), ('GoogleJackets','0',NULL,'if ON, displays jacket covers from Google Books API','YesNo'), @@ -442,6 +443,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), ('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), +('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'), ('ProcessingFeeNote', '', NULL, 'Set the text to be recorded in the column note, table accountlines when the processing fee (defined in item type) is applied', 'textarea'), ('ProtectSuperlibrarianPrivileges','1',NULL,'If enabled, non-superlibrarians cannot set superlibrarian privileges','YesNo'), ('PurgeSuggestionsOlderThan', '', NULL, 'If this script is called without the days parameter', 'Integer'), 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 348e1dd..f1b89ac 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 @@ -227,3 +227,16 @@ Patrons: yes: Do no: "Don't" - search the Norwegian national patron database after a local search result was found. + Privacy: + - + - Use the following URL + - pref: PrivacyPolicyURL + - to refer to your local privacy policy in messages about privacy and data protection. (If you enforce GDPR policy, make sure that this page is not blocked.) + - + - Set GDPR policy to + - pref: GDPR_Policy + choices: + '': 'Disabled' + Enforced: 'Enforced' + Permissive: 'Permissive' + - "GDPR is the EU General Data Protection Regulation. When you enforce, patrons need to give consent before using the OPAC. If you set to permissive, Koha will warn but not enforce." -- 2.1.4