Bug 10403: (follow-up) fix test to use vendor created earlier during test
[koha.git] / tools / import_borrowers.pl
index 74a5889..5f65c97 100755 (executable)
@@ -58,11 +58,11 @@ use CGI;
 my (@errors, @feedback);
 my $extended = C4::Context->preference('ExtendedPatronAttributes');
 my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences');
-my @columnkeys = C4::Members->columns;
+my @columnkeys = C4::Members::columns();
 if ($extended) {
     push @columnkeys, 'patron_attributes';
 }
-my $columnkeystpl = [ map { {'key' => $_} }  grep {$_ ne 'borrowernumber' && $_ ne 'cardnumber'} @columnkeys ];  # ref. to array of hashrefs.
+my $columnkeystpl = [ map { {'key' => $_} }  grep {$_ ne 'borrowernumber' } @columnkeys ];  # ref. to array of hashrefs.
 
 my $input = CGI->new();
 our $csv  = Text::CSV->new({binary => 1});  # binary needed for non-ASCII Unicode
@@ -243,6 +243,10 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
             for my $col (keys %borrower) {
                 # use values from extant patron unless our csv file includes this column or we provided a default.
                 # FIXME : You cannot update a field with a  perl-evaluated false value using the defaults.
+
+                # The password is always encrypted, skip it!
+                next if $col eq 'password';
+
                 unless(exists($csvkeycol{$col}) || $defaults{$col}) {
                     $borrower{$col} = $member->{$col} if($member->{$col}) ;
                 }
@@ -300,7 +304,7 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
 } else {
     if ($extended) {
         my @matchpoints = ();
-        my @attr_types = C4::Members::AttributeTypes::GetAttributeTypes();
+        my @attr_types = C4::Members::AttributeTypes::GetAttributeTypes(undef, 1);
         foreach my $type (@attr_types) {
             my $attr_type = C4::Members::AttributeTypes->fetch($type->{code});
             if ($attr_type->unique_id()) {