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

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

Return to bug 12802