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

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

Return to bug 12802