JoomFish/jf-future — Issue #13: Cannot filter on (un)published translations: database error 'Unknown column 'ct.published'...
Author: quodo
Created: 2012-01-20 13:06:48+00:00
State: open

Cannot filter on (un)published translations: database error 'Unknown column 'ct.published'...

**Reproduce error**
- Joomla 1.7.3: JoomFish > Translation
- Select Language (Dutch) and Content Element (Cateogories, Contents, Menus, or Modules)
- Select Translation Availability: (un)published

Notes
* Not all content elements work (that's for a different issue)
* Not all content elements have the Translation Availability filter
* My 3rd party Content Elements with the Translation Availability filter work fine.

**Result (when Debug off and System Error Reporting Default)**
No valid database connection: DB function failed with error number 1054
Unknown column 'ct.published' in 'where clause' SQL=SELECT c.id, ct.id AS jfc_id, c.title as title, ct.title as titleTranslation, c.title, ct.title AS jfc_title, c.title_alias, ct.title_alias AS jfc_title_alias, c.catid, ct.catid AS jfc_catid, c.alias, ct.alias AS jfc_alias, c.introtext, ct.introtext AS jfc_introtext, c.fulltext, ct.fulltext AS jfc_fulltext, c.images, ct.images AS jfc_images, c.metakey, ct.metakey AS jfc_metakey, c.metadesc, ct.metadesc AS jfc_metadesc, c.publish_up, ct.publish_up AS jfc_publish_up, c.publish_down, ct.publish_down AS jfc_publish_down, c.created, ct.created AS jfc_created, c.modified as modified_date, c.modified, ct.modified AS jfc_modified, c.checked_out as checked_out, c.checked_out, ct.checked_out AS jfc_checked_out, c.checked_out_time, ct.checked_out_time AS jfc_checked_out_time, c.attribs, ct.attribs AS jfc_attribs, ct.id as jfc_id, ct.state as published, ct.id as jfc_refid, '2010-06-11 05:30:30' as lastchanged FROM jos_content as c LEFT JOIN jos_jf_translationmap as tm ON tm.reference_id=c.id AND tm.reference_table='content' AND tm.language='nl-NL' LEFT JOIN jos_content as ct ON tm.translation_id=ct.id WHERE ct.published=1 AND c.state>=-1 AND c.language="*" LIMIT 0, 20

*The #__content table has no published entry.*

**Result (when Debug is on and System Error Reporting is on Maximum)**
500 - An error has occurred.
JDatabaseMySQL::query: 1054 - Unknown column 'ct.published' in 'where clause' SQL=SELECT COUNT(distinct id) FROM jos_content as c LEFT JOIN jos_jf_translationmap as tm ON tm.reference_id=c.id AND tm.reference_table='content' AND tm.language='nl-NL' WHERE ct.published=1 AND c.state>=-1

This is the logged query at the bottom of the page (when Debug is on)
SELECT COUNT(distinct id)
FROM jos_content as c
LEFT JOIN jos_jf_translationmap as tm
ON tm.reference_id=c.id
AND tm.reference_table='content'
AND tm.language='nl-NL'
WHERE ct.published=1
AND c.state>=-1

*There is no ct table, only a c.*

(By the way, I noticed this when testing Klas' commit to fix issue #10, but the error was not caused by that commit, in a previous installation (where that commit wasn't applied) I got the same error)