[horde] Horde categories and vCard [SOLVED]

Art art2crazy at gmail.com
Mon Sep 28 15:08:01 UTC 2009


Art <art2crazy <at> gmail.com> writes:

> 
> Jan Schneider <jan <at> horde.org> writes:
> 
> > 
> > Zitat von Art <art2crazy <at> gmail.com>:
> > 
> > > Hi,
> > > My setup is:
> > >
> > > Horde 3.3.5
> > > Turba 2.3.2
> > >
> > > First thanks guys for an excellent product; the more I use it the  
> > > better it gets!
> > > One of the problems I'm having is with horde categories and vCard.  
> > > Category filed in turba/config/attributes.php is set up as follows:
> > >
> > > $attributes['category'] = array(
> > >      'label' => _("Category"),
> > >      'type' => 'category',
> > >      'params' => array(),
> > >      'required' => false
> > > );
> > >
> > > When I export my test address book to vCard everything is OK, but  
> > > when I try to import it back, category is cut to the first letter  
> > > and horde is treating it as new category.
> > > Ex: if category in vCard is "CATEGORIES:Self" it will be imported as "S"
> > > I first noticed it during sync with my Pocket PC, but I tested it  
> > > with just a regular import/export from turba and it's as I described  
> > > above. When I change the type to text in attributes file, horde  
> > > imports it correctly.
> > > So, I guess the question is if this is a known bug/somebody can  
> > > confirm or if not how can I trace is it, and maybe you can tell me  
> > > which file/function is responsible for matching horde categories?
> > 
> > The mapping between vCard properties and Turba attributes happens in  
> > the toHash() method in turba/lib/Driver.php.
> > 
> > Jan.
> > 
> Mapping between vCard and Horde attributes is working; value in the hash 
seems 
> to be OK - when I change the type of the filed to 'text' everything seems 
> fine. It's only when the type of the filed is set to 'category' and turba 
> suppose to use existing horde categories, the value from the hash gets cut 
to 
> just a first letter. 
> Is there some "post-processing"/matching to existing horde categories done 
> somewhere else?
> 
> Thanks,
> art
> 

Problem was in turba/lib/Driver.php function toDriverKeys().

        /* Handle category. */
        if (!empty($hash['category']) &&
            $GLOBALS['attributes']['category']['type'] == 'category') {
            if (!empty($hash['category']['new'])) {
                require_once 'Horde/Prefs/CategoryManager.php';
                $cManager = new Prefs_CategoryManager();
//                $cManager->add($hash['category']['value']); <-- problem line
                $cManager->add($hash['category']);
            }
//            $hash['category'] = $hash['category']['value']; <-- problem line
        }

I don't know much about php, but it looks like '$hash['category']['value']' is 
causing this problem. When I changed it to just '$hash['category']' everything 
is fine.
I'm also not really sure why the value in the hash is being overwritten by 
itself (2nd problem line), but I comment it out as well, and now everything 
works as it should.

Thanks for your help Jan.
art




More information about the horde mailing list