Allow import subscribers with empty IP address

Allow import subscribers with empty confirmed_ip or subscribed_ip when one of the columns is selected in the last step of the import.
Don't allow importing invalid IP addresses - still import the subscriber but remove the invalid IP address.

[MAILPOET-3665]
This commit is contained in:
Brezo Cordero
2021-08-02 17:46:21 -05:00
committed by Veljko V
parent 5e1f523c96
commit 44932d27c9
2 changed files with 21 additions and 8 deletions

View File

@@ -205,9 +205,10 @@ class Import {
}
if (in_array($column, ['confirmed_ip', 'subscribed_ip'], true)) {
$data = array_map(
function($index, $ip) use(&$invalidRecords, $validator) {
function($index, $ip) use($validator) {
if (!$validator->validateIPAddress($ip)) {
$invalidRecords[] = $index;
// if invalid or empty, we allow the import but remove the IP
return null;
}
return $ip;
}, array_keys($data), $data