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

(-)a/members/memberentry.pl (-13 / +8 lines)
Lines 418-436 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
418
        # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
418
        # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
419
        if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'}  && $newdata{'password'}) {
419
        if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'}  && $newdata{'password'}) {
420
            #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
420
            #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
421
            my $emailaddr;
421
            my @email_addresses;
422
            if  (C4::Context->preference("AutoEmailPrimaryAddress") ne 'OFF'  && 
422
            for my $field ( split /,/, C4::Context->preference("AutoEmailPrimaryAddress") ) {
423
                $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} =~  /\w\@\w/ ) {
423
                push @email_addresses, $_ if $newdata{$_} =~ /\w@\w/
424
                $emailaddr =   $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} 
425
            } 
426
            elsif ($newdata{email} =~ /\w\@\w/) {
427
                $emailaddr = $newdata{email} 
428
            }
424
            }
429
            elsif ($newdata{emailpro} =~ /\w\@\w/) {
425
            my $emailaddr = join ", ", @email_addresses;
430
                $emailaddr = $newdata{emailpro} 
426
            unless ( $emailaddr ) {
431
            }
427
                for my $field ( qw( email emailpro B_email ) ) {
432
            elsif ($newdata{B_email} =~ /\w\@\w/) {
428
                    $emailaddr = $newdata{$field} if $newdata{$field} =~ m|\w\@\w|;
433
                $emailaddr = $newdata{B_email} 
429
                }
434
            }
430
            }
435
            # if we manage to find a valid email address, send notice 
431
            # if we manage to find a valid email address, send notice 
436
            if ($emailaddr) {
432
            if ($emailaddr) {
437
- 

Return to bug 12802