Bugzilla – Attachment 88906 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.28 KB, created by
Owen Leonard
on 2019-04-26 12:22:24 UTC
(
hide
)
Description:
Bug 21535: Anonymize function in Patron should not scramble email addresses
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2019-04-26 12:22:24 UTC
Size:
2.28 KB
patch
obsolete
>From a2a37cd3c8186bdf8b19a9e91badafeec73f9434 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 > >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> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >t/db_depepended/Koha/Patrons.t runs with no warnings. >--- > 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 6a25d71..04b54a3 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1358,7 +1358,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 7e4a535..c9dd9c9 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1761,7 +1761,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' } ); >@@ -1782,6 +1782,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