Bugzilla – Attachment 95975 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: DBIC Changes
Bug-24151-DBIC-Changes.patch (text/plain), 14.43 KB, created by
Jonathan Druart
on 2019-12-03 18:12:01 UTC
(
hide
)
Description:
Bug 24151: DBIC Changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-12-03 18:12:01 UTC
Size:
14.43 KB
patch
obsolete
>From 89b848ac9d02bf03be4eec49f43622f00c173e98 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 30 Nov 2019 13:24:49 +0100 >Subject: [PATCH] Bug 24151: DBIC Changes > >--- > Koha/Schema/Result/AnonymizedBorrower.pm | 227 ++++++++++++++++++++++ > Koha/Schema/Result/AnonymizedBorrowerAttribute.pm | 115 +++++++++++ > Koha/Schema/Result/AnonymizedTransaction.pm | 138 +++++++++++++ > Koha/Schema/Result/BorrowerAttributeType.pm | 27 ++- > Koha/Schema/Result/Branch.pm | 19 +- > Koha/Schema/Result/Category.pm | 19 +- > 6 files changed, 539 insertions(+), 6 deletions(-) > create mode 100644 Koha/Schema/Result/AnonymizedBorrower.pm > create mode 100644 Koha/Schema/Result/AnonymizedBorrowerAttribute.pm > create mode 100644 Koha/Schema/Result/AnonymizedTransaction.pm > >diff --git a/Koha/Schema/Result/AnonymizedBorrower.pm b/Koha/Schema/Result/AnonymizedBorrower.pm >new file mode 100644 >index 0000000000..acec61c045 >--- /dev/null >+++ b/Koha/Schema/Result/AnonymizedBorrower.pm >@@ -0,0 +1,227 @@ >+use utf8; >+package Koha::Schema::Result::AnonymizedBorrower; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::AnonymizedBorrower >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<anonymized_borrowers> >+ >+=cut >+ >+__PACKAGE__->table("anonymized_borrowers"); >+ >+=head1 ACCESSORS >+ >+=head2 hashed_borrowernumber >+ >+ data_type: 'varchar' >+ is_nullable: 0 >+ size: 60 >+ >+=head2 has_cardnumber >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+=head2 title >+ >+ data_type: 'longtext' >+ is_nullable: 1 >+ >+=head2 city >+ >+ data_type: 'longtext' >+ is_nullable: 1 >+ >+=head2 state >+ >+ data_type: 'mediumtext' >+ is_nullable: 1 >+ >+=head2 zipcode >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 25 >+ >+=head2 country >+ >+ data_type: 'mediumtext' >+ is_nullable: 1 >+ >+=head2 branchcode >+ >+ data_type: 'varchar' >+ default_value: (empty string) >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=head2 categorycode >+ >+ data_type: 'varchar' >+ default_value: (empty string) >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=head2 dateenrolled >+ >+ data_type: 'date' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+=head2 sex >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 1 >+ >+=head2 sort1 >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=head2 sort2 >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "hashed_borrowernumber", >+ { data_type => "varchar", is_nullable => 0, size => 60 }, >+ "has_cardnumber", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "title", >+ { data_type => "longtext", is_nullable => 1 }, >+ "city", >+ { data_type => "longtext", is_nullable => 1 }, >+ "state", >+ { data_type => "mediumtext", is_nullable => 1 }, >+ "zipcode", >+ { data_type => "varchar", is_nullable => 1, size => 25 }, >+ "country", >+ { data_type => "mediumtext", is_nullable => 1 }, >+ "branchcode", >+ { >+ data_type => "varchar", >+ default_value => "", >+ is_foreign_key => 1, >+ is_nullable => 0, >+ size => 10, >+ }, >+ "categorycode", >+ { >+ data_type => "varchar", >+ default_value => "", >+ is_foreign_key => 1, >+ is_nullable => 0, >+ size => 10, >+ }, >+ "dateenrolled", >+ { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, >+ "sex", >+ { data_type => "varchar", is_nullable => 1, size => 1 }, >+ "sort1", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+ "sort2", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</hashed_borrowernumber> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("hashed_borrowernumber"); >+ >+=head1 RELATIONS >+ >+=head2 anonymized_borrower_attributes >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrowerAttribute> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "anonymized_borrower_attributes", >+ "Koha::Schema::Result::AnonymizedBorrowerAttribute", >+ { "foreign.hashed_borrowernumber" => "self.hashed_borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+=head2 anonymized_transactions >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AnonymizedTransaction> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "anonymized_transactions", >+ "Koha::Schema::Result::AnonymizedTransaction", >+ { "foreign.hashed_borrowernumber" => "self.hashed_borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+=head2 branchcode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Branch> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "branchcode", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "branchcode" }, >+ { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, >+); >+ >+=head2 categorycode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Category> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "categorycode", >+ "Koha::Schema::Result::Category", >+ { categorycode => "categorycode" }, >+ { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:04 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lQbpkjRIhSCiv17bsns6TQ >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/AnonymizedBorrowerAttribute.pm b/Koha/Schema/Result/AnonymizedBorrowerAttribute.pm >new file mode 100644 >index 0000000000..222adb85a4 >--- /dev/null >+++ b/Koha/Schema/Result/AnonymizedBorrowerAttribute.pm >@@ -0,0 +1,115 @@ >+use utf8; >+package Koha::Schema::Result::AnonymizedBorrowerAttribute; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::AnonymizedBorrowerAttribute >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<anonymized_borrower_attributes> >+ >+=cut >+ >+__PACKAGE__->table("anonymized_borrower_attributes"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+=head2 hashed_borrowernumber >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 60 >+ >+=head2 code >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=head2 attribute >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "hashed_borrowernumber", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 60 }, >+ "code", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, >+ "attribute", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 RELATIONS >+ >+=head2 code >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::BorrowerAttributeType> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "code", >+ "Koha::Schema::Result::BorrowerAttributeType", >+ { code => "code" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 hashed_borrowernumber >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "hashed_borrowernumber", >+ "Koha::Schema::Result::AnonymizedBorrower", >+ { hashed_borrowernumber => "hashed_borrowernumber" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:04 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wl4geCzsGg46pVtJpLXduw >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/AnonymizedTransaction.pm b/Koha/Schema/Result/AnonymizedTransaction.pm >new file mode 100644 >index 0000000000..760bed68c0 >--- /dev/null >+++ b/Koha/Schema/Result/AnonymizedTransaction.pm >@@ -0,0 +1,138 @@ >+use utf8; >+package Koha::Schema::Result::AnonymizedTransaction; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::AnonymizedTransaction >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<anonymized_transactions> >+ >+=cut >+ >+__PACKAGE__->table("anonymized_transactions"); >+ >+=head1 ACCESSORS >+ >+=head2 hashed_borrowernumber >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 60 >+ >+=head2 datetime >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+=head2 branchcode >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 10 >+ >+=head2 transaction_type >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 16 >+ >+=head2 itemnumber >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+=head2 itemtype >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 10 >+ >+=head2 holdingbranch >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 10 >+ >+=head2 location >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=head2 itemcallnumber >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+=head2 ccode >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "hashed_borrowernumber", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 60 }, >+ "datetime", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "branchcode", >+ { data_type => "varchar", is_nullable => 1, size => 10 }, >+ "transaction_type", >+ { data_type => "varchar", is_nullable => 1, size => 16 }, >+ "itemnumber", >+ { data_type => "integer", is_nullable => 1 }, >+ "itemtype", >+ { data_type => "varchar", is_nullable => 1, size => 10 }, >+ "holdingbranch", >+ { data_type => "varchar", is_nullable => 1, size => 10 }, >+ "location", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+ "itemcallnumber", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+ "ccode", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+); >+ >+=head1 RELATIONS >+ >+=head2 hashed_borrowernumber >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "hashed_borrowernumber", >+ "Koha::Schema::Result::AnonymizedBorrower", >+ { hashed_borrowernumber => "hashed_borrowernumber" }, >+ { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:04 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ssL4bJi/Ocn7ok2d6fSeQA >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm >index e20f0dc5a1..b5751406c1 100644 >--- a/Koha/Schema/Result/BorrowerAttributeType.pm >+++ b/Koha/Schema/Result/BorrowerAttributeType.pm >@@ -90,6 +90,12 @@ __PACKAGE__->table("borrower_attribute_types"); > is_nullable: 0 > size: 255 > >+=head2 keep_for_anonymized >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ > =cut > > __PACKAGE__->add_columns( >@@ -115,6 +121,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 10 }, > "class", > { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, >+ "keep_for_anonymized", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, > ); > > =head1 PRIMARY KEY >@@ -131,6 +139,21 @@ __PACKAGE__->set_primary_key("code"); > > =head1 RELATIONS > >+=head2 anonymized_borrower_attributes >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrowerAttribute> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "anonymized_borrower_attributes", >+ "Koha::Schema::Result::AnonymizedBorrowerAttribute", >+ { "foreign.code" => "self.code" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrower_attribute_types_branches > > Type: has_many >@@ -162,8 +185,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-25 20:32:12 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gsPR8PuUUZHFUkr3MIbTpw >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:04 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ce+VgMJUdN95mONcdnoTFA > > __PACKAGE__->add_columns( > '+keep_for_anonymized' => { is_boolean => 1 }, >diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm >index 73b50e581b..ec80971fa7 100644 >--- a/Koha/Schema/Result/Branch.pm >+++ b/Koha/Schema/Result/Branch.pm >@@ -256,6 +256,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 anonymized_borrowers >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrower> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "anonymized_borrowers", >+ "Koha::Schema::Result::AnonymizedBorrower", >+ { "foreign.branchcode" => "self.branchcode" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 aqbaskets > > Type: has_many >@@ -707,8 +722,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-14 09:59:52 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vWDJAm3K2jiyRS3htyip6A >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:05 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JsEFwbl010ReFB268ESa4g > > __PACKAGE__->add_columns( > '+pickup_location' => { is_boolean => 1 } >diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm >index cfe788ce6f..1f4e1b8fb6 100644 >--- a/Koha/Schema/Result/Category.pm >+++ b/Koha/Schema/Result/Category.pm >@@ -205,6 +205,21 @@ __PACKAGE__->set_primary_key("categorycode"); > > =head1 RELATIONS > >+=head2 anonymized_borrowers >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AnonymizedBorrower> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "anonymized_borrowers", >+ "Koha::Schema::Result::AnonymizedBorrower", >+ { "foreign.categorycode" => "self.categorycode" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrower_message_preferences > > Type: has_many >@@ -266,8 +281,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-12 02:43:58 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7rwTH9HuxcdRCBP/bj0d/A >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-11-30 12:24:05 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hOPnK0epHRIW4W14r91ong > > sub koha_object_class { > 'Koha::Patron::Category'; >-- >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