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 241-247 Link Here
241
            </fieldset>
241
            </fieldset>
242
        [% END %]
242
        [% END %]
243
243
244
        <fieldset class="action"><input type="submit" value="Import" /></fieldset>
244
        <fieldset class="action">
245
            <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
246
            <input type="submit" value="Import" />
247
        </fieldset>
245
    </form>
248
    </form>
246
[% END %]
249
[% END %]
247
250
Lines 282-296 Link Here
282
you can supply dates in ISO format (e.g., '2010-10-28').
285
you can supply dates in ISO format (e.g., '2010-10-28').
283
        </li>
286
        </li>
284
    </ul>
287
    </ul>
285
    </fieldset>
286
    [% END %]
287
    <fieldset class="action">
288
        <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
289
        <input type="submit" value="Import" />
290
    </fieldset>
291
</form>
292
[% END %]
293
294
</div>
288
</div>
295
</div>
289
</div>
296
</div>
290
</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