6.0.0-alpha10
5/14/25

[#14753] Doubled name at importing a vcf-file or synchronizing with CardDAV
Summary Doubled name at importing a vcf-file or synchronizing with CardDAV
Queue Turba
Queue Version 4.2.21
Type Bug
State Feedback
Priority 2. Medium
Owners
Requester softload (at) justmail (dot) de
Created 12/15/2017 (2707 days ago)
Due
Updated 01/22/2018 (2669 days ago)
Assigned 01/22/2018 (2669 days ago)
Resolved
Milestone
Patch No

History
01/22/2018 07:40:57 PM softload (at) justmail (dot) de Comment #8
New Attachment: turba-backends-patch Download
Reply to this comment
You do this like with any files. Compare the old and the new versions with:
diff -u old.php new.php
Here are the patches now. The first for turba/lib/Driver.php
And the next for turba/config/backends.php
01/22/2018 07:39:58 PM softload (at) justmail (dot) de Comment #7
New Attachment: turba-Driver-patch Download
Reply to this comment
You do this like with any files. Compare the old and the new versions with:
diff -u old.php new.php
Here are the patches now. The first for turba/lib/Driver.php
01/22/2018 05:31:23 PM Jan Schneider Comment #6 Reply to this comment
You do this like with any files. Compare the old and the new versions with:
diff -u old.php new.php
01/22/2018 05:26:54 PM softload (at) justmail (dot) de Comment #5 Reply to this comment
Can you provide patches against those files instead? This way your 
changes are much easier to read and don't depend on the release 
version.
  Sorry, but i don't know, how patches can be done with php. That's 
the reason i tried to explain the changes with the line numbers and 
comments in the provided files.
01/22/2018 04:48:44 PM Jan Schneider Comment #4
State ⇒ Feedback
Priority ⇒ 2. Medium
Reply to this comment
Can you provide patches against those files instead? This way your 
changes are much easier to read and don't depend on the release version.
01/01/2018 04:13:31 PM softload (at) justmail (dot) de Comment #3
New Attachment: backends new.php Download
Reply to this comment
And there should another parsing-entry in backends.php.
array('fields' => array('lastname'), 'format' => '%s')

I made this change in the appended file "backends new.php"
01/01/2018 04:11:01 PM softload (at) justmail (dot) de Comment #2
New Attachment: Driver new.php Download
Reply to this comment
The Problem is in class Turba_Driver in function toDriverKeys in file 
horde/turba/lib/Driver.php. This function use the settings 
$cfgSources['localsql']['map']['name']['parse'] in 
horde/turba/config/backends.php. The first array is array('fields' => 
array('firstname', 'middlenames', 'lastname'), 'format' => '%s %s 
%s'). Is there only a lastname in FN-field of the vcf-file, this entry 
is read as firstname. The middlenames isn't set, if nothing else is in 
FN-field. In line 330 of Driver.php it is then checked, that lastname 
already is set, because of the N-field of the vcf-file. Then both 
for-loops are break. But the Problem is in Line 342. The variable 
$tmp_fields isn't empty and now the fault mapping of the FN-field is 
merge to the existing $fields. The correct way would be to clean the 
array $tmp_fields before breaking the loops.

But i think it is not good to break all loops, because there can be 
additional entrys in FN-field, which wouldn't be set of the N-field. 
So the break in line 333 should be only one break.  But then the 
setting of $tmp_fields in line 335 should be before the break, because 
of a break, the counter isn't correct.

The second bug is the array_merge in line 342. If the parsing-Array is 
empty, $tmp_fields isn't set and array_merge return nothing. So 
$fields is erased. There are two solutions. Set $tmp_fields to an 
empty Array additional before the loop or check $tmp_fields if it is 
set. I prefer the last one.

I made all changes in the appended file "Driver new.php"
12/15/2017 07:27:48 PM softload (at) justmail (dot) de Comment #1
State ⇒ Unconfirmed
New Attachment: Horde Testkontakte.vcf Download
Patch ⇒ No
Milestone ⇒
Queue ⇒ Turba
Summary ⇒ Doubled name at importing a vcf-file or synchronizing with CardDAV
Type ⇒ Bug
Priority ⇒ 3. High
Reply to this comment
When importing the attached vcf-file or synchronized it with CardDAV, 
the contact Test2, which has only a last-name, gets the last-name as 
additional first-name. So the name is doubled. The reason is the name 
in the FN-field of the vcf-file and the parsing at importing. The user 
could be patched this by shut-off the parsing. This could be done with 
a local-setupfile backends.local.php in /etc/horde/turba. Following 
entry has to be in the file:

<?php
$cfgSources['localsql']['map']['name']['parse'] = array('none');

Because of another bug the array must have an entry. Otherwise nothing 
can be imported.

Saved Queries