Skip to content

Commit

Permalink
Revert field selection including language filtering to current master
Browse files Browse the repository at this point in the history
code
  • Loading branch information
tkempf committed Mar 10, 2015
1 parent 3a70094 commit d853256
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions components/com_finder/models/suggestions.php
Expand Up @@ -75,11 +75,13 @@ protected function getListQuery()

// Select required fields
$query->select('t.term')
->from($db->quoteName('#__finder_terms') . ' AS t')
->where('t.term LIKE ' . $db->quote($db->escape($this->getState('input'), true) . '%'))
->where('t.common = 0')
->order('t.links DESC')
->order('t.weight DESC');
->from($db->quoteName('#__finder_terms') . ' AS t')
->where('t.term LIKE ' . $db->quote($db->escape($this->getState('input'), true) . '%'))
->where('t.common = 0')
->where('t.language IN (' . $db->quote($db->escape($this->getState('language'), true)) . ', ' . $db->quote('*') . ')')
->order('t.links DESC')
->order('t.weight DESC');

$linkjoin='';

// Iterate through each term mapping table and add the join.
Expand All @@ -92,23 +94,23 @@ protected function getListQuery()
$linkjoin.=' or ';
}
$query->join('INNER',$db->quoteName('#__finder_links') . ' AS l ON ('.$linkjoin.')')
->where($db->quoteName('l.access') . ' IN (' . $groups . ')')
->where($db->quoteName('l.state') . ' = 1');
->where($db->quoteName('l.access') . ' IN (' . $groups . ')')
->where($db->quoteName('l.state') . ' = 1');

// Get the null date and the current date, minus seconds.
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(substr_replace(JFactory::getDate()->toSQL(), '00', -2));

// Add the publish up and publish down filters.
$query->where('(' . $db->quoteName('l.publish_start_date') . ' = ' . $nullDate . ' OR ' . $db->quoteName('l.publish_start_date') . ' <= ' . $nowDate . ')')
->where('(' . $db->quoteName('l.publish_end_date') . ' = ' . $nullDate . ' OR ' . $db->quoteName('l.publish_end_date') . ' >= ' . $nowDate . ')');
->where('(' . $db->quoteName('l.publish_end_date') . ' = ' . $nullDate . ' OR ' . $db->quoteName('l.publish_end_date') . ' >= ' . $nowDate . ')');


if (!is_null($request->get('f')))
{
$query->join('INNER',$db->quoteName('#__finder_taxonomy_map') . ' AS tm ON (tm.link_id=l.link_id)')
->join('INNER',$db->quoteName('#__finder_filters') . ' AS ff ON (ff.data=tm.node_id)')
->where($db->quoteName('ff.filter_id') . ' = '.$request->get('f','','int'));
->join('INNER',$db->quoteName('#__finder_filters') . ' AS ff ON (ff.data=tm.node_id)')
->where($db->quoteName('ff.filter_id') . ' = '.$request->get('f','','int'));

}
/*
Expand Down Expand Up @@ -155,10 +157,6 @@ protected function getListQuery()
}
}
*/
// Filter by language
if ($this->getState('filter.language')) {
$query->where('l.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').')');
}
return $query;
}

Expand Down

0 comments on commit d853256

Please sign in to comment.