Bugzilla – Attachment 81489 Details for
Bug 21712
Report anonymized patron records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21712: Report anonymized patron records
Bug-21712-Report-anonymized-patron-records.patch (text/plain), 2.74 KB, created by
Marcel de Rooy
on 2018-10-29 13:26:52 UTC
(
hide
)
Description:
Bug 21712: Report anonymized patron records
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-10-29 13:26:52 UTC
Size:
2.74 KB
patch
obsolete
>From 08b04fa69dbaa4f3215cff6e066fc298ec9fa5e1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 29 Oct 2018 14:15:50 +0100 >Subject: [PATCH] Bug 21712: Report anonymized patron records >Content-Type: text/plain; charset=utf-8 > >The solution is rather limited but effective on itself. >It only needs an enabled pref BorrowersLog. >We log a specific ANONYMIZE action in Koha::Patron::anonymize. > >Now we only need to add a SQL report like: > select object AS borrowernumber, timestamp AS date_anonymized from action_logs where module='MEMBERS' and action='ANONYMIZE' >Depending on your needs, you could give this report a date parameter to >show all actions from a given date onwards. > >Test plan: >[1] Add a patron. >[2] Enable BorrowersLog >[3] Run in perl this line: > use Koha::Patrons; Koha::Patrons->find(BORROWERNUMBER)->anonymize; > > Or (much more work): enable GDPR, unsubscribe, set reflection delay to > zero and anonymize delay to zero and run cleanup_database.pl. >[4] Check if the log contains a ANONYMIZE action for this patron. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Patron.pm | 2 ++ > t/db_dependent/Koha/Patrons.t | 4 +++- > 2 files changed, 5 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 6dce539..7c63a4a 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1205,6 +1205,8 @@ sub anonymize { > } > } > $self->flgAnonymized(1)->store; >+ logaction( "MEMBERS", "ANONYMIZE", $self->borrowernumber, "" ) if C4::Context->preference("BorrowersLog"); >+ > } > > sub _anonymize_column { >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 40962b6..7c30f7f 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1582,7 +1582,7 @@ subtest 'lock' => sub { > }; > > subtest 'anonymize' => sub { >- plan tests => 9; >+ plan tests => 10; > > my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); > my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); >@@ -1593,10 +1593,12 @@ subtest 'anonymize' => sub { > $issue->delete; > > t::lib::Mocks::mock_preference( 'BorrowerMandatoryField', 'surname|email|cardnumber' ); >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); > my $surname = $patron1->surname; # expect change, no clear > my $branchcode = $patron1->branchcode; # expect skip > $patron1->anonymize; > is($patron1->flgAnonymized, 1, 'Check flag' ); >+ is( $schema->resultset('ActionLog')->search({ object => $patron1->borrowernumber, module => 'MEMBERS', action => 'ANONYMIZE' })->count, 1, 'Action has been logged too' ); > > is( $patron1->dateofbirth, undef, 'Birth date cleared' ); > is( $patron1->firstname, undef, 'First name cleared' ); >-- >2.1.4
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 21712
: 81489