Hello,
When importing a CSV file into a custom node type (CCK) which has a Node Reference as one field, then it requires that node to have a universally unique node title (i.e. the node must have a unique title for all nodes). This is problematic for if you have two of the same node titles, which are attached to nodes of different types.
As an example:
----------------------
Node/1
-> Type: type_1
* Title: XYZ
* Body: ...
----------------------
----------------------
Node/2
-> Type: type_2
* Title: XYZ
* Body: ...
----------------------
When importing the CSV file into a different node of a different type once again, e.g. type_3 which references (say) type_2... it comes up with this error message:
type_2: : this post can't be referenced.
Which, I am guessing, must mean that it is searching using node title when loading up Node References.... and returns the first node. (this works if the node ref happens to be type_1... as the node is earlier in search results).
Therefore, in order to get it working we must have universal node titles.... not ideal! I'm considering changing my knowledge-architecture so that I don't have duplicate titles (as I don't really need to do it the way that I am currently doing it), but in other circumstances the reliance on node title isn't necessary.
My proposal for (partially) fixing this bug is actually by restricting the node reference to search the specific type being referenced only (e.g. searching through "type_2" only, rather than all types). If I get a chance then I'll look at this myself, but if anybody else gets a chance before I do then it'll be appreciated :-) I've also noticed that it is a similar problem in other parts of the module (i.e. the reliance on title, but this is slightly more specific to types... and I hope that by specifying particular node types to search through will eliminate some problems when using node title).
This is the first issue I've created relating to Drupal, and I'm quite new to Drupal itself. But I'll help where and when I can :-)
Thanks ever so much! I hope all is well with you all.
Daniel
-----
Other information:
-----
* Drupal version: 6.12
* PHP Version: 5.2.6
* MySQL Version: 14.12 Distrib 5.0.75
* CCK Version: 6.x-2.4
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | node_import_514552.patch | 4.28 KB | cyberwolf |
| #7 | node_import_514552.patch | 5.96 KB | cyberwolf |
Comments
Comment #1
david lesieur commentedMore descriptive title for this issue.
Comment #2
cyberwolf commentedSubscribing.
Comment #3
cyberwolf commentedUsing _nodereference_potential_references (although meant to be a private function currently) or a similar function might be a solution.
Comment #4
blue56 commentedI can confirm this issue. I also argee on the solution proposal.
Comment #5
blue56 commentedIt sounds like a good idea to use this function because it is part for the node reference module and proberly more stable. I think node_import_check_node_reference function in node_import.inc should be rewritten, But are there other places?
Kind regards
Jacob
Comment #6
blue56 commentedComment #7
cyberwolf commentedAttaching a patch. It does the job but probably can use a lot of cleanup.
Comment #8
cyberwolf commentedPrevious patch contained some files of my IDE, so reuploading without those files.
Comment #9
kbk commentedPotential duplicate with competing patch:
#954276: Reference nodes titles collide with other nodes
Definite duplicate report:
#993510: Problems importing node references with similar names
Comment #10
kbk commentedComment #11
flaviovs commentedPatch #8 fixed the issue to me. NB: I'm using 1.x-dev.
Comment #12
mtcs commentedPatch #8 is also working for me.
See my other issue about case sensitivity: #1308600: Case sensitivity in node reference titles