Skip to content

Commit 86fa1df

Browse files
committed
MAGETWO-34363: Pull request processing
1 parent d0e4448 commit 86fa1df

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,17 @@ public function getStoreLastLoginDateTimezone()
348348
*/
349349
public function getCurrentStatus()
350350
{
351+
$lastLoginTime = $this->getCustomerLog()->getLastLoginAt();
352+
351353
// Customer has never been logged in.
352-
if (!$this->getCustomerLog()->getLastLoginAt()) {
354+
if (!$lastLoginTime) {
353355
return __('Offline');
354356
}
355357

358+
$lastLogoutTime = $this->getCustomerLog()->getLastLogoutAt();
359+
356360
// Customer clicked 'Log Out' link\button.
357-
if ($this->getCustomerLog()->getLastLogoutAt() &&
358-
strtotime($this->getCustomerLog()->getLastLogoutAt()) > strtotime($this->getCustomerLog()->getLastLoginAt())
359-
) {
361+
if ($lastLogoutTime && strtotime($lastLogoutTime) > strtotime($lastLoginTime)) {
360362
return __('Offline');
361363
}
362364

@@ -365,8 +367,7 @@ public function getCurrentStatus()
365367
$currentTimestamp = (new \DateTime())->getTimestamp();
366368
$lastVisitTime = $this->getCustomerLog()->getLastVisitAt();
367369

368-
if ($lastVisitTime && $currentTimestamp - strtotime($lastVisitTime) > $interval * 60
369-
) {
370+
if ($lastVisitTime && $currentTimestamp - strtotime($lastVisitTime) > $interval * 60) {
370371
return __('Offline');
371372
}
372373

@@ -383,7 +384,7 @@ public function getLastLoginDate()
383384
$date = $this->getCustomerLog()->getLastLoginAt();
384385

385386
if ($date) {
386-
return $this->formatDate($date, TimezoneInterface::FORMAT_TYPE_MEDIUM, true);
387+
return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true);
387388
}
388389

389390
return __('Never');
@@ -400,7 +401,7 @@ public function getStoreLastLoginDate()
400401

401402
if ($date) {
402403
$date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true);
403-
return $this->formatDate($date, TimezoneInterface::FORMAT_TYPE_MEDIUM, true);
404+
return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true);
404405
}
405406

406407
return __('Never');

app/code/Magento/Customer/Model/Visitor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ public function initByRequest($observer)
138138
$this->setData($this->session->getVisitorData());
139139
}
140140

141-
$this->setLastVisitAt(
142-
(new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)
143-
);
141+
$this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT));
144142

145143
if (!$this->getId()) {
146144
$this->setSessionId($this->session->getSessionId());

0 commit comments

Comments
 (0)