Bugzilla – Attachment 67442 Details for
Bug 19366
PatronSelfRegistrationEmailMustBeUnique pref makes it impossible to submit updates via OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19366: Do not block patron's detail update if EmailMustBeUnique
Bug-19366-Do-not-block-patrons-detail-update-if-Em.patch (text/plain), 2.62 KB, created by
Kyle M Hall (khall)
on 2017-09-29 12:06:41 UTC
(
hide
)
Description:
Bug 19366: Do not block patron's detail update if EmailMustBeUnique
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-09-29 12:06:41 UTC
Size:
2.62 KB
patch
obsolete
>From bfa2412e049c8fb842714c4764db5df93d19dcfd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 27 Sep 2017 13:44:00 -0300 >Subject: [PATCH] Bug 19366: Do not block patron's detail update if > EmailMustBeUnique > >If the pref PatronSelfRegistrationEmailMustBeUnique is set ("consider"), >a patron is not allowed to register with an existing email address. >The existing code is wrong and reject a patron that is updating their >personal details with "This email address already exists in our >database.", even if the patron did not modify their email address. > >This is caused by the query we made, we must search for patron with this >email address but who is not the current patron. > >Test plan: >- Set PatronSelfRegistrationEmailMustBeUnique to "consider" >- Register a new patron with an existing email address >=> you should not be allowed >- Use a non-existent email address >=> You should be allowed >- Edit your patron details >- Modify some infos >=> Should pass >- Modify your email address with an existing one >=> You should not be allowed to do that > >Followed test plan, patches worked as described >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > opac/opac-memberentry.pl | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 957c38d..9784a3d 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -228,6 +228,7 @@ elsif ( $action eq 'update' ) { > }); > > my %borrower = ParseCgiForBorrower($cgi); >+ $borrower{borrowernumber} = $borrowernumber; > > my %borrower_changes = DelEmptyFields(%borrower); > my @empty_mandatory_fields = >@@ -392,7 +393,17 @@ sub CheckForInvalidFields { > unless ( Email::Valid->address($borrower->{'email'}) ) { > push(@invalidFields, "email"); > } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { >- my $patrons_with_same_email = Koha::Patrons->search( { email => $borrower->{email} })->count; >+ my $patrons_with_same_email = Koha::Patrons->search( >+ { >+ email => $borrower->{email}, >+ ( >+ exists $borrower->{borrowernumber} >+ ? ( borrowernumber => >+ { '!=' => $borrower->{borrowernumber} } ) >+ : () >+ ) >+ } >+ )->count; > if ( $patrons_with_same_email ) { > push @invalidFields, "duplicate_email"; > } >-- >2.10.2
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 19366
:
67404
|
67424
| 67442