Skip to content

Commit

Permalink
check for publish state in autosuggester query, as the finder-content
Browse files Browse the repository at this point in the history
plugin seems not to change the state of the finder item after changing
the article state
  • Loading branch information
tkempf committed Aug 25, 2015
1 parent 7adc050 commit 346ace7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions components/com_finder/models/suggestions.php
Expand Up @@ -97,19 +97,18 @@ protected function getListQuery()
}
}
$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('l.access IN (' . $groups . ')')
->where('l.state = 1')
->where('l.published = 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));

$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 . ')');

$query->where('(l.publish_start_date = ' . $nullDate . ' OR l.publish_start_date <= ' . $nowDate . ')')
->where('(l.publish_end_date = ' . $nullDate . ' OR 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)')
Expand Down

0 comments on commit 346ace7

Please sign in to comment.