* CardDAV: fixed not working deleting of existing fields and cell phone numbers for Apple clients

This commit is contained in:
Ralf Becker 2012-04-04 17:39:35 +00:00
parent 1bf66486ae
commit 4a0d52e834

View File

@ -631,6 +631,7 @@ class addressbook_vcal extends addressbook_bo
case 'PREF': case 'PREF':
case 'X-CUSTOMLABEL-CAR': case 'X-CUSTOMLABEL-CAR':
case 'X-CUSTOMLABEL-IPHONE': case 'X-CUSTOMLABEL-IPHONE':
case 'IPHONE':
if ($vcardRow['name'] == 'TEL') if ($vcardRow['name'] == 'TEL')
{ {
$vcardRow['tparams'][$type] = ''; $vcardRow['tparams'][$type] = '';
@ -676,9 +677,10 @@ class addressbook_vcal extends addressbook_bo
} }
break; break;
case 'X-CUSTOMLABEL-IPHONE': case 'X-CUSTOMLABEL-IPHONE':
if ($rowName == 'TEL') case 'IPHONE':
if ($rowName == 'TEL' || $rowName == 'TEL;CELL')
{ {
$rowName = 'TEL;CELL;HOME'; $rowName = 'TEL;IPHONE';
} }
break; break;
default: default:
@ -827,17 +829,17 @@ class addressbook_vcal extends addressbook_bo
} }
break; break;
case 'TEL;CELL;X-egw-Ref1': case 'TEL;CELL;X-egw-Ref1':
if (!in_array('TEL;CELL;WORK', $rowNames) $supported = isset($this->supportedFields['TEL;CELL']) ? 'TEL;CELL' : 'TEL;CELL;WORK';
&& !isset($finalRowNames['TEL;CELL;WORK'])) if (!in_array($supported, $rowNames) && !isset($finalRowNames[$supported]))
{ {
$finalRowNames['TEL;CELL;WORK'] = $vcardKey; $finalRowNames[$supported] = $vcardKey;
break; break;
} }
case 'TEL;CELL;X-egw-Ref2': case 'TEL;CELL;X-egw-Ref2':
if (!in_array('TEL;CELL;HOME', $rowNames) $supported = isset($this->supportedFields['TEL;IPHONE']) ? 'TEL;IPHONE' : 'TEL;CELL;HOME';
&& !isset($finalRowNames['TEL;CELL;HOME'])) if (!in_array($supported, $rowNames) && !isset($finalRowNames[$supported]))
{ {
$finalRowNames['TEL;CELL;HOME'] = $vcardKey; $finalRowNames[$supported] = $vcardKey;
break; break;
} }
case 'TEL;CELL;X-egw-Ref3': case 'TEL;CELL;X-egw-Ref3':
@ -900,6 +902,14 @@ class addressbook_vcal extends addressbook_bo
} }
$contact = array(); $contact = array();
// to be able to delete fields, we have to set all supported fields to at least null
foreach($this->supportedFields as $fields)
{
foreach($fields as $field)
{
$contact[$field] = null;
}
}
foreach ($finalRowNames as $key => $vcardKey) foreach ($finalRowNames as $key => $vcardKey)
{ {