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

(-)a/Koha/Patrons/Import.pm (-6 / +21 lines)
Lines 223-231 sub import_patrons { Link Here
223
            next LINE;
223
            next LINE;
224
        }
224
        }
225
225
226
        my $relationship        = $borrower{relationship};
226
        my $guarantor_relationship = $borrower{guarantor_relationship};
227
        my $guarantor_id        = $borrower{guarantor_id};
227
        delete $borrower{guarantor_relationship};
228
        delete $borrower{relationship};
228
        my $guarantor_id = $borrower{guarantor_id};
229
        delete $borrower{guarantor_id};
229
        delete $borrower{guarantor_id};
230
230
231
        # Remove warning for int datatype that cannot be null
231
        # Remove warning for int datatype that cannot be null
Lines 354-359 sub import_patrons { Link Here
354
                Koha::Patron->new(\%borrower)->store;
354
                Koha::Patron->new(\%borrower)->store;
355
            };
355
            };
356
            unless ( $@ ) {
356
            unless ( $@ ) {
357
                $borrowernumber = $patron->id;
357
358
358
                if ( $patron->is_debarred ) {
359
                if ( $patron->is_debarred ) {
359
                    AddDebarment(
360
                    AddDebarment(
Lines 406-418 sub import_patrons { Link Here
406
407
407
        # Add a guarantor if we are given a relationship
408
        # Add a guarantor if we are given a relationship
408
        if ( $guarantor_id ) {
409
        if ( $guarantor_id ) {
409
            Koha::Patron::Relationship->new(
410
            my $relationship = Koha::Patron::Relationships->find(
410
                {
411
                {
411
                    guarantee_id => $borrowernumber,
412
                    guarantee_id => $borrowernumber,
412
                    relationship => $relationship,
413
                    guarantor_id => $guarantor_id,
413
                    guarantor_id => $guarantor_id,
414
                }
414
                }
415
            )->store();
415
            );
416
417
            if ( $relationship ) {
418
                $relationship->relationship( $guarantor_relationship );
419
                $relationship->store();
420
            }
421
            else {
422
                Koha::Patron::Relationship->new(
423
                    {
424
                        guarantee_id => $borrowernumber,
425
                        relationship => $guarantor_relationship,
426
                        guarantor_id => $guarantor_id,
427
                    }
428
                )->store();
429
            }
416
        }
430
        }
417
    }
431
    }
418
432
Lines 488-493 sub set_column_keys { Link Here
488
502
489
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
503
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
490
    push( @columnkeys, 'patron_attributes' ) if $extended;
504
    push( @columnkeys, 'patron_attributes' ) if $extended;
505
    push( @columnkeys, qw( guarantor_relationship guarantor_id ) );
491
506
492
    return @columnkeys;
507
    return @columnkeys;
493
}
508
}
(-)a/tools/import_borrowers.pl (-4 / +3 lines)
Lines 62-68 my $extended = C4::Context->preference('ExtendedPatronAttributes'); Link Here
62
62
63
my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
63
my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
64
push( @columnkeys, 'patron_attributes' ) if $extended;
64
push( @columnkeys, 'patron_attributes' ) if $extended;
65
push( @columnkeys, qw( relationship guarantor_id  guarantor_firstname guarantor_surname ) );
65
push( @columnkeys, qw( guarantor_relationship guarantor_id ) );
66
66
67
my $input = CGI->new();
67
my $input = CGI->new();
68
68
Lines 124-132 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
124
            file                         => $handle,
124
            file                         => $handle,
125
            defaults                     => \%defaults,
125
            defaults                     => \%defaults,
126
            matchpoint                   => $matchpoint,
126
            matchpoint                   => $matchpoint,
127
            overwrite_cardnumber         => $input->param('overwrite_cardnumber'),
127
            overwrite_cardnumber         => scalar $input->param('overwrite_cardnumber'),
128
            overwrite_passwords          => $overwrite_passwords,
128
            overwrite_passwords          => $overwrite_passwords,
129
            preserve_extended_attributes => $input->param('ext_preserve') || 0,
129
            preserve_extended_attributes => scalar $input->param('ext_preserve') || 0,
130
        }
130
        }
131
    );
131
    );
132
132
133
- 

Return to bug 26059