Skip to content

Commit c229dc0

Browse files
author
Ébano Penha Andrello Lopes
committed
4.3.2: Fix installation date restriction
Zend dates where been used on customer locale, casing error on dates
1 parent 67b5e9e commit c229dc0

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

  • www/magento/app/code/community/Signifyd/Connect/Helper

www/magento/app/code/community/Signifyd/Connect/Helper/Data.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,35 @@ public function isIgnored(Mage_Sales_Model_Order $order)
8383
return false;
8484
}
8585

86-
$installationDate = new Zend_Date($installationDateConfig);
87-
$createdAtDate = new Zend_Date($order->getCreatedAt());
86+
$installationDate = $this->getTime($installationDateConfig);
87+
$createdAtDate = $this->getTime($order->getCreatedAt());
88+
89+
if ($createdAtDate < $installationDate) {
90+
$this->log('Installation date: ' . $installationDate);
91+
$this->log('Created at date: ' . $createdAtDate);
8892

89-
if ($createdAtDate->isEarlier($installationDate)) {
9093
return true;
9194
} else {
9295
return false;
9396
}
9497
}
9598

99+
public function getTime($dateTime)
100+
{
101+
$dateTime = explode(' ', $dateTime);
102+
103+
if (count($dateTime) == 2) {
104+
$date = explode('-', $dateTime[0]);
105+
$time = explode(':', $dateTime[1]);
106+
107+
if (count($date) == 3 && count($time) == 3) {
108+
return mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]);
109+
}
110+
}
111+
112+
return false;
113+
}
114+
96115
public function log($message)
97116
{
98117
Mage::helper('signifyd_connect/log')->addLog($message);

0 commit comments

Comments
 (0)