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.

CommentFileSizeAuthor
#1 pimport_unique_id_heading_1.patch686 bytesandreiashu

Comments

andreiashu’s picture

Status: Active » Needs review
StatusFileSize
new686 bytes

And this patch seems to fix this.

marcus_clements’s picture

Hmm 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

andreiashu’s picture

I'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_search for '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.

pobster’s picture

Hmmm yeah this seems to be affecting title and body as unique ids as well. Is someone looking into this yet? (It's unassigned)

Pobster

pobster’s picture

Priority: Normal » Major
Status: Needs review » Needs work
marcus_clements’s picture

Assigned: Unassigned » marcus_clements

I'll fix it later - it was an unintended consequence of work I did on translation source ids - poor regression testing... :-(

pobster’s picture

Regression testing, regression testing... Yes... I seem to remember someone talking about that once ;o)

Pobster

marcus_clements’s picture

I'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.

marcus_clements’s picture

Status: Needs work » Needs review

fixed in latest commit

marcus_clements’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.