diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-26 21:46:18 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-03-26 21:47:37 +0200 |
commit | ee31bc7995eaef0741dc1579d8b6b7e58f359ce4 (patch) | |
tree | ebcaa0f2bfc0fae99c7ad7ebc0f0015b5112c01e /apps/contacts/ajax | |
parent | 31e20d22834fd492f97ae38e6919f798ab6be932 (diff) | |
download | nextcloud-server-ee31bc7995eaef0741dc1579d8b6b7e58f359ce4.tar.gz nextcloud-server-ee31bc7995eaef0741dc1579d8b6b7e58f359ce4.zip |
Contacts: Fix saveproperty for categories
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r-- | apps/contacts/ajax/saveproperty.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 95a7ac20193..272a3f9b325 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -83,16 +83,34 @@ if($element != $name) { bailOut(OC_Contacts_App::$l10n->t('Something went FUBAR. ').$name.' != '.$element); } +/* preprocessing value */ switch($element) { case 'BDAY': $date = New DateTime($value); //$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE); $value = $date->format(DateTime::ATOM); + break; case 'FN': if(!$value) { // create a method thats returns an alternative for FN. //$value = getOtherValue(); } + break; + case 'CATEGORIES': + /* multi autocomplete triggers an save with empty value */ + if (!$value) { + $value = $vcard->getAsString('CATEGORIES'); + } + break; + case 'EMAIL': + $value = strtolower($value); + break; +} + +/* setting value */ +switch($element) { + case 'BDAY': + case 'FN': case 'N': case 'ORG': case 'NOTE': @@ -102,7 +120,6 @@ switch($element) { $vcard->setString($name, $value); break; case 'EMAIL': - $value = strtolower($value); case 'TEL': case 'ADR': // should I delete the property if empty or throw an error? debug('Setting element: (EMAIL/TEL/ADR)'.$element); |