Don't add empty property parameters.

remotes/origin/stable45
Thomas Tanghus 13 years ago
parent 1df596e758
commit 99d17c5190
  1. 4
      apps/contacts/ajax/contact/addproperty.php
  2. 4
      apps/contacts/ajax/contact/saveproperty.php

@ -141,13 +141,17 @@ foreach ($parameters as $key=>$element) {
// And it probably shouldn't be done here anyways :-/ // And it probably shouldn't be done here anyways :-/
foreach($element as $e) { foreach($element as $e) {
if($e != '' && !is_null($e)) { if($e != '' && !is_null($e)) {
if(trim($e)) {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e); $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
} }
} }
}
} else { } else {
if(trim($element)) {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $element); $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $element);
} }
} }
}
$checksum = md5($vcard->children[$line]->serialize()); $checksum = md5($vcard->children[$line]->serialize());
if(!OC_Contacts_VCard::edit($id, $vcard)) { if(!OC_Contacts_VCard::edit($id, $vcard)) {

@ -133,13 +133,16 @@ if(!$value) {
debug('Adding parameter: '.$key); debug('Adding parameter: '.$key);
if(is_array($parameter)) { if(is_array($parameter)) {
foreach($parameter as $val) { foreach($parameter as $val) {
if(trim($val)) {
debug('Adding parameter: '.$key.'=>'.$val); debug('Adding parameter: '.$key.'=>'.$val);
$vcard->children[$line]->add(new Sabre_VObject_Parameter( $vcard->children[$line]->add(new Sabre_VObject_Parameter(
$key, $key,
strtoupper(strip_tags($val))) strtoupper(strip_tags($val)))
); );
} }
}
} else { } else {
if(trim($parameter)) {
$vcard->children[$line]->add(new Sabre_VObject_Parameter( $vcard->children[$line]->add(new Sabre_VObject_Parameter(
$key, $key,
strtoupper(strip_tags($parameter))) strtoupper(strip_tags($parameter)))
@ -147,6 +150,7 @@ if(!$value) {
} }
} }
} }
}
break; break;
default: default:
debug('Setting string:'.$name.' '.$value); debug('Setting string:'.$name.' '.$value);

Loading…
Cancel
Save