diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-11-26 18:49:31 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-11-26 18:49:31 +0100 |
commit | 25fb9732a008d4fb35e4afdefea552f36835fa43 (patch) | |
tree | ee35f1a78d42f82b68179128a822f9e036a957d0 /program/lib | |
parent | 787a421846ad12c4e36488f1c50d4e6d93c22b22 (diff) |
Fix so all unknown email addresses from Google csv format are imported (#1490159)
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/Roundcube/rcube_csv2vcard.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/program/lib/Roundcube/rcube_csv2vcard.php b/program/lib/Roundcube/rcube_csv2vcard.php index 802ca730d..8eff4d56c 100644 --- a/program/lib/Roundcube/rcube_csv2vcard.php +++ b/program/lib/Roundcube/rcube_csv2vcard.php @@ -302,6 +302,7 @@ class rcube_csv2vcard 'Value' => array( 'home' => 'email:home', 'work' => 'email:work', + '*' => 'email:other', ), ), 'Phone' => array( @@ -567,8 +568,19 @@ class rcube_csv2vcard foreach ($item as $item_key => $item_idx) { $value = $data[$item_idx]; - if ($value !== null && $value !== '' && ($data_idx = $this->gmail_label_map[$key][$item_key][$type])) { - $contact[$data_idx] = $value; + if ($value !== null && $value !== '') { + foreach (array($type, '*') as $_type) { + if ($data_idx = $this->gmail_label_map[$key][$item_key][$_type]) { + if (!empty($contact[$data_idx])) { + $contact[$data_idx] = (array) $contact[$data_idx]; + $contact[$data_idx][] = $value; + } + else { + $contact[$data_idx] = $value; + } + break; + } + } } } } @@ -624,7 +636,14 @@ class rcube_csv2vcard $vcard = new rcube_vcard(); foreach ($contact as $name => $value) { $name = explode(':', $name); - $vcard->set($name[0], $value, $name[1]); + if (is_array($value) && $name[0] != 'address') { + foreach ((array) $value as $val) { + $vcard->set($name[0], $val, $name[1]); + } + } + else { + $vcard->set($name[0], $value, $name[1]); + } } // add to the list |