Branch 'roundcubemail-plugins-kolab-format2-horde5' - plugins/kolab_addressbook

Thomas Brüderli bruederli at kolabsys.com
Thu Oct 23 16:21:56 CEST 2014


 plugins/kolab_addressbook/lib/rcube_kolab_contacts.php |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 3639055e92674942795f6780eef4d4242d83ee19
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu Oct 23 16:21:49 2014 +0200

    Fix import of vcard contacts (array -> string conversion) as reposted in OTRS #1007441 + export photos

diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 16a8811..17a29a5 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -65,7 +65,7 @@ class rcube_kolab_contacts extends rcube_addressbook
                                 'label' => 'kolab_addressbook.pgppublickey'),
       'pkcs7publickey' => array('type' => 'textarea', 'size' => 70, 'rows' => 10, 'limit' => 1,
                                 'label' => 'kolab_addressbook.pkcs7publickey'),
-      'notes'        => array(),
+      'notes'        => array('limit' => 1),
       'photo'        => array(),
       // TODO: define more Kolab-specific fields such as: language, latitude, longitude, crypto settings
     );
@@ -1086,7 +1086,7 @@ class rcube_kolab_contacts extends rcube_addressbook
         // photo is stored as separate attachment
         if ($record['photo'] && strlen($record['photo']) < 255 && ($att = $record['_attachments'][$record['photo']])) {
             // only fetch photo content if requested
-            if ($this->action == 'photo')
+            if ($this->action == 'photo' || $this->action == 'export')
                 $record['photo'] = $att['content'] ? $att['content'] : $this->storagefolder->get_attachment($record['uid'], $att['id']);
         }
 
@@ -1158,6 +1158,13 @@ class rcube_kolab_contacts extends rcube_addressbook
             unset($contact['address:'.$type]);
         }
 
+        // convert array values into single strings (OTRS #1007441)
+        foreach ($this->coltypes as $col => $props) {
+            if ($props['limit'] === 1 && is_array($contact[$col])) {
+                $contact[$col] = $contact[$col][0];
+            }
+        }
+
         $contact['website'] = $websites;
         $contact['phone']   = $phones;
         $contact['address'] = $addresses;




More information about the commits mailing list