Bug 20819: Db rev for new table patron_consent and sysprefs
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 4 Jun 2018 11:11:58 +0000 (13:11 +0200)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 20 Sep 2018 13:45:18 +0000 (13:45 +0000)
[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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

installer/data/mysql/atomicupdate/bug_20819.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref

diff --git a/installer/data/mysql/atomicupdate/bug_20819.perl b/installer/data/mysql/atomicupdate/bug_20819.perl
new file mode 100644 (file)
index 0000000..99ffc08
--- /dev/null
@@ -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";
+}
index d5368d4..49a0f18 100644 (file)
@@ -3450,6 +3450,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`)
@@ -3506,6 +3507,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`
 --
 
index 4a8d3e8..a08ff3e 100644 (file)
@@ -176,6 +176,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'),
index 8559b87..8c8227d 100644 (file)
@@ -213,3 +213,16 @@ Patrons:
                yes: Allow only superlibrarians
                no: Allow all permitted users
          - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
+    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."