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

(-)a/Koha/Patrons/Import.pm (-3 / +23 lines)
Lines 24-29 use Encode qw( decode_utf8 ); Link Here
24
use Try::Tiny qw( catch try );
24
use Try::Tiny qw( catch try );
25
25
26
use C4::Members qw( checkcardnumber );
26
use C4::Members qw( checkcardnumber );
27
use C4::Letters qw( SendAlerts );
27
28
28
use Koha::Libraries;
29
use Koha::Libraries;
29
use Koha::Patrons;
30
use Koha::Patrons;
Lines 277-283 sub import_patrons { Link Here
277
                }
278
                }
278
            }
279
            }
279
280
280
            my $patron = Koha::Patrons->find( $borrowernumber );
281
            try {
281
            try {
282
                $schema->storage->txn_do(sub {
282
                $schema->storage->txn_do(sub {
283
                    $patron->set(\%borrower)->store;
283
                    $patron->set(\%borrower)->store;
Lines 373-379 sub import_patrons { Link Here
373
        else {
373
        else {
374
            try {
374
            try {
375
                $schema->storage->txn_do(sub {
375
                $schema->storage->txn_do(sub {
376
                    my $patron = Koha::Patron->new(\%borrower)->store;
376
                    $patron = Koha::Patron->new(\%borrower)->store;
377
                    $borrowernumber = $patron->id;
377
                    $borrowernumber = $patron->id;
378
378
379
                    if ( $patron->is_debarred ) {
379
                    if ( $patron->is_debarred ) {
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
                && $patron->plain_text_password )
446
            {
447
                my $emailaddr = $patron->notice_email_address;
448
449
                # if we manage to find a valid email address, send notice
450
                if ($emailaddr) {
451
                    $borrower{emailaddr} = $emailaddr;
452
                    my $err;
453
                    eval {
454
                        $err =
455
                          SendAlerts( 'members', \%borrower, "ACCTDETAILS" );
456
                    };
457
                }
458
            }
459
        }
460
440
        next LINE unless $success;
461
        next LINE unless $success;
441
462
442
        # Add a guarantor if we are given a relationship
463
        # Add a guarantor if we are given a relationship
443
- 

Return to bug 29005