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
Comments
Comment #1
miruoss commentedHere comes the patch.
Comment #2
miruoss commentedMy 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
The new patch is attached.
Thanks, Michael
Comment #3
WorldFallz commentedseems reasonble. rerolled against 6-3 dev
Comment #4
WorldFallz commentedcorrecting version
Comment #5
merlinofchaos commentedCode 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.
Comment #6
WorldFallz commentedi'm with you on that style element -- i usually catch those.
Comment #7
bojanz commentedSo we kill the IF surrounding the code block, but don't touch the indentation?
Also:
Seems not neded ;)
Comment #8
merlinofchaos commentedbojanz is right, we have to fix the indentation if we take that if out.
Comment #9
merlinofchaos commentedComment #10
dawehnerIn general this patch also doesn't apply anymore.
Comment #11
gnindl commentedPatch from #6 saved my day, patched version 2.16 successfully.
Comment #13
gnindl commentedI 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.
Comment #14
mustanggb commented