Hi,

on a german drupal 7 for me cnr is seriously broken. i have this relationship:

shop -- 1:n -> product with multiple references of product nodes in the shop. When I save a product with has one shop associated, drupal stops in an infinite loop.

i debugged the problem and the bug has to do with "translatable fields". In corresponding_node_references.crud.inc, line 149:

if (isset($referenced_node->{$away_field}[$referenced_node->language]) && !empty($referenced_node->{$away_field}[$referenced_node->language])) {
foreach ($referenced_node->{$away_field}[$referenced_node->language] as $data) {

in my system, $referenced_node->language is "de", while the field data is saved under "und"... so the module does not detect that the node on the other end is already updated and enters the infinite loop.

i think this problem can be fixed by using the function field_get_items instead

if ($items = field_get_items('node', $referenced_node, $away_field)) {...

but it would require changes throughout the module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Cyberwolf’s picture

Subscribing. I encountered a similar issue, that reference fields which are not translatable are not updated.

zilverdistel’s picture

subscribing

czigor’s picture

Status: Active » Postponed (maintainer needs more info)

So you have 2 node types: 'shop' and 'product'. Shop has an unlimited nr to product, while product has a single nr to shop?
What are the language settings of the node types and the actual nodes?

bforchhammer’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs review
FileSize
6.78 KB

I have the same problem.

To reproduce I think what you need to do is create two content types, enable languages on them, then create a piece of content in one language. I'm not sure whether node creation breaks already, but editing the same node does definitely...

The problem is that "field language" does not have to correspond to "node language". As the OP figured out it would probably be better to use respective drupal api functions.

Attached is a patch that uses the field_language function to fix the issue. And I'm up'ing this to major as it completely breaks node editing for any node types which have cnr enabled and a language set.

emattias’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that the patch in #4 fixes cnr for my swedish site.

As previously explained the $node->language(sv) differs from the field language which is und.

My site isn't using i18n module and translatable nodes. I believe that this situation(where that node language isn't the same as the field language) occurs anytime that the site has more than one language(so any non-english site).

bforchhammer’s picture

Marked #1359834: Not working as a duplicate. Would be great if we could get this patch committed in some form...

czigor’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

GaëlG’s picture

This should be fixed in a stable release too, because it prevents the current one from working. And it could make people post false positive new issues because they don't know it has been fixed (many duplicates already).

GaëlG’s picture

Issue summary: View changes

typo