Skip to content

Commit

Permalink
Fix (?) for table alias in CDD autocompete_where.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Feb 21, 2015
1 parent e5bec85 commit 45df772
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions plugins/fabrik_element/databasejoin/databasejoin.php
Expand Up @@ -2912,29 +2912,28 @@ public static function cacheAutoCompleteOptions($elementModel, $search, $opts =

if (!strstr($c, 'CONCAT'))
{
if (!strstr($c, '.'))
{
$join = $elementModel->getJoin();
$joinTable = $join->table_join_alias;
$c = $joinTable.'.'.$c
}
$c = FabrikString::safeColName($c);
}

$filterMethod = $elementModel->getFilterBuildMethod();

if ($filterMethod == 1)
{
$join = $elementModel->getJoin();
$joinTable = $join->table_join_alias; $opts = array();

if (!strstr($c, 'CONCAT'))
{
$opts['label'] = strstr($c, '.') ? $c : $joinTable . '.' . $c;
}
else
{
$opts['label'] = $c;
}
$opts = array();
$opts['label'] = $c;

return parent::cacheAutoCompleteOptions($elementModel, $search, $opts);
}

// $$$ hugh - added 'autocomplete_how', currently just "starts_with" or "contains"
// default to "contains" for backward compat.

if ($params->get('dbjoin_autocomplete_how', 'contains') == 'contains')
{
$elementModel->_autocomplete_where = $c . ' LIKE ' . $db->quote('%' . $search . '%');
Expand Down

2 comments on commit 45df772

@jpsoigne
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a ";" missing in line 2919 !

@cheesegrits
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that got fixed real fast. I fixed it locally within seconds, just forgot to push the commit that fixed it for a day or so.

Please sign in to comment.