From 93545bd17137b38b1e1bac27bb7ce043faf6c473 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 16 Mar 2020 13:52:58 +0100 Subject: [PATCH] Change address import --- Classes/Domain/Model/Event.php | 23 +++++++++ .../Service/DestinationDataImportService.php | 27 ++++++---- .../TCA/tx_events_domain_model_event.php | 13 ++++- Resources/Private/Language/locallang.xlf | 5 +- Resources/Private/Language/locallang_db.xlf | 5 +- Resources/Private/Templates/Date/Show.html | 50 +++++++++++++++---- ext_tables.sql | 1 + 7 files changed, 100 insertions(+), 24 deletions(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 09ae89a..74a6d37 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -98,6 +98,13 @@ class Event extends AbstractEntity */ protected $country = ''; + /** + * web + * + * @var string + */ + protected $phone = ''; + /** * web * @@ -357,6 +364,22 @@ class Event extends AbstractEntity $this->zip = $zip; } + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @param string $phone + */ + public function setPhone($phone) + { + $this->phone = $phone; + } + /** * @return string $web */ diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 7bae77a..587cd12 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -275,8 +275,8 @@ class DestinationDataImportService { $this->setTexts($event['texts']); // Set address and geo data - if($event['street'] && $event['city'] && $event['zip'] && $event['country']) - $this->setAddress($event['street'], $event['city'], $event['zip'], $event['country']); + if($event['street'] || $event['city'] || $event['zip'] || $event['country']) + $this->setAddress($event); // Set LatLng if($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) @@ -454,16 +454,21 @@ class DestinationDataImportService { } /** - * @param string $street - * @param string $city - * @param string $zip - * @param string $country + * @param array $event */ - protected function setAddress(String $street, String $city, String $zip, String $country) { - $this->tmpCurrentEvent->setStreet($street); - $this->tmpCurrentEvent->setCity($city); - $this->tmpCurrentEvent->setZip($zip); - $this->tmpCurrentEvent->setCountry($country); + protected function setAddress(Array $event) { + if (!empty($event['street'])) + $this->tmpCurrentEvent->setStreet($event['street']); + if (!empty($event['city'])) + $this->tmpCurrentEvent->setCity($event['city']); + if (!empty($event['zip'])) + $this->tmpCurrentEvent->setZip($event['zip']); + if (!empty($event['country'])) + $this->tmpCurrentEvent->setCountry($event['country']); + if (!empty($event['phone'])) + $this->tmpCurrentEvent->setPhone($event['phone']); + if (!empty($event['web'])) + $this->tmpCurrentEvent->setWeb($event['web']); } /** diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 4ee748d..6a9f2a6 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -20,10 +20,10 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' ], 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, street, district, city, zip, country, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region', + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, street, district, city, zip, country, phone, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region', ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, street, district, city, zip, country, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, street, district, city, zip, country, phone, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -257,6 +257,15 @@ return [ 'eval' => 'trim' ], ], + 'phone' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.phone', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], 'web' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.web', diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 5b73fd5..9e0b592 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -45,6 +45,9 @@ Web + + Phone + Booking @@ -122,4 +125,4 @@ - \ No newline at end of file + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 0570651..93c2827 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -51,6 +51,9 @@ Web + + Phone + Booking @@ -137,4 +140,4 @@ - \ No newline at end of file + diff --git a/Resources/Private/Templates/Date/Show.html b/Resources/Private/Templates/Date/Show.html index bb388da..de2ab64 100644 --- a/Resources/Private/Templates/Date/Show.html +++ b/Resources/Private/Templates/Date/Show.html @@ -23,16 +23,48 @@ {date.event.details}

{event.price_info}

-
-
-

Veranstaltungsort:
- {date.event.street}
- {date.event.zip} {date.event.city}
-

-
-
+ + +
+
+
+
+

Preis:
+ + + {date.event.priceInfo} + + + Keine Information + + +

+ + +

Weitere Informationen:
+ Website +

+
+
+
+

Veranstaltungsort:
+ {date.event.street}
+ {date.event.zip} {date.event.city}
+ {date.event.phone}
+

+
+
+

Veranstalter:
+ {date.event.organizer.name}
+ {date.event.organizer.street}
+ {date.event.organizer.zip} {date.event.organizer.city}
+ {date.event.organizer.phone}
+ Website +

+
+
- \ No newline at end of file + diff --git a/ext_tables.sql b/ext_tables.sql index 06729ef..dd89810 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -16,6 +16,7 @@ CREATE TABLE tx_events_domain_model_event ( zip varchar(255) DEFAULT '' NOT NULL, country varchar(255) DEFAULT '' NOT NULL, web varchar(255) DEFAULT '' NOT NULL, + phone varchar(255) DEFAULT '' NOT NULL, booking varchar(255) DEFAULT '' NOT NULL, ticket varchar(255) DEFAULT '' NOT NULL, facebook varchar(255) DEFAULT '' NOT NULL,