diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 9203b96..d56d370 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -49,10 +49,10 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity } /** - * @param string $end + * @param \DateTime $end * @return void */ - public function setEnd($end) + public function setEnd(\DateTime $end) { $this->end = $end; } diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index 7440753..0061396 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -86,7 +86,8 @@ class DateRepository extends \TYPO3\CMS\Extbase\Persistence\Repository ] ); } else { - $constraints['untilnow'] = $query->greaterThanOrEqual('start', date("Y-m-d H:i:s")); + $now = new \DateTime('now', new \DateTimeZone('Europe/Berlin')); + $constraints['untilnow'] = $query->greaterThanOrEqual('start', $now); } if ($demand->getLimit() !== '') { diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 8d8f7dd..1fd0b2b 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -346,15 +346,15 @@ class DestinationDataImportService { $this->dateRepository->remove($currentDate); } - $now = new \DateTime(); - $now = $now->getTimestamp(); + $today = new \DateTime('today'); + $today = $today->getTimestamp(); foreach ($timeIntervals as $date) { // Check if dates are given as interval or not if (empty($date['interval'])) { - if (strtotime($date['start']) > $now) { + if (strtotime($date['start']) > $today) { $this->logger->info('Setup single date'); $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); @@ -369,13 +369,14 @@ class DestinationDataImportService { } else { if ($date['freq'] == 'Daily' && empty($date['weekdays'])) { + $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 > $now) { + if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); $eventStart->setTime($start->format('H'), $start->format('i')); @@ -388,6 +389,7 @@ class DestinationDataImportService { $this->tmpCurrentEvent->addDate($dateObj); } } + } else if ($date['freq'] == 'Weekly' && !empty($date['weekdays'])) { @@ -397,9 +399,8 @@ class DestinationDataImportService { $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 > $now) { + if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); $eventStart->setTime($start->format('H'), $start->format('i')); @@ -415,8 +416,8 @@ class DestinationDataImportService { } } } - $this->logger->info('Finished setup dates'); } + $this->logger->info('Finished setup dates'); } /** diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 41e3ea9..b29fa4f 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -120,7 +120,7 @@ return [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.start', 'config' => [ - 'dbType' => 'datetime', + //'dbType' => 'datetime', 'type' => 'input', 'renderType' => 'inputDateTime', 'size' => 12, @@ -132,7 +132,7 @@ return [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.end', 'config' => [ - 'dbType' => 'datetime', + //'dbType' => 'datetime', 'type' => 'input', 'renderType' => 'inputDateTime', 'size' => 12, @@ -141,14 +141,6 @@ return [ ], ], - /* - 'event' => [ - 'config' => [ - 'type' => 'passthrough', - ], - ], - */ - 'event' => array( 'exclude' => 1, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.event', diff --git a/ext_tables.sql b/ext_tables.sql index dfa2b6e..06729ef 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -3,32 +3,32 @@ # CREATE TABLE tx_events_domain_model_event ( - title varchar(255) DEFAULT '' NOT NULL, - global_id varchar(255) DEFAULT '' NOT NULL, - slug varchar(255) DEFAULT '' NOT NULL, - highlight smallint(5) unsigned DEFAULT '0' NOT NULL, - teaser text, - details text, - price_info text, - street varchar(255) DEFAULT '' NOT NULL, - district varchar(255) DEFAULT '' NOT NULL, - city varchar(255) DEFAULT '' NOT NULL, - zip varchar(255) DEFAULT '' NOT NULL, - country varchar(255) DEFAULT '' NOT NULL, - web varchar(255) DEFAULT '' NOT NULL, - booking varchar(255) DEFAULT '' NOT NULL, - ticket varchar(255) DEFAULT '' NOT NULL, - facebook varchar(255) DEFAULT '' NOT NULL, - youtube varchar(255) DEFAULT '' NOT NULL, - latitude varchar(255) DEFAULT '' NOT NULL, - longitude varchar(255) DEFAULT '' NOT NULL, - images int(11) unsigned NOT NULL default '0', - categories int(11) DEFAULT '0' NOT NULL, - dates int(11) unsigned DEFAULT '0' NOT NULL, - organizer int(11) unsigned DEFAULT '0', - region int(11) unsigned DEFAULT '0', + title varchar(255) DEFAULT '' NOT NULL, + global_id varchar(255) DEFAULT '' NOT NULL, + slug varchar(255) DEFAULT '' NOT NULL, + highlight smallint(5) unsigned DEFAULT '0' NOT NULL, + teaser text, + details text, + price_info text, + street varchar(255) DEFAULT '' NOT NULL, + district varchar(255) DEFAULT '' NOT NULL, + city varchar(255) DEFAULT '' NOT NULL, + zip varchar(255) DEFAULT '' NOT NULL, + country varchar(255) DEFAULT '' NOT NULL, + web varchar(255) DEFAULT '' NOT NULL, + booking varchar(255) DEFAULT '' NOT NULL, + ticket varchar(255) DEFAULT '' NOT NULL, + facebook varchar(255) DEFAULT '' NOT NULL, + youtube varchar(255) DEFAULT '' NOT NULL, + latitude varchar(255) DEFAULT '' NOT NULL, + longitude varchar(255) DEFAULT '' NOT NULL, + images int(11) unsigned NOT NULL default '0', + categories int(11) DEFAULT '0' NOT NULL, + dates int(11) unsigned DEFAULT '0' NOT NULL, + organizer int(11) unsigned DEFAULT '0', + region int(11) unsigned DEFAULT '0', - KEY dataHandler (l10n_parent, t3ver_oid, deleted, t3ver_wsid, t3ver_state) + KEY dataHandler (l10n_parent, t3ver_oid, deleted, t3ver_wsid, t3ver_state) ); # @@ -36,30 +36,27 @@ CREATE TABLE tx_events_domain_model_event ( # CREATE TABLE tx_events_domain_model_organizer ( - name varchar(255) DEFAULT '' NOT NULL, - street varchar(255) DEFAULT '' NOT NULL, - district varchar(255) DEFAULT '' NOT NULL, - city varchar(255) DEFAULT '' NOT NULL, - zip varchar(255) DEFAULT '' NOT NULL, - phone varchar(255) DEFAULT '' NOT NULL, - web varchar(255) DEFAULT '' NOT NULL, - email varchar(255) DEFAULT '' NOT NULL, + name varchar(255) DEFAULT '' NOT NULL, + street varchar(255) DEFAULT '' NOT NULL, + district varchar(255) DEFAULT '' NOT NULL, + city varchar(255) DEFAULT '' NOT NULL, + zip varchar(255) DEFAULT '' NOT NULL, + phone varchar(255) DEFAULT '' NOT NULL, + web varchar(255) DEFAULT '' NOT NULL, + email varchar(255) DEFAULT '' NOT NULL, - KEY dataHandler (l10n_parent, sys_language_uid, deleted) + KEY dataHandler (l10n_parent, sys_language_uid, deleted) ); # # Table structure for table 'tx_events_domain_model_date' # CREATE TABLE tx_events_domain_model_date ( - - event int(11) unsigned DEFAULT '0' NOT NULL, - - start datetime DEFAULT NULL, - end datetime DEFAULT NULL, - - KEY event (event), - KEY dataHandler (event, t3ver_wsid, pid) + event int(11) unsigned DEFAULT '0' NOT NULL, + start int(11) DEFAULT NULL, + end int(11) DEFAULT NULL, + KEY event (event), + KEY dataHandler (event, t3ver_wsid, pid) ); # @@ -67,7 +64,7 @@ CREATE TABLE tx_events_domain_model_date ( # CREATE TABLE tx_events_domain_model_region ( - title varchar(255) DEFAULT '' NOT NULL, + title varchar(255) DEFAULT '' NOT NULL, ); @@ -76,6 +73,6 @@ CREATE TABLE tx_events_domain_model_region ( # CREATE TABLE tx_events_domain_model_date ( - event int(11) unsigned DEFAULT '0' NOT NULL, + event int(11) unsigned DEFAULT '0' NOT NULL, );