The i18n module hooking into db_rewrite_sql caused an error suggesting 'n.language' wasn't a proper column for the node table. The attached patch fixes this.

CommentFileSizeAuthor
#1 NodeReferrer_616400_1.patch730 bytesnhck

Comments

nhck’s picture

Status: Active » Needs review
StatusFileSize
new730 bytes
andypost’s picture

Status: Needs review » Fixed

Commited, thanx

andypost’s picture

Status: Fixed » Needs work

Are you really sure that l10n need "node" table and not "node2" table?

nhck’s picture

I reviewed this and my conclusion is: It depends on the expected return value of nodereferrer_referrers_with_translations() - unfortunately this is not documented:

In my opinion it be node if all nodes, including the original one should be returned.
If the original one should be excluded it should be it should be node2.
This behavior is due to the INNER JOIN in the sql clause which imposes the node2 data on the node data.

i18n attaches a query that might look like this (db_rewrite_sql($query) - default usage)

WHERE (
n.language = 'en'
OR n.language = ''
OR n.language IS NULL
)

The query I debugged with looks like this (here db_rewrite_sql($query,'node') was chosen)

SELECT node2.nid, node2.vid, node2.title FROM node node INNER JOIN node node2 on node2.tnid = node.tnid WHERE (node.language ='en' OR node.language ='' OR node.language IS NULL) AND ( node.nid IN (105,104,103) AND node.tnid > 0 )
andypost’s picture

Status: Needs work » Fixed

Suppose we should filter node by language to return all referrers

Status: Fixed » Closed (fixed)

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