View | Details | Raw Unified | Return to bug 22458
Collapse All | Expand All

(-)a/opac/opac-memberentry.pl (-5 / +6 lines)
Lines 137-143 if ( $op eq 'cud-create' ) { Link Here
137
137
138
    my @empty_mandatory_fields =
138
    my @empty_mandatory_fields =
139
        ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) );
139
        ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) );
140
    my $invalidformfields = CheckForInvalidFields( \%borrower );
140
    my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'create' } );
141
    delete $borrower{'password2'};
141
    delete $borrower{'password2'};
142
    my $is_cardnumber_valid;
142
    my $is_cardnumber_valid;
143
    if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) {
143
    if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) {
Lines 310-316 if ( $op eq 'cud-create' ) { Link Here
310
310
311
    my @empty_mandatory_fields = grep { $_ ne 'password' }    # password is not required when editing personal details
311
    my @empty_mandatory_fields = grep { $_ ne 'password' }    # password is not required when editing personal details
312
        ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) );
312
        ( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) );
313
    my $invalidformfields = CheckForInvalidFields( \%borrower );
313
    my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'update' } );
314
314
315
    # Send back the data to the template
315
    # Send back the data to the template
316
    %borrower = ( %$borrower, %borrower );
316
    %borrower = ( %$borrower, %borrower );
Lines 482-493 sub CheckMandatoryAttributes { Link Here
482
}
482
}
483
483
484
sub CheckForInvalidFields {
484
sub CheckForInvalidFields {
485
    my $borrower = shift;
485
    my $params   = shift;
486
    my $borrower = $params->{borrower};
487
    my $context  = $params->{context};
486
    my @invalidFields;
488
    my @invalidFields;
487
    if ( $borrower->{'email'} ) {
489
    if ( $borrower->{'email'} ) {
488
        unless ( Koha::Email->is_valid( $borrower->{email} ) ) {
490
        unless ( Koha::Email->is_valid( $borrower->{email} ) ) {
489
            push( @invalidFields, "email" );
491
            push( @invalidFields, "email" );
490
        } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) {
492
        } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") && $context eq 'create' ) {
491
            my $patrons_with_same_email = Koha::Patrons->search(    # FIXME Should be search_limited?
493
            my $patrons_with_same_email = Koha::Patrons->search(    # FIXME Should be search_limited?
492
                {
494
                {
493
                    email => $borrower->{email},
495
                    email => $borrower->{email},
494
- 

Return to bug 22458