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

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

Return to bug 12802