Skip to content

Commit

Permalink
Fixing main element select query for backend element list
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits authored and pollen8 committed Oct 12, 2011
1 parent e1c63b4 commit c268425
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion administrator/components/com_fabrik/models/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,22 @@ protected function getListQuery()
$this->filterByFormQuery($query, 'fg');

// Join over the users for the checked out user.

// $$$ hugh - altered this query as ...
// WHERE (jj.list_id != 0 AND jj.element_id = 0)
// ...instead of ...
// WHERE jj.list_id != 0
//... otherwioe we pick up repeat elements, as they have both table and element set
// and he query fails with "returns multiple values" for the fullname select

$fullname = "(SELECT DISTINCT(
IF( ISNULL(jj.table_join), CONCAT(ll.db_table_name, '___', ee.name), CONCAT(jj.table_join, '___', ee.name))
)
FROM #__fabrik_elements AS ee
LEFT JOIN #__{package}_joins AS jj ON jj.group_id = ee.group_id
LEFT JOIN #__{package}_formgroup as fg ON fg.group_id = ee.group_id
LEFT JOIN #__{package}_lists AS ll ON ll.form_id = fg.form_id
WHERE jj.list_id != 0
WHERE (jj.list_id != 0 AND jj.element_id = 0)
AND ee.id = e.id AND ee.group_id <> 0 LIMIT 1) AS full_element_name";

$query->select('u.name AS editor, '.$fullname.', g.name AS group_name, l.db_table_name');
Expand Down

0 comments on commit c268425

Please sign in to comment.