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

(-)a/Koha/Patrons/Import.pm (-5 / +7 lines)
Lines 23-32 use Carp; Link Here
23
use Text::CSV;
23
use Text::CSV;
24
24
25
use C4::Members;
25
use C4::Members;
26
use C4::Branch;
27
use C4::Members::Attributes qw(:all);
26
use C4::Members::Attributes qw(:all);
28
use C4::Members::AttributeTypes;
27
use C4::Members::AttributeTypes;
29
28
29
use Koha::Libraries;
30
use Koha::Patrons;
31
use Koha::Patron::Categories;
30
use Koha::DateUtils;
32
use Koha::DateUtils;
31
33
32
=head1 NAME
34
=head1 NAME
Lines 401-407 Returns an array of borrowers' table columns. Link Here
401
sub set_column_keys {
403
sub set_column_keys {
402
    my ($self, $extended) = @_;
404
    my ($self, $extended) = @_;
403
405
404
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } C4::Members::columns();
406
    my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns();
405
    push( @columnkeys, 'patron_attributes' ) if $extended;
407
    push( @columnkeys, 'patron_attributes' ) if $extended;
406
408
407
    return @columnkeys;
409
    return @columnkeys;
Lines 450-457 sub check_branch_code { Link Here
450
    }
452
    }
451
453
452
    # look for branch code
454
    # look for branch code
453
    my $branch_name = GetBranchName( $branchcode );
455
    my $library = Koha::Libraries->find( $branchcode );
454
    unless( $branch_name ) {
456
    unless( $library ) {
455
        push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline,
457
        push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline,
456
                                     value => $branchcode, branch_map => 1, });
458
                                     value => $branchcode, branch_map => 1, });
457
    }
459
    }
Lines 475-481 sub check_borrower_category { Link Here
475
    }
477
    }
476
478
477
    # Looking for borrower category
479
    # Looking for borrower category
478
    my $category = GetBorrowercategory( $categorycode );
480
    my $category = Koha::Patron::Categories->find($categorycode);
479
    unless( $category ) {
481
    unless( $category ) {
480
        push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline,
482
        push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline,
481
                                     value => $categorycode, category_map => 1, });
483
                                     value => $categorycode, category_map => 1, });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (-10 / +4 lines)
Lines 232-238 Link Here
232
            </fieldset>
232
            </fieldset>
233
        [% END %]
233
        [% END %]
234
234
235
        <fieldset class="action"><input type="submit" value="Import" /></fieldset>
235
        <fieldset class="action">
236
            <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
237
            <input type="submit" value="Import" />
238
        </fieldset>
236
    </form>
239
    </form>
237
[% END %]
240
[% END %]
238
241
Lines 273-287 Link Here
273
you can supply dates in ISO format (e.g., '2010-10-28').
276
you can supply dates in ISO format (e.g., '2010-10-28').
274
        </li>
277
        </li>
275
    </ul>
278
    </ul>
276
    </fieldset>
277
    [% END %]
278
    <fieldset class="action">
279
        <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
280
        <input type="submit" value="Import" />
281
    </fieldset>
282
</form>
283
[% END %]
284
285
</div>
279
</div>
286
</div>
280
</div>
287
</div>
281
</div>
(-)a/t/db_dependent/Koha/Patrons/Import.t (-3 / +4 lines)
Lines 392-408 subtest 'test_set_column_keys' => sub { Link Here
392
subtest 'test_set_column_keys' => sub {
392
subtest 'test_set_column_keys' => sub {
393
    plan tests => 2;
393
    plan tests => 2;
394
394
395
    my @columns = Koha::Patrons->columns;
395
    # Given ... nothing at all
396
    # Given ... nothing at all
396
    # When ... Then ...
397
    # When ... Then ...
397
    my @columnkeys_0 = $patrons_import->set_column_keys(undef);
398
    my @columnkeys_0 = $patrons_import->set_column_keys(undef);
398
    is(scalar @columnkeys_0, 66, 'Got the expected array size from set column keys with undef extended');
399
    # -1 because we do not want the borrowernumber column
400
    is(scalar @columnkeys_0, @columns - 1, 'Got the expected array size from set column keys with undef extended');
399
401
400
    # Given ... extended.
402
    # Given ... extended.
401
    my $extended = 1;
403
    my $extended = 1;
402
404
403
    # When ... Then ...
405
    # When ... Then ...
404
    my @columnkeys_1 = $patrons_import->set_column_keys($extended);
406
    my @columnkeys_1 = $patrons_import->set_column_keys($extended);
405
    is(scalar @columnkeys_1, 67, 'Got the expected array size from set column keys with extended');
407
    is(scalar @columnkeys_1, @columns - 1 + $extended, 'Got the expected array size from set column keys with extended');
406
};
408
};
407
409
408
subtest 'test_set_patron_attributes' => sub {
410
subtest 'test_set_patron_attributes' => sub {
409
- 

Return to bug 12598