diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-01-07 19:52:05 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-01-07 19:52:05 +0100 |
commit | 987b7aea59cb6434c7e4546796d070a6edc89f78 (patch) | |
tree | 02652d1a1041f9194073dd6862e4282f3fc730a2 | |
parent | 6c7ac2ef4b6e9482fd47b290dd9b07e5f8a0bd54 (diff) | |
parent | acf851f823fba5354c2227e48c3097a524312268 (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
-rw-r--r-- | program/lib/Roundcube/rcube_csv2vcard.php | 9 | ||||
-rw-r--r-- | tests/Framework/Csv2vcard.php | 1 | ||||
-rw-r--r-- | tests/src/Csv2vcard/tb_plain.vcf | 2 |
3 files changed, 12 insertions, 0 deletions
diff --git a/program/lib/Roundcube/rcube_csv2vcard.php b/program/lib/Roundcube/rcube_csv2vcard.php index f94a7aac7..e8202c6d4 100644 --- a/program/lib/Roundcube/rcube_csv2vcard.php +++ b/program/lib/Roundcube/rcube_csv2vcard.php @@ -390,6 +390,15 @@ class rcube_csv2vcard } } + // Convert address(es) to rcube_vcard data + foreach ($contact as $idx => $value) { + $name = explode(':', $idx); + if (in_array($name[0], array('street', 'locality', 'region', 'zipcode', 'country'))) { + $contact['address:'.$name[1]][$name[0]] = $value; + unset($contact[$idx]); + } + } + // Create vcard object $vcard = new rcube_vcard(); foreach ($contact as $name => $value) { diff --git a/tests/Framework/Csv2vcard.php b/tests/Framework/Csv2vcard.php index 6fa3e163c..f460c42af 100644 --- a/tests/Framework/Csv2vcard.php +++ b/tests/Framework/Csv2vcard.php @@ -31,6 +31,7 @@ class Framework_Csv2vcard extends PHPUnit_Framework_TestCase $vcf_text = trim(str_replace("\r\n", "\n", $vcf_text)); $vcard = trim(str_replace("\r\n", "\n", $vcard)); +echo $vcard; $this->assertEquals($vcf_text, $vcard); } diff --git a/tests/src/Csv2vcard/tb_plain.vcf b/tests/src/Csv2vcard/tb_plain.vcf index aace259d8..b001c3924 100644 --- a/tests/src/Csv2vcard/tb_plain.vcf +++ b/tests/src/Csv2vcard/tb_plain.vcf @@ -15,4 +15,6 @@ ORG:Organization URL;TYPE=homepage:http://page.com URL;TYPE=other:http://webpage.tld BDAY;VALUE=date:1970-11-15 +ADR;TYPE=home:;;Priv address;City;region;xx-xxx;USA +ADR;TYPE=work:;;Addr work;;;33-333;Poland END:VCARD |