plugins/kolab_addressbook

Aleksander Machniak machniak at kolabsys.com
Mon Dec 31 17:42:17 CET 2012


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

New commits:
commit 892d91af3eaeea4e0900b9cf8bb1a53c8f4ff6ec
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Dec 31 17:41:30 2012 +0100

    Fix saving birthday date in XML after import from vCard

diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index bb6ef24..a09a1e7 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -559,7 +559,7 @@ class rcube_kolab_contacts extends rcube_addressbook
 
             // generate new Kolab contact item
             $object = $this->_from_rcube_contact($save_data);
-            $saved = $this->storagefolder->save($object, 'contact');
+            $saved  = $this->storagefolder->save($object, 'contact');
 
             if (!$saved) {
                 rcube::raise_error(array(
@@ -605,7 +605,7 @@ class rcube_kolab_contacts extends rcube_addressbook
             else {
                 $this->contacts[$id] = $this->_to_rcube_contact($object);
                 $updated = true;
-                
+
                 // TODO: update data in groups this contact is member of
             }
         }
@@ -1163,6 +1163,14 @@ class rcube_kolab_contacts extends rcube_addressbook
                 $contact[$key] = $val;
         }
 
+        // convert one-item-array elements into string element
+        // this is needed e.g. to properly import birthday field
+        foreach ($this->coltypes as $type => $col_def) {
+            if ($col_def['limit'] == 1 && is_array($contact[$type])) {
+                $contact[$type] = array_shift(array_filter($contact[$type]));
+            }
+        }
+
         // add empty values for some fields which can be removed in the UI
         return array_filter($contact) + array('nickname' => '', 'birthday' => '', 'anniversary' => '', 'freebusyurl' => '', 'photo' => $contact['photo']);
     }





More information about the commits mailing list