From ae4b2d6b5147fb78b5211e1941a6a7f7cac22f50 Mon Sep 17 00:00:00 2001 From: "Aleksander Machniak (Kolab Systems)" Date: Wed, 3 Aug 2011 11:22:12 +0200 Subject: [PATCH] Fixed PHP warning on 'gender' field handling Added vCard fieldmap definition for Kolab-specific attributes (#254) --- .../lib/rcube_kolab_contacts.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php index 92bc6cc2..4a78d078 100644 --- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php +++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php @@ -56,6 +56,18 @@ class rcube_kolab_contacts extends rcube_addressbook // TODO: define more Kolab-specific fields such as: language, latitude, longitude ); + /** + * vCard additional fields mapping + */ + public $vcard_map = array( + 'profession' => 'X-PROFESSION', + 'officelocation' => 'X-OFFICE-LOCATION', + 'initials' => 'X-INITIALS', + 'children' => 'X-CHILDREN', + 'freebusyurl' => 'X-FREEBUSY-URL', + 'pgppublickey' => 'KEY', + ); + private $gid; private $storagefolder; private $contactstorage; @@ -97,6 +109,7 @@ class rcube_kolab_contacts extends rcube_addressbook 'body' => 'notes', 'pgp-publickey' => 'pgppublickey', 'free-busy-url' => 'freebusyurl', + 'gender' => 'gender', ); @@ -1105,8 +1118,8 @@ class rcube_kolab_contacts extends rcube_addressbook $object['anniversary'] = date('Y-m-d', $date); $gendermap = array_flip($this->gender_map); - if (isset($contact['gender'])) - $object['gender'] = $gendermap[$contact['gender']]; + if (isset($object['gender'])) + $object['gender'] = $gendermap[$object['gender']]; $emails = $this->get_col_values('email', $contact, true); $object['emails'] = join(', ', array_filter($emails));