[turba] CardDAV: synchronize additional phone numbers

Dominik Erdmann horde_mailing at der-domi.de
Thu Mar 12 12:31:49 UTC 2015



Am 11.03.2015 um 23:15 schrieb Dominik Erdmann:

> how can I add additional phone numbers which shall be synchronized to
> Android's address book via CardDAV (using CardDAV-Sync by Marten Gajda)?
> Only the numbers of the fields homePhone, workPhone, cellPhone will be
> synchronized. But the fields homePhone2 and workPhone2 will be ignored.
>
> I'm using the backends.local.php with the following fields (approximate
> derived from the default config):
>
> [...]
> 'homePhone' => 'object_homephone',
> 'homePhone2' => 'object_homephone2',
> 'homeFax' => 'object_homefax',
> 'workPhone' => 'object_workphone',
> 'workPhone2' => 'object_workphone2',
> 'cellPhone' => 'object_cellphone',
> [...]

For test purpose I modified the driver turba\lib\Driver.php by adding 
following code (see attachment).
Now I have the second work phone number in my Android address book included.
Please, can someone explain why this feature isn't included in Turba? Is 
it allowed in vCard spec to add additional numbers with the same type?

What does the "safety mechanism" means which I deleted:

if ($fields &&
     (!isset($fields['TEL']) ||
      (isset($fields['TEL']->Params['TYPE']) &&
       !$this->_hasValEnum($fields['TEL']->Params['TYPE']->ValEnum, 
'WORK')))) {
      break;
}


Thanks for your help!
Dominik
-------------- next part --------------
    public function tovCard(Turba_Object $object, $version = '2.1',
                            array $fields = null, $skipEmpty = false)
    {
[...]
            case 'workPhone':
                if ($fields &&
                    (!isset($fields['TEL']) ||
                     (isset($fields['TEL']->Params['TYPE']) &&
                      !$this->_hasValEnum($fields['TEL']->Params['TYPE']->ValEnum, 'WORK')))) {
                    break;
                }
                if ($version == '2.1') {
                    $vcard->setAttribute('TEL', $val, array('WORK' => null, 'VOICE' => null));
                } else {
                    $vcard->setAttribute('TEL', $val, array('TYPE' => array('WORK', 'VOICE')));
                }
                break;

/* added: begin */
			case 'workPhone2':
                if ($version == '2.1') {
                    $vcard->setAttribute('TEL', $val, array('WORK' => null, 'VOICE' => null));
                } else {
                    $vcard->setAttribute('TEL', $val, array('TYPE' => array('WORK', 'VOICE')));
                }
                break;
/* added: end */


More information about the turba mailing list