From b5d89ce7c4248ad801cd16a94cfb6fe7e019f443 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 16 Mar 2020 12:10:01 +0100 Subject: [PATCH] Make untilDate to requirement --- Classes/Service/DestinationDataImportService.php | 6 ++++-- Configuration/TypoScript/constants.typoscript | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index b0c81c9..7bae77a 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -372,13 +372,14 @@ class DestinationDataImportService { } else { - if ($date['freq'] == 'Daily' && empty($date['weekdays'])) { + if ($date['freq'] == 'Daily' && empty($date['weekdays']) && !empty($date['repeatUntil'])) { $this->logger->info('Setup daily interval dates'); $this->logger->info('Start ' . $date['start']); $this->logger->info('End ' . $date['repeatUntil']); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); + for($i = strtotime($start->format('l'), $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 day', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); @@ -396,13 +397,14 @@ class DestinationDataImportService { } - else if ($date['freq'] == 'Weekly' && !empty($date['weekdays'])) { + else if ($date['freq'] == 'Weekly' && !empty($date['weekdays']) && !empty($date['repeatUntil'])) { foreach ($date['weekdays'] as $day) { $this->logger->info('Setup weekly interval dates for ' . $day); $this->logger->info('Start ' . $date['start']); $this->logger->info('End ' . $date['repeatUntil']); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); + for($i = strtotime($day, $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 week', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 2e94d1c..5ab60de 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -23,7 +23,7 @@ plugin.tx_events { # cat=plugin.tx_events//a; type=string; label=Data Type restType = Event # cat=plugin.tx_events//a; type=string; label=Data Limit - restLimit = 200 + restLimit = 500 # cat=plugin.tx_events//a; type=string; label=Mode restMode = next_months,12 # cat=plugin.tx_events//a; type=string; label=Data Template