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

(-)a/Koha/Patrons/Import.pm (-1 / +40 lines)
Lines 437-442 sub import_patrons { Link Here
437
            };
437
            };
438
        }
438
        }
439
439
440
        if ($success) {
441
442
            # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice'
443
            # that matches the user's branchcode.
444
            if (   C4::Context->preference("AutoEmailOpacUser") == 1
445
                && $borrower{'userid'}
446
                && $borrower{'password'} )
447
            {
448
                #look for defined primary email address, if blank - attempt to use borr.email
449
                #and borr.emailpro instead
450
                my $emailaddr;
451
                if ( C4::Context->preference("AutoEmailPrimaryAddress") ne 'OFF'
452
                    && $borrower{ C4::Context->preference(
453
                            "AutoEmailPrimaryAddress") } =~ /\w\@\w/ )
454
                {
455
                    $emailaddr = $borrower{ C4::Context->preference(
456
                            "AutoEmailPrimaryAddress") };
457
                }
458
                elsif ( $borrower{email} =~ /\w\@\w/ ) {
459
                    $emailaddr = $borrower{email};
460
                }
461
                elsif ( $borrower{emailpro} =~ /\w\@\w/ ) {
462
                    $emailaddr = $borrower{emailpro};
463
                }
464
                elsif ( $borrower{B_email} =~ /\w\@\w/ ) {
465
                    $emailaddr = $borrower{B_email};
466
                }
467
468
                # if we manage to find a valid email address, send notice
469
                if ($emailaddr) {
470
                    $borrower{emailaddr} = $emailaddr;
471
                    my $err;
472
                    eval {
473
                        $err =
474
                          SendAlerts( 'members', \%borrower, "ACCTDETAILS" );
475
                    };
476
                }
477
            }
478
        }
479
440
        next LINE unless $success;
480
        next LINE unless $success;
441
481
442
        # Add a guarantor if we are given a relationship
482
        # Add a guarantor if we are given a relationship
443
- 

Return to bug 29005