Bugzilla – Attachment 180306 Details for
Bug 22458
PatronSelfRegistrationEmailMustBeUnique disallows self modification requests if multiple accounts share an email address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22458: Don't check for duplicate email on borrower self modification
Bug-22458-Dont-check-for-duplicate-email-on-borrow.patch (text/plain), 2.95 KB, created by
Nick Clemens (kidclamp)
on 2025-04-02 11:58:13 UTC
(
hide
)
Description:
Bug 22458: Don't check for duplicate email on borrower self modification
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-04-02 11:58:13 UTC
Size:
2.95 KB
patch
obsolete
>From 807c66ae19f1e71bf27a295cae4984ce68d02075 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 2 Apr 2025 11:54:03 +0000 >Subject: [PATCH] Bug 22458: Don't check for duplicate email on borrower self > modification > >This patch adds an extra variable to internal function CheckValidBorrower to set the >context as 'create' or 'update' > >To test: >1 - Enable PatronSelfRegistrationEmailMustBeUnique >2 - Edit a patron in staff interface and set email to 'a@example.org' >3 - Open an incognito window and go to opac >4 - Self register a patron using email a@example.org >5 - You receive an error >6 - Use b@example.org for email >7 - No problem >8 - Sign in as the new patron >9 - Edit your information >10 - Set email to a@example.org >11 - You receive an error >12 - Apply patch, restart all >13 - Edit patron again >14 - No error! >15 - Register another patron on the opac >16 - Confirm still wanred if using a@example.org as the email >--- > opac/opac-memberentry.pl | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index b89ddbc547e..7d10ca3f37c 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -137,7 +137,7 @@ if ( $op eq 'cud-create' ) { > > my @empty_mandatory_fields = > ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) ); >- my $invalidformfields = CheckForInvalidFields( \%borrower ); >+ my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'create' } ); > delete $borrower{'password2'}; > my $is_cardnumber_valid; > if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { >@@ -310,7 +310,7 @@ if ( $op eq 'cud-create' ) { > > my @empty_mandatory_fields = grep { $_ ne 'password' } # password is not required when editing personal details > ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) ); >- my $invalidformfields = CheckForInvalidFields( \%borrower ); >+ my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'update' } ); > > # Send back the data to the template > %borrower = ( %$borrower, %borrower ); >@@ -482,12 +482,14 @@ sub CheckMandatoryAttributes { > } > > sub CheckForInvalidFields { >- my $borrower = shift; >+ my $params = shift; >+ my $borrower = $params->{borrower}; >+ my $context = $params->{context}; > my @invalidFields; > if ( $borrower->{'email'} ) { > unless ( Koha::Email->is_valid( $borrower->{email} ) ) { > push( @invalidFields, "email" ); >- } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { >+ } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") && $context eq 'create' ) { > my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited? > { > email => $borrower->{email}, >-- >2.39.5
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 22458
:
180306
|
180424
|
180443
|
180444