From 38adaed1e1372f88455d83c26be43f752ed6f95d Mon Sep 17 00:00:00 2001 From: paritshivani <58217306+paritshivani@users.noreply.github.com> Date: Thu, 20 Feb 2020 15:22:28 +0530 Subject: [PATCH] Bug #29 fix: It asks user to accept T&C right now which is created for current date and future time. (#31) * Bug #157863 fix: It asks user to accept T&C right now which is created for current date and future time. * Bug #157863 fix: It asks user to accept T&C right now which is created for current date and future time. --- src/components/com_tc/administrator/models/content.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/com_tc/administrator/models/content.php b/src/components/com_tc/administrator/models/content.php index cc2b6fe..6e79851 100755 --- a/src/components/com_tc/administrator/models/content.php +++ b/src/components/com_tc/administrator/models/content.php @@ -285,8 +285,6 @@ public function checkDuplicateAndLatestVersionTC($tcVersion,$tcClient) */ public function getMatchingTCs($option, $view) { - $today = JHtml::date('now', 'Y-m-d H:i:s', true); - $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('p.tc_id, c.version, c.client'); @@ -294,7 +292,7 @@ public function getMatchingTCs($option, $view) $query->join('LEFT', $db->quoteName('#__tc_content', 'c') . ' ON (' . $db->quoteName('c.tc_id') . ' = ' . $db->quoteName('p.tc_id') . ')'); $query->where($db->quoteName('p.option') . " = " . $db->quote($option)); $query->where($db->quoteName('p.view') . " = " . $db->quote($view)); - $query->where($db->quoteName('c.start_date') . " <= " . $db->quote($today)); + $query->where($db->quoteName('c.start_date') . " <= UTC_TIMESTAMP()"); $query->where($db->quoteName('c.state') . " = " . $db->quote(1)); // Order in ascending, so get latest version of T&C @@ -472,15 +470,13 @@ public function checkUserGroupAccess($tcUserGroup,$isBlacklist) */ public function getGlobalTCIdList() { - $today = JHtml::date('now', 'Y-m-d H:i:s', true); - $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('p.tc_id, c.version, c.client'); $query->from($db->quoteName('#__tc_patterns', 'p')); $query->join('LEFT', $db->quoteName('#__tc_content', 'c') . ' ON (' . $db->quoteName('c.tc_id') . ' = ' . $db->quoteName('p.tc_id') . ')'); $query->where($db->quoteName('c.global') . " = " . $db->quote(1)); - $query->where($db->quoteName('c.start_date') . " <= " . $db->quote($today)); + $query->where($db->quoteName('c.start_date') . " <= UTC_TIMESTAMP()"); $query->where($db->quoteName('c.state') . " = " . $db->quote(1)); // Order in ascending, so get latest version of T&C