[dev] [cvs] commit: turba/lib Driver.php

Gunnar Wrobel wrobel at pardus.de
Thu Mar 20 13:44:03 UTC 2008


Jan Schneider <jan at horde.org> writes:

> Zitat von Gunnar Wrobel <p at rdus.de>:
>
>> wrobel      2008-03-20 08:29:22 EDT
>>
>>   Modified files:
>>     lib                  Driver.php
>>   Log:
>>   Removed possible notice. We cannot be certain here that all the  
>> fields are set in the hash.
>>
>>   Revision  Changes    Path
>>   1.189     +6 -2      turba/lib/Driver.php
>>
>>   Chora Links:
>>   http://cvs.horde.org/diff.php/turba/lib/Driver.php?r1=1.188&r2=1.189&ty=u
>
> That doesn't make sense. If a field doesn't exist, it shouldn't be in  
> the 'map/fields' array.

I get the notice I was trying to fix when importing a vCard into
Turba.


$vcardtxt = 'BEGIN:VCARD
VERSION:2.1
N:test3;test3;;;
FN:test3 test3
END:VCARD';

$iCal = new Horde_iCalendar();
$vcard = Horde_iCalendar::newComponent('vcard', $iCal);
$vcard->parsevCalendar($vcardtxt);
$iCal->addComponent($vcard);
$content = $iCal->getComponent(0);
$turba = Turba_Driver::singleton('wrobel at dev.pardus.de');
var_dump($turba->toHash($content));

array(3) {
  ["lastname"]=>
  string(5) "test3"
  ["firstname"]=>
  string(5) "test3"
  ["name"]=>
  string(30) "firstname middlenames lastname"
}

As far as I can tell _turba_import() in api.php converts a vCard to a
hash using $driver->toHash(). This function does not guarantee that
all possible turba attributes are set in the hash (in this case the
vCard does not provide "middlenames").

When _turba_import() calls $driver->add() with the hash it will be
used with toDriverKeys($hash).

For Kolab 'name' is defined as

            'name' => array('fields' => array('firstname', 'middlenames', 'lastname'),
                            'format' => '%s %s %s',
                            'attribute' => 'full-name'),

but middlenames is not provides by the hash so I get a notice.

I'm probably missing something and need to fix the Kolab
driver. Should the Kolab driver somehow override the toHash() function
and ensure that all required Turba attributes are set in the Hash?


Cheers,

Gunnar





>
> Jan.
>
> -- 
> Do you need professional PHP or Horde consulting?
> http://horde.org/consulting/
>
>
> -- 
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org

-- 
____ http://www.pardus.de _________________ http://gunnarwrobel.de _

E-mail : p at rdus.de                                 Dr. Gunnar Wrobel
Tel.   : +49 700 6245 0000                         Bundesstrasse 29
Fax    : +49 721 1513 52322                        D-20146 Hamburg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   >> Mail at ease - Rent a kolab groupware server at p at rdus <<                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the dev mailing list