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

(-)a/members/memberentry.pl (-13 / +8 lines)
Lines 386-404 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
386
        # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
386
        # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
387
        if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'}  && $newdata{'password'}) {
387
        if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'}  && $newdata{'password'}) {
388
            #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
388
            #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
389
            my $emailaddr;
389
            my @email_addresses;
390
            if  (C4::Context->preference("AutoEmailPrimaryAddress") ne 'OFF'  && 
390
            for my $field ( split /,/, C4::Context->preference("AutoEmailPrimaryAddress") ) {
391
                $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} =~  /\w\@\w/ ) {
391
                push @email_addresses, $_ if $newdata{$_} =~ /\w@\w/
392
                $emailaddr =   $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} 
393
            } 
394
            elsif ($newdata{email} =~ /\w\@\w/) {
395
                $emailaddr = $newdata{email} 
396
            }
392
            }
397
            elsif ($newdata{emailpro} =~ /\w\@\w/) {
393
            my $emailaddr = join ", ", @email_addresses;
398
                $emailaddr = $newdata{emailpro} 
394
            unless ( $emailaddr ) {
399
            }
395
                for my $field ( qw( email emailpro B_email ) ) {
400
            elsif ($newdata{B_email} =~ /\w\@\w/) {
396
                    $emailaddr = $newdata{$field} if $newdata{$field} =~ m|\w\@\w|;
401
                $emailaddr = $newdata{B_email} 
397
                }
402
            }
398
            }
403
            # if we manage to find a valid email address, send notice 
399
            # if we manage to find a valid email address, send notice 
404
            if ($emailaddr) {
400
            if ($emailaddr) {
405
- 

Return to bug 12802