From 86fa1df9f9e57763c2a37b2030730c602fb3d8d7 Mon Sep 17 00:00:00 2001 From: Sergey Ivashchenko <sivashchenko@ebay.com> Date: Sun, 15 Mar 2015 12:08:30 +0200 Subject: [PATCH] MAGETWO-34363: Pull request processing --- .../Adminhtml/Edit/Tab/View/PersonalInfo.php | 17 +++++++++-------- app/code/Magento/Customer/Model/Visitor.php | 4 +--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php index ebd42414697..dfd4fcce3fd 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php @@ -348,15 +348,17 @@ class PersonalInfo extends \Magento\Backend\Block\Template */ public function getCurrentStatus() { + $lastLoginTime = $this->getCustomerLog()->getLastLoginAt(); + // Customer has never been logged in. - if (!$this->getCustomerLog()->getLastLoginAt()) { + if (!$lastLoginTime) { return __('Offline'); } + $lastLogoutTime = $this->getCustomerLog()->getLastLogoutAt(); + // Customer clicked 'Log Out' link\button. - if ($this->getCustomerLog()->getLastLogoutAt() && - strtotime($this->getCustomerLog()->getLastLogoutAt()) > strtotime($this->getCustomerLog()->getLastLoginAt()) - ) { + if ($lastLogoutTime && strtotime($lastLogoutTime) > strtotime($lastLoginTime)) { return __('Offline'); } @@ -365,8 +367,7 @@ class PersonalInfo extends \Magento\Backend\Block\Template $currentTimestamp = (new \DateTime())->getTimestamp(); $lastVisitTime = $this->getCustomerLog()->getLastVisitAt(); - if ($lastVisitTime && $currentTimestamp - strtotime($lastVisitTime) > $interval * 60 - ) { + if ($lastVisitTime && $currentTimestamp - strtotime($lastVisitTime) > $interval * 60) { return __('Offline'); } @@ -383,7 +384,7 @@ class PersonalInfo extends \Magento\Backend\Block\Template $date = $this->getCustomerLog()->getLastLoginAt(); if ($date) { - return $this->formatDate($date, TimezoneInterface::FORMAT_TYPE_MEDIUM, true); + return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); } return __('Never'); @@ -400,7 +401,7 @@ class PersonalInfo extends \Magento\Backend\Block\Template if ($date) { $date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true); - return $this->formatDate($date, TimezoneInterface::FORMAT_TYPE_MEDIUM, true); + return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); } return __('Never'); diff --git a/app/code/Magento/Customer/Model/Visitor.php b/app/code/Magento/Customer/Model/Visitor.php index ea1f8bc4a1b..132fd35acc9 100644 --- a/app/code/Magento/Customer/Model/Visitor.php +++ b/app/code/Magento/Customer/Model/Visitor.php @@ -138,9 +138,7 @@ class Visitor extends \Magento\Framework\Model\AbstractModel $this->setData($this->session->getVisitorData()); } - $this->setLastVisitAt( - (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT) - ); + $this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)); if (!$this->getId()) { $this->setSessionId($this->session->getSessionId()); -- GitLab