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

(-)a/Koha/Patrons/Import.pm (-6 / +21 lines)
Lines 217-225 sub import_patrons { Link Here
217
            next LINE;
217
            next LINE;
218
        }
218
        }
219
219
220
        my $relationship        = $borrower{relationship};
220
        my $guarantor_relationship = $borrower{guarantor_relationship};
221
        my $guarantor_id        = $borrower{guarantor_id};
221
        delete $borrower{guarantor_relationship};
222
        delete $borrower{relationship};
222
        my $guarantor_id = $borrower{guarantor_id};
223
        delete $borrower{guarantor_id};
223
        delete $borrower{guarantor_id};
224
224
225
        # Remove warning for int datatype that cannot be null
225
        # Remove warning for int datatype that cannot be null
Lines 320-325 sub import_patrons { Link Here
320
                Koha::Patron->new(\%borrower)->store;
320
                Koha::Patron->new(\%borrower)->store;
321
            };
321
            };
322
            unless ( $@ ) {
322
            unless ( $@ ) {
323
                $borrowernumber = $patron->id;
323
324
324
                if ( $patron->is_debarred ) {
325
                if ( $patron->is_debarred ) {
325
                    AddDebarment(
326
                    AddDebarment(
Lines 370-382 sub import_patrons { Link Here
370
371
371
        # Add a guarantor if we are given a relationship
372
        # Add a guarantor if we are given a relationship
372
        if ( $guarantor_id ) {
373
        if ( $guarantor_id ) {
373
            Koha::Patron::Relationship->new(
374
            my $relationship = Koha::Patron::Relationships->find(
374
                {
375
                {
375
                    guarantee_id => $borrowernumber,
376
                    guarantee_id => $borrowernumber,
376
                    relationship => $relationship,
377
                    guarantor_id => $guarantor_id,
377
                    guarantor_id => $guarantor_id,
378
                }
378
                }
379
            )->store();
379
            );
380
381
            if ( $relationship ) {
382
                $relationship->relationship( $guarantor_relationship );
383
                $relationship->store();
384
            }
385
            else {
386
                Koha::Patron::Relationship->new(
387
                    {
388
                        guarantee_id => $borrowernumber,
389
                        relationship => $guarantor_relationship,
390
                        guarantor_id => $guarantor_id,
391
                    }
392
                )->store();
393
            }
380
        }
394
        }
381
    }
395
    }
382
396
Lines 452-457 sub set_column_keys { Link Here
452
466
453
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
467
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
454
    push( @columnkeys, 'patron_attributes' ) if $extended;
468
    push( @columnkeys, 'patron_attributes' ) if $extended;
469
    push( @columnkeys, qw( guarantor_relationship guarantor_id ) );
455
470
456
    return @columnkeys;
471
    return @columnkeys;
457
}
472
}
(-)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 126-133 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
126
            file                         => $handle,
126
            file                         => $handle,
127
            defaults                     => \%defaults,
127
            defaults                     => \%defaults,
128
            matchpoint                   => $matchpoint,
128
            matchpoint                   => $matchpoint,
129
            overwrite_cardnumber         => $input->param('overwrite_cardnumber'),
129
            overwrite_cardnumber         => scalar $input->param('overwrite_cardnumber'),
130
            preserve_extended_attributes => $input->param('ext_preserve') || 0,
130
            preserve_extended_attributes => scalar $input->param('ext_preserve') || 0,
131
        }
131
        }
132
    );
132
    );
133
133
134
- 

Return to bug 26059