@@ -, +, @@ --- Koha/Patrons/Import.pm | 12 +++++++----- .../prog/en/modules/tools/import_borrowers.tt | 14 ++++---------- t/db_dependent/Koha/Patrons/Import.t | 6 ++++-- 3 files changed, 15 insertions(+), 17 deletions(-) --- a/Koha/Patrons/Import.pm +++ a/Koha/Patrons/Import.pm @@ -23,10 +23,12 @@ use Carp; use Text::CSV; use C4::Members; -use C4::Branch; use C4::Members::Attributes qw(:all); use C4::Members::AttributeTypes; +use Koha::Libraries; +use Koha::Patrons; +use Koha::Patron::Categories; use Koha::DateUtils; =head1 NAME @@ -401,7 +403,7 @@ Returns an array of borrowers' table columns. sub set_column_keys { my ($self, $extended) = @_; - my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } C4::Members::columns(); + my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns(); push( @columnkeys, 'patron_attributes' ) if $extended; return @columnkeys; @@ -450,8 +452,8 @@ sub check_branch_code { } # look for branch code - my $branch_name = GetBranchName( $branchcode ); - unless( $branch_name ) { + my $library = Koha::Libraries->find( $branchcode ); + unless( $library ) { push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline, value => $branchcode, branch_map => 1, }); } @@ -475,7 +477,7 @@ sub check_borrower_category { } # Looking for borrower category - my $category = GetBorrowercategory( $categorycode ); + my $category = Koha::Patron::Categories->find($categorycode); unless( $category ) { push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline, value => $categorycode, category_map => 1, }); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -241,7 +241,10 @@ [% END %] -
+
+ + +
[% END %] @@ -282,15 +285,6 @@ you can supply dates in ISO format (e.g., '2010-10-28'). - - [% END %] -
- - -
- -[% END %] - --- a/t/db_dependent/Koha/Patrons/Import.t +++ a/t/db_dependent/Koha/Patrons/Import.t @@ -392,17 +392,19 @@ subtest 'test_set_column_keys' => sub { subtest 'test_set_column_keys' => sub { plan tests => 2; + my @columns = Koha::Patrons->columns; # Given ... nothing at all # When ... Then ... my @columnkeys_0 = $patrons_import->set_column_keys(undef); - is(scalar @columnkeys_0, 66, 'Got the expected array size from set column keys with undef extended'); + # -1 because we do not want the borrowernumber column + is(scalar @columnkeys_0, @columns - 1, 'Got the expected array size from set column keys with undef extended'); # Given ... extended. my $extended = 1; # When ... Then ... my @columnkeys_1 = $patrons_import->set_column_keys($extended); - is(scalar @columnkeys_1, 67, 'Got the expected array size from set column keys with extended'); + is(scalar @columnkeys_1, @columns - 1 + $extended, 'Got the expected array size from set column keys with extended'); }; subtest 'test_set_patron_attributes' => sub { --