6.0.0-alpha14
7/2/25

[#6900] Handling of composite fields during import
Summary Handling of composite fields during import
Queue Turba
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester thomas.jarosch (at) intra2net (dot) com
Created 06/11/2008 (6230 days ago)
Due
Updated 06/11/2008 (6230 days ago)
Assigned 06/11/2008 (6230 days ago)
Resolved 06/11/2008 (6230 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
06/11/2008 05:36:50 PM CVS Commit Comment #8 Reply to this comment
06/11/2008 05:35:28 PM Michael Rubinsky Comment #7
State ⇒ Resolved
Reply to this comment
Changed the order of the conditional checks to put the (expensive) 
array_key_exists() call at the end....and committed, thanks!



I left the similar code in toHash() since I'm not sure off the top of 
my head if any other code paths would be affected.
06/11/2008 05:32:44 PM CVS Commit Comment #6 Reply to this comment
Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/turba/lib/Driver.php?r1=1.195&r2=1.196&ty=u
06/11/2008 04:42:15 PM Thomas Jarosch Deleted Original Message
 
06/11/2008 04:42:01 PM Thomas Jarosch Comment #5
New Attachment: turba-fix-composite-field-import-v2.patch Download
Reply to this comment
Yes, but follow the code in toDriverKeys() through some more and
you'll see that if we are not saving the composite field to storage
(in other words, if $this->map[$key]['attribute'] is empty) then the
composite field is parsed out into it's individual fields, and then
*those* values are saved to the $fields array when the arrays are
merged.
Thanks, you are right, I didn't notice that code path before.



Attached is an updated patch to fix this issue. I also updated

the comment to be more precise about it.


06/11/2008 04:08:22 PM Michael Rubinsky Comment #4 Reply to this comment
It sets $hash[$key] which points to the composite field, not the
individual part.
Yes, but follow the code in toDriverKeys() through some more and 
you'll see that if we are not saving the composite field to storage 
(in other words, if $this->map[$key]['attribute'] is empty) then the 
composite field is parsed out into it's individual fields, and then 
*those* values are saved to the $fields array when the arrays are 
merged.



To test this, just try to add a new contact in the "out of the box" 
localsql source using Turba's UI....it nulls out all the individual 
name fields.




06/11/2008 03:59:12 PM Thomas Jarosch Comment #3 Reply to this comment
This patch causes the individual fields that compose the composite
field to be overwritten with null values when the composite field is
not being saved as a separate field in the backend storage...
Do you mean this part?



+                if (isset($hash[$mapfields])) {

+                    // Add composite field

+                    $hash[$key] = null;

+                    break;

+                }



It sets $hash[$key] which points to the composite field, not the 
individual part.


06/11/2008 03:46:35 PM Michael Rubinsky Comment #2
State ⇒ Feedback
Reply to this comment
This patch causes the individual fields that compose the composite 
field to be overwritten with null values when the composite field is 
not being saved as a separate field in the backend storage...
06/11/2008 03:17:07 PM Chuck Hagenbuch Assigned to Michael Rubinsky
State ⇒ Assigned
 
06/11/2008 01:40:55 PM Thomas Jarosch Comment #1
Patch ⇒ No
State ⇒ Unconfirmed
New Attachment: turba-fix-composite-field-import.patch
Milestone ⇒
Queue ⇒ Turba
Summary ⇒ Handling of composite fields during import
Type ⇒ Bug
Priority ⇒ 1. Low
Reply to this comment
Hello together,



composite fields like "name" are not computed properly f.e. during import.

Attached patch adds support for that. Note: It is intended

to use array_key_exists() in the code.



I've seen there is "similar" code in the $driver->toHash() fucntion.

Maybe that can be remove if the new code gets in place.



Thomas


Saved Queries