feat: get travel guide from bus pro data

This commit is contained in:
Björn Fromme
2024-12-05 11:31:17 +01:00
parent f473d7df33
commit 0678a99b19
5 changed files with 57 additions and 2 deletions
@@ -169,6 +169,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $new = false;
/**
* @var string
*/
protected $guide = '';
public function getProduct()
{
return $this->product;
@@ -489,8 +494,16 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
public function setCoursesIncluded($coursesIncluded)
{
$this->coursesIncluded = $coursesIncluded;
}
return $this;
public function getGuide()
{
return unserialize($this->guide);
}
public function setGuide($guide): Date
{
$this->guide = serialize($guide);
}
/**
@@ -491,6 +491,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
});
$date['pickups'] = serialize($pickups);
$guide = $this->parseGuide($xmlDate);
$date['guide'] = serialize($guide);
return $date;
}
@@ -544,6 +547,27 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
return true;
}
protected function parseGuide(\SimpleXMLElement $xmlDate)
{
$transportationServicesBus = $xmlDate->xpath('lei_befoerderung/leistung[@unterart="BUS"]');
foreach ($transportationServicesBus as $service) {
if ('RUECK' === (string) $service->richtung) {
continue;
}
if (false === isset($service->zustiegsplanung->reiseleiter)) {
continue;
}
return [
'name' => (string) $service->zustiegsplanung->reiseleiter->name,
'phone' => (string) $service->zustiegsplanung->reiseleiter->telefon,
];
}
return [];
}
/**
* @param \SimpleXMLElement $xmlHotel
* @param int $hotelUid
@@ -25,7 +25,7 @@ return [
'types' => [
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, daytrip, date_start, date_end, nights, board,
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
services_general, courses_included, pickups, discount, min_price, pseudo_price, available, new'],
services_general, courses_included, guide, pickups, discount, min_price, pseudo_price, available, new'],
],
'palettes' => [
'1' => ['showitem' => ''],
@@ -306,6 +306,16 @@ return [
'eval' => 'trim'
]
],
'guide' => [
'exclude' => false,
'label' => 'Reiseleiter',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim'
]
],
'pickups' => [
'exclude' => false,
'label' => 'Zustiege',
@@ -121,6 +121,7 @@ CREATE TABLE tx_epproducts_domain_model_date
services_general text NOT NULL,
courses_included text NOT NULL,
pickups text NOT NULL,
guide text NOT NULL,
discount int(11) DEFAULT '0' NOT NULL,
min_price int(11) DEFAULT '0' NOT NULL,
pseudo_price int(11) DEFAULT '0' NOT NULL,
@@ -154,6 +154,13 @@
</div>
</div>
<div class="lg:w-3/4 pt-8 lg:pt-0 lg:px-8 text-white" data-rte-content>
<f:if condition="{date.guide}">
<p>
<strong>E&amp;P Reiseleitung</strong>
<br>
{date.guide.name} {date.guide.phone}
</p>
</f:if>
{travelinfo.importantPhoneNumbers -> f:format.html()}
</div>
</div>