I'm following the README - QUICK START GUIDE tutorial but (from my understanding) there seems to be a bug in either importing or in exporting the data, or maybe I just have the wrong settings on the profile because I get a new node created instead of new revision(s) of the node for the exact same data exported.
Here are the steps:
1. I have exported data containing just 1 node with the standard fields: nid, title, body.
2. I'm importing the data but instead of creating a new revision the module creates a new node. I started digging in the code and it seems that there might be a bug related with these lines:
// For system generated ids load a node for the nid if it exists...
if ($unique_id_field == "system_id") {
$unique_id = $line['system_id'];
}
$line is the return of fgetcsv which is numerically indexed so there won't be any 'system_id' in it.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pimport_unique_id_heading_1.patch | 686 bytes | andreiashu |
Comments
Comment #1
andreiashu commentedAnd this patch seems to fix this.
Comment #2
marcus_clements commentedHmm I don't know when I broke this. Your patch is ok but we already have the headings on line 244
// Grab the header.
$header = fgetcsv($handle);
So I've comitted a fix. Please checkout and retest
thanks
Comment #3
andreiashu commentedI've tested it out and it's not working in the latest CVS commit.
This is because (in my exported CSV) I have this header 'nid, title, body' so the
array_searchfor 'system_id' in$unique_id = $line[array_search('system_id', $header)];will return FALSE.I suppose we still need the mapping from the profile data table.
Comment #4
pobster commentedHmmm yeah this seems to be affecting title and body as unique ids as well. Is someone looking into this yet? (It's unassigned)
Pobster
Comment #5
pobster commentedComment #6
marcus_clements commentedI'll fix it later - it was an unintended consequence of work I did on translation source ids - poor regression testing... :-(
Comment #7
pobster commentedRegression testing, regression testing... Yes... I seem to remember someone talking about that once ;o)
Pobster
Comment #8
marcus_clements commentedI've refactored the unique ID checking so that the check for 'system_id' is done at the same time as building the fields array thus avoiding an extra call to the DB.
Ive tested this using nid as system id, but not title or body.
Comment #9
marcus_clements commentedfixed in latest commit
Comment #10
marcus_clements commented