Bugzilla – Attachment 97240 Details for
Bug 24151
Add a pseudonymization process for patrons and transactions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24151: DB changes
Bug-24151-DB-changes.patch (text/plain), 9.62 KB, created by
Jonathan Druart
on 2020-01-11 18:12:45 UTC
(
hide
)
Description:
Bug 24151: DB changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-01-11 18:12:45 UTC
Size:
9.62 KB
patch
obsolete
>From a2cd468b8b062f8db9c6f088fa557871906e93ae Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 22 Nov 2019 15:38:34 +0100 >Subject: [PATCH] Bug 24151: DB changes > >1 new table: > * pseudonymized_transactions > >3 new sysprefs: > * Pseudonymization > * PseudonymizationPatronFields > * PseudonymizationTransactionFields > >Sponsored-by: Association KohaLa - https://koha-fr.org/ >--- > installer/data/mysql/atomicupdate/bug_24151.perl | 53 ++++++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 35 ++++++++++++++ > installer/data/mysql/sysprefs.sql | 3 ++ > .../prog/en/modules/admin/preferences/patrons.pref | 33 ++++++++++++++ > 4 files changed, 124 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_24151.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_24151.perl b/installer/data/mysql/atomicupdate/bug_24151.perl >new file mode 100644 >index 0000000000..6dd12888f6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24151.perl >@@ -0,0 +1,53 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ unless( TableExists( 'pseudonymized_transactions' ) ) { >+ $dbh->do(q| >+ CREATE TABLE `pseudonymized_transactions` ( >+ `id` INT(11) NOT NULL AUTO_INCREMENT, >+ `hashed_borrowernumber` VARCHAR(60) NOT NULL, >+ `has_cardnumber` TINYINT(1) NOT NULL DEFAULT 0, >+ `title` LONGTEXT, >+ `city` LONGTEXT, >+ `state` MEDIUMTEXT default NULL, >+ `zipcode` varchar(25) default NULL, >+ `country` MEDIUMTEXT, >+ `branchcode` varchar(10) NOT NULL default '', >+ `categorycode` varchar(10) NOT NULL default '', >+ `dateenrolled` date default NULL, >+ `sex` varchar(1) default NULL, >+ `sort1` varchar(80) default NULL, >+ `sort2` varchar(80) default NULL, >+ `datetime` datetime default NULL, >+ `transaction_branchcode` varchar(10) default NULL, >+ `transaction_type` varchar(16) default NULL, >+ `itemnumber` int(11) default NULL, >+ `itemtype` varchar(10) default NULL, >+ `holdingbranch` varchar(10) default null, >+ `location` varchar(80) default NULL, >+ `itemcallnumber` varchar(255) default NULL, >+ `ccode` varchar(80) default NULL, >+ PRIMARY KEY (`id`), >+ CONSTRAINT `pseudonymized_transactions_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`), >+ CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`), >+ CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_3` FOREIGN KEY (`transaction_branchcode`) REFERENCES `branches` (`branchcode`) >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ |); >+ } >+ >+ $dbh->do(q| >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('Pseudonymization','0',NULL,'If enabled patrons and transactions will be copied in a separate table for statistics purpose','YesNo') >+ |); >+ $dbh->do(q| >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('PseudonymizationPatronFields','','title,city,state,zipcode,country,branchcode,categorycode,dateenrolled,sex,sort1,sort2','Patron fields to copy to the pseudonymized_transactions table','multiple') >+ |); >+ $dbh->do(q| >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('PseudonymizationTransactionFields','','datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple') >+ |); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 24151 - Add pseudonymized_transactions tables and sysprefs for Pseudonymization)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c702d405a0..6bfe4655d8 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1936,6 +1936,41 @@ CREATE TABLE `statistics` ( -- information related to transactions (circulation > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >+-- Table structure for table pseudonymized_transactions >+-- >+ >+DROP TABLE IF EXISTS pseudonymized_transactions; >+CREATE TABLE `pseudonymized_transactions` ( >+ `id` INT(11) NOT NULL AUTO_INCREMENT, >+ `hashed_borrowernumber` VARCHAR(60) NOT NULL, >+ `has_cardnumber` TINYINT(1) NOT NULL DEFAULT 0, >+ `title` LONGTEXT, >+ `city` LONGTEXT, >+ `state` MEDIUMTEXT default NULL, >+ `zipcode` varchar(25) default NULL, >+ `country` MEDIUMTEXT, >+ `branchcode` varchar(10) NOT NULL default '', >+ `categorycode` varchar(10) NOT NULL default '', >+ `dateenrolled` date default NULL, >+ `sex` varchar(1) default NULL, >+ `sort1` varchar(80) default NULL, >+ `sort2` varchar(80) default NULL, >+ `datetime` datetime default NULL, >+ `transaction_branchcode` varchar(10) default NULL, >+ `transaction_type` varchar(16) default NULL, >+ `itemnumber` int(11) default NULL, >+ `itemtype` varchar(10) default NULL, >+ `holdingbranch` varchar(10) default null, >+ `location` varchar(80) default NULL, >+ `itemcallnumber` varchar(255) default NULL, >+ `ccode` varchar(80) default NULL, >+ PRIMARY KEY (`id`), >+ CONSTRAINT `pseudonymized_transactions_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`), >+ CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`), >+ CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_3` FOREIGN KEY (`transaction_branchcode`) REFERENCES `branches` (`branchcode`) >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ >+-- > -- Table structure for table subscription_frequencies > -- > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 5a4fa4c3a9..28fd3f3d66 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -503,6 +503,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('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'), >+('Pseudonymization','0',NULL,'If enabled patrons and transactions will be copied in a separate table for statistics purpose','YesNo'), >+('PseudonymizationPatronFields','','title,city,state,zipcode,country,branchcode,categorycode,dateenrolled,sex,sort1,sort2','Patron fields to copy to the pseudonymized_transactions table','multiple'), >+('PseudonymizationTransactionFields','','datetime,branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple'), > ('PurgeSuggestionsOlderThan', '', NULL, 'If this script is called without the days parameter', 'Integer'), > ('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'), > ('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'), >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 9e37372f4e..8c1f6dc732 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 >@@ -257,3 +257,36 @@ Patrons: > - days and remove anonymized patron accounts after > - pref: PatronRemovalDelay > - "days.<br>IMPORTANT: No action is performed when these delays are empty (no text). But a zero value ('0') is interpreted as no delay (do it now)! The actions are performed by the cleanup database cron job." >+ - >+ - pref: Pseudonymization >+ choices: >+ yes: Enable >+ no: Disable >+ - "pseudonymization to comply with GDPR for personal information." >+ - "Patrons and transactions will be copied to a separate table for statistics purpose." >+ - "<br/>Use the following fields for patrons:" >+ - pref: PseudonymizationPatronFields >+ multiple: >+ title: "Patron's title" >+ city: "City" >+ state: "State" >+ zipcode: "Zipcode" >+ country: "Country" >+ branchcode: "Patron's library" >+ categorycode: "Patron's category" >+ dateenrolled: "Date the patron was added to Koha" >+ sex: "Patron's gender" >+ sort1: "Sort1" >+ sort2: "Sort2" >+ - "<br/> And the following fields for the transactions:" >+ - pref: PseudonymizationTransactionFields >+ multiple: >+ datetime: "Date and time of the transaction" >+ transaction_branchcode: "Library where the transaction occurred" >+ transaction_type: "Transaction type" >+ itemnumber: "Itemnumber" >+ itemtype: "Item type" >+ holdingbranch: "Holding branch" >+ location: "Location" >+ itemcallnumber: "Item's callnumber" >+ ccode: "Collection code" >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24151
:
95959
|
95960
|
95961
|
95962
|
95963
|
95964
|
95965
|
95966
|
95967
|
95968
|
95969
|
95970
|
95971
|
95972
|
95973
|
95974
|
95975
|
95976
|
97240
|
97241
|
97242
|
97243
|
97244
|
97245
|
97246
|
97247
|
97248
|
97249
|
97250
|
97251
|
97252
|
101034
|
101035
|
101036
|
101037
|
101038
|
101039
|
101040
|
101041
|
101042
|
101043
|
101044
|
101045
|
101046
|
101047
|
101048
|
101049
|
105801
|
105802
|
105803
|
105804
|
105805
|
105806
|
105807
|
105808
|
105809
|
105810
|
105811
|
105812
|
105813
|
105814
|
105815
|
105816
|
106032
|
106033
|
106034
|
106035
|
106036
|
106037
|
106038
|
106039
|
106040
|
106041
|
106042
|
106043
|
106044
|
106045
|
106046
|
106047
|
106048
|
106049
|
106195
|
106255
|
107127
|
107225