Support simple field labels (e.g. LetterHub examples) in csv imports (#6541)

pull/6574/head
Aleksander Machniak 6 years ago
parent 8caf3b659c
commit 35e2bffb90

@ -12,6 +12,7 @@ CHANGELOG Roundcube Webmail
- Update to TinyMCE 4.8.2
- Prevent from using deprecated timezone names from jsTimezoneDetect
- Force session.gc_probability=1 when using custom session handlers (#6560)
- Support simple field labels (e.g. LetterHub examples) in csv imports (#6541)
- Plugin API: Added 'raise_error' hook (#6199)
- Plugin API: Added 'common_headers' hook (#6385)
- Plugin API: Added 'ldap_connected' hook

@ -156,6 +156,18 @@ class rcube_csv2vcard
'name' => 'displayname',
'name_prefix' => 'prefix',
'name_suffix' => 'suffix',
// Format of Letter Hub test files from
// https://letterhub.com/sample-csv-file-with-contacts/
'company_name' => 'organization',
'address' => 'street:home',
'city' => 'locality:home',
//'county' => '',
'state' => 'region:home',
'zip' => 'zipcode:home',
'phone1' => 'phone:home',
'phone' => 'phone:work',
'email' => 'email:home',
);
/**
@ -389,7 +401,7 @@ class rcube_csv2vcard
}
}
$this->label_map = array_flip($this->label_map);
$this->label_map = array_flip($this->label_map);
$this->local_label_map = array_flip($this->local_label_map);
}
@ -530,6 +542,16 @@ class rcube_csv2vcard
}
}
// If nothing recognized fallback to simple non-localized labels
if (empty($map1) && empty($map2)) {
for ($i = 0; $i < $size; $i++) {
$label = str_replace(' ', '_', strtolower($elements[$i]));
if (!empty($this->csv2vcard_map[$label])) {
$map1[$i] = $this->csv2vcard_map[$label];
}
}
}
$this->map = count($map1) >= count($map2) ? $map1 : $map2;
// support special Gmail format

Loading…
Cancel
Save