@@ -288,9 +288,12 @@ private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array
288
288
{
289
289
$ firstCustomer = reset ($ entitiesToUpdate );
290
290
$ columnsToUpdate = array_keys ($ firstCustomer );
291
- $ customerFieldsToUpdate = array_filter ($ this ->customerFields , function ($ field ) use ($ columnsToUpdate ) {
292
- return in_array ($ field , $ columnsToUpdate );
293
- });
291
+ $ customerFieldsToUpdate = array_filter (
292
+ $ this ->customerFields ,
293
+ function ($ field ) use ($ columnsToUpdate ) {
294
+ return in_array ($ field , $ columnsToUpdate );
295
+ }
296
+ );
294
297
return $ customerFieldsToUpdate ;
295
298
}
296
299
@@ -423,6 +426,9 @@ protected function _prepareDataForUpdate(array $rowData)
423
426
$ attributeParameters = $ this ->_attributes [$ attributeCode ];
424
427
if (in_array ($ attributeParameters ['type ' ], ['select ' , 'boolean ' ])) {
425
428
$ value = $ this ->getSelectAttrIdByValue ($ attributeParameters , $ value );
429
+ if ($ attributeCode === CustomerInterface::GENDER && $ value === 0 ) {
430
+ $ value = null ;
431
+ }
426
432
} elseif ('multiselect ' == $ attributeParameters ['type ' ]) {
427
433
$ ids = [];
428
434
foreach (explode ($ multiSeparator , mb_strtolower ($ value )) as $ subValue ) {
@@ -519,10 +525,8 @@ protected function _importData()
519
525
if (!isset ($ attributesToSave [$ tableName ])) {
520
526
$ attributesToSave [$ tableName ] = [];
521
527
}
522
- $ attributesToSave [$ tableName ] = array_diff_key (
523
- $ attributesToSave [$ tableName ],
524
- $ customerAttributes
525
- ) + $ customerAttributes ;
528
+ $ attributes = array_diff_key ($ attributesToSave [$ tableName ], $ customerAttributes );
529
+ $ attributesToSave [$ tableName ] = $ attributes + $ customerAttributes ;
526
530
}
527
531
}
528
532
}
@@ -578,13 +582,9 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
578
582
$ this ->addRowError (self ::ERROR_INVALID_STORE , $ rowNumber );
579
583
}
580
584
// check password
581
- if (isset (
582
- $ rowData ['password ' ]
583
- ) && strlen (
584
- $ rowData ['password ' ]
585
- ) && $ this ->string ->strlen (
586
- $ rowData ['password ' ]
587
- ) < self ::MIN_PASSWORD_LENGTH
585
+ if (isset ($ rowData ['password ' ])
586
+ && strlen ($ rowData ['password ' ])
587
+ && $ this ->string ->strlen ($ rowData ['password ' ]) < self ::MIN_PASSWORD_LENGTH
588
588
) {
589
589
$ this ->addRowError (self ::ERROR_PASSWORD_LENGTH , $ rowNumber );
590
590
}
0 commit comments