Make untilDate to requirement

This commit is contained in:
Dirk 2020-03-16 12:10:01 +01:00
parent aa38792554
commit b5d89ce7c4
2 changed files with 5 additions and 3 deletions

View file

@ -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();

View file

@ -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