I believe I have come across a which at first is quite hard to tell.
When using node_save on a node with multigroup fields, it seems each field does not properly keep its delta's.
Everything works fine when the form is being submitted but on trying to programmatically update the a node things get jumbled up and this from what i have seen only seems to happen to the last field in the group.
To begin with I thought I was doing something wrong so i got a clean d.6.14 with the latest cck3 and devel.
I created a node with 5 fields and added them multigroup field then had devel generate some example content.
I then executed the following piece of code sadly the same thing seems to happen.
$node= node_load(42); print_r($node); //set the delta key using field_type+1 since field type is always used $delta_id = end(array_keys($node->field_type))+1; $node->field_name[$delta_id][value] = 'flk'; $node->field_number[$delta_id][value] = '124'; $node->field_type[$delta_id][value] = 'office'; $node->field_email[$delta_id][value] = 'flk@rocks'; $node->field_address[$delta_id][value] = 'middle of nowhere drive'; $node->field_note[$delta_id][value] = 'flk note here'; $node=node_submit($node); node_save($node); print_r($node);
If the first few field of the last field (in this case note) is empty it moves any of the above note fields down instead of keeping each note with its associated delta.
I provided before & after pictures of the forms and 'views' as well as cck definition of node type in question for anyone who wants to test this out.