Bugzilla – Attachment 80349 Details for
Bug 21535
Anonymize function in Patron should not scramble email addresses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21535: Anonymize function in Patron should not scramble email addresses
Bug-21535-Anonymize-function-in-Patron-should-not-.patch (text/plain), 2.22 KB, created by
Marcel de Rooy
on 2018-10-10 13:41:27 UTC
(
hide
)
Description:
Bug 21535: Anonymize function in Patron should not scramble email addresses
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-10-10 13:41:27 UTC
Size:
2.22 KB
patch
obsolete
>From 4af581486eb39cf0550735f4bdf7ca12602525e5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 10 Oct 2018 15:34:22 +0200 >Subject: [PATCH] Bug 21535: Anonymize function in Patron should not scramble > email addresses >Content-Type: text/plain; charset=utf-8 > >Scrambled email addresses will only generate warnings etc. >Clear them although they might be in BorrowerMandatoryField. > >Test plan: >Run t/db_dependent/Koha/Patrons.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Patron.pm | 4 +++- > t/db_dependent/Koha/Patrons.t | 3 ++- > 2 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index a360cb9..f66c7eb 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1111,7 +1111,9 @@ sub anonymize { > warn "Exiting anonymize: patron ".$self->borrowernumber." still has issues"; > return; > } >- my $mandatory = { map { (lc $_, 1); } >+ # Mandatory fields come from the corresponding pref, but email fields >+ # are removed since scrambled email addresses only generate errors >+ my $mandatory = { map { (lc $_, 1); } grep { !/email/ } > split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') }; > $mandatory->{userid} = 1; # needed since sub store does not clear field > my @columns = $self->_result->result_source->columns; >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 8af3785..d1ab0ce 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1581,7 +1581,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' } ); >@@ -1602,6 +1602,7 @@ subtest 'anonymize' => sub { > isnt( $patron1->surname, $surname, 'Surname changed' ); > ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' ); > is( $patron1->branchcode, $branchcode, 'Branch code skipped' ); >+ is( $patron1->email, undef, 'Email was mandatory, must be cleared' ); > > # Test wrapper in Koha::Patrons > $patron1->surname($surname)->store; # restore >-- >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 21535
:
80349
|
88906
|
89162