mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-06-04 07:20:49 +00:00
Update publish_up and publish_down query after null date change
This commit is contained in:
parent
c1f3652257
commit
2b960d4bed
|
@ -13,7 +13,6 @@ defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\CMS\Categories\Categories;
|
use Joomla\CMS\Categories\Categories;
|
||||||
use Joomla\CMS\Categories\CategoryNode;
|
use Joomla\CMS\Categories\CategoryNode;
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Helper\TagsHelper;
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
use Joomla\CMS\Language\Multilanguage;
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
@ -185,14 +184,13 @@ class CategoryModel extends ListModel
|
||||||
// Filter by start and end dates.
|
// Filter by start and end dates.
|
||||||
if ($this->getState('filter.publish_date'))
|
if ($this->getState('filter.publish_date'))
|
||||||
{
|
{
|
||||||
$nullDate = $db->getNullDate();
|
$nowDate = Factory::getDate()->toSql();
|
||||||
$nowDate = Factory::getDate()->toSql();
|
$query->where('(' . $db->quoteName('a.publish_up')
|
||||||
$query->where('(a.publish_up = :publishUpNullDate OR a.publish_up <= :publishUpNowDate)')
|
. ' IS NULL OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)')
|
||||||
->where('(a.publish_down = :publishDownNullDate OR a.publish_down >= :publishDownNowDate)')
|
->where('(' . $db->quoteName('a.publish_down')
|
||||||
->bind(':publishUpNullDate', $nullDate)
|
. ' IS NULL OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)')
|
||||||
->bind(':publishDownNullDate', $nullDate)
|
->bind(':publish_up', $nowDate)
|
||||||
->bind(':publishUpNowDate', $nowDate)
|
->bind(':publish_down', $nowDate);
|
||||||
->bind(':publishDownNowDate', $nowDate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by language
|
// Filter by language
|
||||||
|
|
|
@ -124,15 +124,13 @@ class WeblinkModel extends ItemModel
|
||||||
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
||||||
{
|
{
|
||||||
// Filter by start and end dates.
|
// Filter by start and end dates.
|
||||||
$nullDate = $db->getNullDate();
|
|
||||||
$nowDate = Factory::getDate()->toSql();
|
$nowDate = Factory::getDate()->toSql();
|
||||||
|
$query->where('(' . $db->quoteName('a.publish_up')
|
||||||
$query->where('(a.publish_up = :publishUpNullDate OR a.publish_up <= :publishUpNowDate)')
|
. ' IS NULL OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)')
|
||||||
->where('(a.publish_down = :publishDownNullDate OR a.publish_down >= :publishDownNowDate)')
|
->where('(' . $db->quoteName('a.publish_down')
|
||||||
->bind(':publishUpNullDate', $nullDate)
|
. ' IS NULL OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)')
|
||||||
->bind(':publishDownNullDate', $nullDate)
|
->bind(':publish_up', $nowDate)
|
||||||
->bind(':publishUpNowDate', $nowDate)
|
->bind(':publish_down', $nowDate);
|
||||||
->bind(':publishDownNowDate', $nowDate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by published state.
|
// Filter by published state.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user