From 99bfdc8e4e70b97f5fb054456946b592496c5472 Mon Sep 17 00:00:00 2001 From: Alexander Kellner Date: Thu, 13 Jun 2024 17:03:20 +0200 Subject: [PATCH] [BUGFIX] Use latest pagevisit or latest log entry to get time of latest visit Backport of commit 1b73c50435fc9b1abfd76bde80dc7fd1d0d21b25 Related: https://projekte.in2code.de/issues/64460 --- Classes/Domain/Model/Visitor.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Visitor.php b/Classes/Domain/Model/Visitor.php index cd2b90af..843a2cc1 100644 --- a/Classes/Domain/Model/Visitor.php +++ b/Classes/Domain/Model/Visitor.php @@ -1046,10 +1046,20 @@ public function getTstamp(): DateTime public function getDateOfLastVisit(): ?DateTime { $log = $this->getLatestLog(); + $pagevisit = $this->getLastPagevisit(); + + $date = null; + if ($pagevisit !== null) { + $date = $pagevisit->getCrdate(); + } if ($log !== null) { - return $log->getCrdate(); + $date = $log->getCrdate(); + if ($pagevisit !== null && $pagevisit->getCrdate() > $log->getCrdate()) { + $date = $pagevisit->getCrdate(); + } } - return null; + + return $date; } /**