Because of the use of "SOUNDS LIKE" rows with empty values for a node reference field can be matched against nodes with all numeric titles.

Tiny patch attached.

CommentFileSizeAuthor
#9 content.inc_.patch380 bytesvectoroc
content.inc_.patch477 bytesa_c_m

Comments

a_c_m’s picture

Title: Empty nodereferance fields are matched to nodes with numeric titles. » Empty nodereference fields are matched to nodes with numeric titles.
Robrecht Jacques’s picture

Status: Needs review » Fixed

This should be fixed. Can you check node_import-5.x-1.7 or later? If it still does not work, reopen the issue with an example CSV file.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

developone’s picture

This seems to still be an issue,

I have upgraded to 5.x-1.9 and have 1 node reference field which does not get import,
I have added a print_r where the nodes to be imported get previewed and this is what I see for the
node reference field

[field_area_0] => Array
(
[0] => Array
(
[nid] =>
[error_field] => field_area_0][nids
[view] =>
)

[nid] => �0
)

After tracing through the code quit a bit It seems that the field data is getting changed once
node_invoke_nodeapi is being called when creating the preview of nodes to be imported.

Robrecht Jacques’s picture

Status: Closed (fixed) » Active

reopening it

developone’s picture

nodereference.module

case 'process form values':
if ($field['multiple']) {
// if nothing selected, make it 'none'
if (empty($items['nids'])) {
$items['nids'] = array(0 => '0');
}
// drop the 'none' options if other items were also selected
elseif (count($items['nids']) > 1) {
unset($items['nids'][0]);
}

$items = array_values(content_transpose_array_rows_cols(array('nid' => $items['nids'])));
}
else {
$items[0]['nid'] = $items['nids'];
}

I may be mistaken but it looks to me like the else statement should be

$items[0]['nid'] = $items['nid'];
and not
$items[0]['nid'] = $items['nids'];

if i remove the 's' - the nodereference imports perfectly (NOTE: actually only shows correctly in preview but still fails to be saved)
not sure though if this will have any impact on the normal functioning of nodereferences elsewhere!

developone’s picture

In nodereference.module in function nodereference_widget, it seems we need to unset the $items['nid'] value the same way we unset
$items['nids'] - I got the nodereference import to work perfectly by changing:

$items = array_values(content_transpose_array_rows_cols(array('nid' => $items['nids'])));
}
else{
$items[0]['nid'] = $items['nids'];
}
// Remove the widget's data representation so it isn't saved.

To:

$items = array_values(content_transpose_array_rows_cols(array('nid' => $items['nids'])));
}
elseif (!isset($items[0]['nid'])) {
$items[0]['nid'] = $items['nids'];
} else {
unset($items['nid']);
}
// Remove the widget's data representation so it isn't saved.

vectoroc’s picture

#7 - it works for me.
I do not believe that is cck problem

vectoroc’s picture

StatusFileSize
new380 bytes

I believe that is better solution