From 3f55a189eb79f665a8f2a34436f679ecca1ee054 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 17 Aug 2020 14:21:03 +0200 Subject: [PATCH] Add location name --- Classes/Domain/Model/Event.php | 24 +++++++++++++++++++ .../Service/DestinationDataImportService.php | 8 ++++--- .../TCA/tx_events_domain_model_event.php | 13 ++++++++-- Resources/Private/Language/locallang.xlf | 3 +++ ext_tables.sql | 1 + 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 09ae89a..d5271ef 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -63,6 +63,13 @@ class Event extends AbstractEntity */ protected $priceInfo = ''; + /** + * name + * + * @var string + */ + protected $name = ''; + /** * street * @@ -289,6 +296,23 @@ class Event extends AbstractEntity $this->priceInfo = $priceInfo; } + /** + * @return string $name + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + /** * @return string $street */ diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 2e2daa6..d7deb94 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -271,8 +271,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['name'] && $event['street'] && $event['city'] && $event['zip'] && $event['country']) + $this->setAddress($event['name'], $event['street'], $event['city'], $event['zip'], $event['country']); // Set LatLng if($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) @@ -456,12 +456,14 @@ class DestinationDataImportService { } /** + * @param string $name * @param string $street * @param string $city * @param string $zip * @param string $country */ - protected function setAddress(String $street, String $city, String $zip, String $country) { + protected function setAddress(String $name, String $street, String $city, String $zip, String $country) { + $this->tmpCurrentEvent->setName($name); $this->tmpCurrentEvent->setStreet($street); $this->tmpCurrentEvent->setCity($city); $this->tmpCurrentEvent->setZip($zip); diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 4ee748d..58c3c2f 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, name, street, district, city, zip, country, 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, name, 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'], ], 'columns' => [ 'sys_language_uid' => [ @@ -212,6 +212,15 @@ return [ 'eval' => 'trim' ] ], + 'name' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.name', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], 'street' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.street', diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 5b73fd5..7ff4e30 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -27,6 +27,9 @@ Price Info + + Name + Street diff --git a/ext_tables.sql b/ext_tables.sql index dfa2b6e..3fc8842 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -10,6 +10,7 @@ CREATE TABLE tx_events_domain_model_event ( teaser text, details text, price_info text, + name varchar(255) DEFAULT '' NOT NULL, street varchar(255) DEFAULT '' NOT NULL, district varchar(255) DEFAULT '' NOT NULL, city varchar(255) DEFAULT '' NOT NULL,