plugins/kolab_addressbook plugins/libkolab

Aleksander Machniak machniak at kolabsys.com
Mon Jul 1 12:05:44 CEST 2013


 plugins/kolab_addressbook/lib/rcube_kolab_contacts.php |   19 +++++++++++------
 plugins/libkolab/lib/kolab_format_distributionlist.php |    8 ++-----
 2 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit bba45ce59da88c40f786694d869705e5b56edf93
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Jul 1 12:04:56 2013 +0200

    Fix PHP warning when adding contact to a group (Bug #1989)

diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 15509ec..328db26 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -821,13 +821,20 @@ class rcube_kolab_contacts extends rcube_addressbook
         foreach ($ids as $contact_id) {
             $uid = $this->id2uid($contact_id);
             if ($contact = $this->storagefolder->get_object($uid)) {
-                foreach ($this->get_col_values('email', $contact, true) as $email)
-                    break;
+                $email = '';
+                if (empty($uid)) {
+                    foreach ($contact['email'] as $email) {
+                        if (is_array($email)) {
+                            $email = $email['address'];
+                        }
+                        break;
+                    }
+                }
 
                 $list['member'][] = array(
-                    'uid' => $uid,
+                    'uid'   => $uid,
                     'email' => $email,
-                    'name' => self::compose_display_name($contact),
+                    'name'   => self::compose_display_name($contact),
                 );
                 $this->groupmembers[$contact_id][] = $gid;
                 $added++;
@@ -835,7 +842,7 @@ class rcube_kolab_contacts extends rcube_addressbook
             else if (strpos($uid, 'mailto:') === 0 && ($contact = $this->contacts[$contact_id])) {
                 $list['member'][] = array(
                     'email' => $contact['email'],
-                    'name' => $contact['name'],
+                    'name'  => $contact['name'],
                 );
                 $this->groupmembers[$contact_id][] = $gid;
                 $added++;
@@ -1096,7 +1103,7 @@ class rcube_kolab_contacts extends rcube_addressbook
         else if (!$contact['uid'] && $old['uid'])
             $contact['uid'] = $old['uid'];
 
-        $contact['im']    = array_filter($this->get_col_values('im', $contact, true));
+        $contact['im'] = array_filter($this->get_col_values('im', $contact, true));
 
         // convert email, website, phone values
         foreach (array('email'=>'address', 'website'=>'url', 'phone'=>'number') as $col => $propname) {
diff --git a/plugins/libkolab/lib/kolab_format_distributionlist.php b/plugins/libkolab/lib/kolab_format_distributionlist.php
index 0110e4e..304cdc4 100644
--- a/plugins/libkolab/lib/kolab_format_distributionlist.php
+++ b/plugins/libkolab/lib/kolab_format_distributionlist.php
@@ -44,7 +44,6 @@ class kolab_format_distributionlist extends kolab_format
 
         $this->obj->setName($object['name']);
 
-        $seen = array();
         $members = new vectorcontactref;
         foreach ((array)$object['member'] as $member) {
             if ($member['uid'])
@@ -56,7 +55,6 @@ class kolab_format_distributionlist extends kolab_format
 
             $m->setName($member['name']);
             $members->push($m);
-            $seen[$member['email']]++;
         }
 
         $this->obj->setMembers($members);
@@ -100,11 +98,11 @@ class kolab_format_distributionlist extends kolab_format
         $members = $this->obj->members();
         for ($i=0; $i < $members->size(); $i++) {
             $member = $members->get($i);
-#            if ($member->type() == ContactReference::UidReference && ($uid = $member->uid()))
+//            if ($member->type() == ContactReference::UidReference && ($uid = $member->uid()))
                 $object['member'][] = array(
-                    'uid' => $member->uid(),
+                    'uid'   => $member->uid(),
                     'email' => $member->email(),
-                    'name' => $member->name(),
+                    'name'  => $member->name(),
                 );
         }
 





More information about the commits mailing list