This is an issue regarding the relationship "Node translation: Translations" and occurs when option "All" is selected. The Join that is created does not include untranslated nodes. But I would expect untranslated nodes to be part of "all languages" of themselves.
I tried to change the join into something like the following:

LEFT JOIN node node_node ON (node_node_data_field_XY.nid = node_node.tnid OR node_node.tnid = 0)

However, views does not support such complex joins. One can only append an AND restriction. I therefore turned the join into

LEFT JOIN node node_node ON node_node.tnid = node_node.tnid AND (node_node_data_field_XY.nid = node_node.tnid OR node_node.tnid = 0)

This is not as nice but it solves the issue. It adds untranslated nodes to the "All languages" relationship.

See my attached patch for my changes.

Thanks, Michael

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miruoss’s picture

FileSize
1.64 KB

Here comes the patch.

miruoss’s picture

FileSize
1.77 KB

My approach was actually wrong, sorry! We don't want to have tnid=0 as it would add all those nodes. What we want to add to the "join ON" is node_node.nid=node_node_data_field_XY.nid. So finally the generated join would be

LEFT JOIN node node_node ON node_node.tnid = node_node.tnid AND (node_node.tnid = node_node_data_field_XY.nid OR node_node.nid = node_node_data_field_XY.nid)

The new patch is attached.

Thanks, Michael

WorldFallz’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Assigned: Unassigned » merlinofchaos
Status: Active » Needs review
FileSize
1.77 KB

seems reasonble. rerolled against 6-3 dev

WorldFallz’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

correcting version

merlinofchaos’s picture

Status: Needs review » Needs work

Code style -- needs spaces around the concat operators. I know, in D6 standard Drupal doesn't have them there but that is an area of code style I have always deviated from Drupal and D7 changed in part because of my obstinance on the issue.

WorldFallz’s picture

Status: Needs work » Needs review
FileSize
1.78 KB

i'm with you on that style element -- i usually catch those.

bojanz’s picture

So we kill the IF surrounding the code block, but don't touch the indentation?

Also:

+          //break;

Seems not neded ;)

merlinofchaos’s picture

bojanz is right, we have to fix the indentation if we take that if out.

merlinofchaos’s picture

Status: Needs review » Needs work
dawehner’s picture

In general this patch also doesn't apply anymore.

gnindl’s picture

Patch from #6 saved my day, patched version 2.16 successfully.

gnindl’s picture

Version: 6.x-3.x-dev » 6.x-2.16
Status: Needs work » Needs review
FileSize
3.37 KB

I wasn't right there in comment #11. The extra SQL conditions are sanitized by Views due to a previous security patch probably. We have to render the SQL fragment manually as shown in the attached patch.

MustangGB’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)