Skip to content

Commit

Permalink
[com_banners] - publishing time does not honor timezone (#11978)
Browse files Browse the repository at this point in the history
* [com_banners ] -  publishing time does not honor timezone

* impress only when needed

impress only when needed

* CS fix

cs fix
  • Loading branch information
alikon authored and rdeutz committed Sep 16, 2016
1 parent 7fc63d2 commit c5102ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions components/com_banners/models/banners.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ protected function getListQuery()
$keywords = $this->getState('filter.keywords');
$randomise = ($ordering == 'random');
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());

$query->select(
'a.id as id,'
Expand All @@ -80,8 +81,8 @@ protected function getListQuery()
->from('#__banners as a')
->join('LEFT', '#__banner_clients AS cl ON cl.id = a.cid')
->where('a.state=1')
->where('(' . $query->currentTimestamp() . ' >= a.publish_up OR a.publish_up = ' . $nullDate . ')')
->where('(' . $query->currentTimestamp() . ' <= a.publish_down OR a.publish_down = ' . $nullDate . ')')
->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')')
->where('(a.imptotal = 0 OR a.impmade <= a.imptotal)');

if ($cid)
Expand Down
6 changes: 5 additions & 1 deletion modules/mod_banners/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public static function &getList(&$params)
$model->setState('filter.language', $app->getLanguageFilter());

$banners = $model->getItems();
$model->impress();

if ($banners)
{
$model->impress();
}

return $banners;
}
Expand Down

0 comments on commit c5102ea

Please sign in to comment.