Import included services for daytrips
This commit is contained in:
@@ -75,6 +75,7 @@ class AjaxContingentController extends ActionController
|
|||||||
* @param Hotel $hotel
|
* @param Hotel $hotel
|
||||||
* @param Product $product
|
* @param Product $product
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function listAction(Hotel $hotel, Product $product)
|
public function listAction(Hotel $hotel, Product $product)
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,7 @@ class AjaxContingentController extends ActionController
|
|||||||
* @param \DateTime $dateFrom
|
* @param \DateTime $dateFrom
|
||||||
* @param \DateTime $dateTo
|
* @param \DateTime $dateTo
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function roomsAction(Hotel $hotel, Product $product, \DateTime $dateFrom, \DateTime $dateTo)
|
public function roomsAction(Hotel $hotel, Product $product, \DateTime $dateFrom, \DateTime $dateTo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,7 +138,8 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
|
|||||||
|
|
||||||
$qb
|
$qb
|
||||||
->select('c.room_code as code', 'c.room_label as label', 'c.available as available', 'c.min_price as price',
|
->select('c.room_code as code', 'c.room_label as label', 'c.available as available', 'c.min_price as price',
|
||||||
'c.hotel_bus_pro_id as hotelBusProId', 'd.bus_pro_id as busProId')
|
'c.hotel_bus_pro_id as hotelBusProId',
|
||||||
|
'd.bus_pro_id as busProId', 'd.services_included as servicesIncluded')
|
||||||
->from('tx_epproducts_domain_model_contingent', 'c')
|
->from('tx_epproducts_domain_model_contingent', 'c')
|
||||||
->innerJoin('c', 'tx_epproducts_domain_model_daytrip', 'd', 'c.date = d.date AND c.hotel_code = d.hotel_code')
|
->innerJoin('c', 'tx_epproducts_domain_model_daytrip', 'd', 'c.date = d.date AND c.hotel_code = d.hotel_code')
|
||||||
->where('c.hotel = :hotelUid')
|
->where('c.hotel = :hotelUid')
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class ContingentDataService
|
|||||||
* @param Hotel $hotel
|
* @param Hotel $hotel
|
||||||
* @param Product $product
|
* @param Product $product
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function getAvailableRooms(\DateTime $dateFrom, \DateTime $dateTo, Hotel $hotel, Product $product)
|
public function getAvailableRooms(\DateTime $dateFrom, \DateTime $dateTo, Hotel $hotel, Product $product)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -315,6 +315,12 @@ class DateImportService implements SingletonInterface
|
|||||||
{
|
{
|
||||||
static $datesAdded = [];
|
static $datesAdded = [];
|
||||||
|
|
||||||
|
$skiPass = $this->parseSelectionGroup($xmlDate, 'Leistungen Skipass');
|
||||||
|
$servicesBoard = $this->parseSelectionGroup($xmlDate, 'Leistungen Verpflegung');
|
||||||
|
$servicesIncluded = $this->parseSelectionGroup($xmlDate, 'Leistungen Sonstige');
|
||||||
|
|
||||||
|
$servicesCombined = serialize($this->combineServices($skiPass, $servicesBoard, $servicesIncluded));
|
||||||
|
|
||||||
foreach ($xmlDate->hotel as $xmlHotel)
|
foreach ($xmlDate->hotel as $xmlHotel)
|
||||||
{
|
{
|
||||||
$hotelCode = (string) $xmlHotel->attributes()['code'];
|
$hotelCode = (string) $xmlHotel->attributes()['code'];
|
||||||
@@ -335,6 +341,7 @@ class DateImportService implements SingletonInterface
|
|||||||
'hotel' => $hotel['uid'],
|
'hotel' => $hotel['uid'],
|
||||||
'hotel_bus_pro_id' => (int) $xmlHotel->attributes()['idbuspro'],
|
'hotel_bus_pro_id' => (int) $xmlHotel->attributes()['idbuspro'],
|
||||||
'hotel_code' => $hotelCode,
|
'hotel_code' => $hotelCode,
|
||||||
|
'services_included' => $servicesCombined,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -391,17 +398,8 @@ class DateImportService implements SingletonInterface
|
|||||||
$skiPass = $this->parseSelectionGroup($xmlDate, 'Leistungen Skipass');
|
$skiPass = $this->parseSelectionGroup($xmlDate, 'Leistungen Skipass');
|
||||||
$servicesBoard = $this->parseSelectionGroup($xmlDate, 'Leistungen Verpflegung');
|
$servicesBoard = $this->parseSelectionGroup($xmlDate, 'Leistungen Verpflegung');
|
||||||
$servicesIncluded = $this->parseSelectionGroup($xmlDate, 'Leistungen Sonstige');
|
$servicesIncluded = $this->parseSelectionGroup($xmlDate, 'Leistungen Sonstige');
|
||||||
$combinedServices = [];
|
|
||||||
if ($skiPass) {
|
$date['services_included'] = serialize($this->combineServices($skiPass, $servicesBoard, $servicesIncluded));
|
||||||
array_push($combinedServices, ...$skiPass);
|
|
||||||
}
|
|
||||||
if ($servicesBoard) {
|
|
||||||
array_push($combinedServices, ...$servicesBoard);
|
|
||||||
}
|
|
||||||
if ($servicesIncluded) {
|
|
||||||
array_push($combinedServices, ...$servicesIncluded);
|
|
||||||
}
|
|
||||||
$date['services_included'] = serialize($combinedServices);
|
|
||||||
|
|
||||||
if ($servicesBoard) {
|
if ($servicesBoard) {
|
||||||
$date['board'] = reset($servicesBoard);
|
$date['board'] = reset($servicesBoard);
|
||||||
@@ -478,6 +476,28 @@ class DateImportService implements SingletonInterface
|
|||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $skiPass
|
||||||
|
* @param array $servicesBoard
|
||||||
|
* @param array $servicesIncluded
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function combineServices(array $skiPass, array $servicesBoard, array $servicesIncluded)
|
||||||
|
{
|
||||||
|
$combinedServices = [];
|
||||||
|
if ($skiPass) {
|
||||||
|
array_push($combinedServices, ...$skiPass);
|
||||||
|
}
|
||||||
|
if ($servicesBoard) {
|
||||||
|
array_push($combinedServices, ...$servicesBoard);
|
||||||
|
}
|
||||||
|
if ($servicesIncluded) {
|
||||||
|
array_push($combinedServices, ...$servicesIncluded);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $combinedServices;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \SimpleXMLElement $xmlHotel
|
* @param \SimpleXMLElement $xmlHotel
|
||||||
* @param array $date
|
* @param array $date
|
||||||
|
|||||||
@@ -1000,6 +1000,7 @@ CREATE TABLE tx_epproducts_domain_model_daytrip (
|
|||||||
hotel int(11) unsigned DEFAULT '0',
|
hotel int(11) unsigned DEFAULT '0',
|
||||||
hotel_bus_pro_id varchar(64) DEFAULT '' NOT NULL,
|
hotel_bus_pro_id varchar(64) DEFAULT '' NOT NULL,
|
||||||
hotel_code varchar(64) DEFAULT '' NOT NULL,
|
hotel_code varchar(64) DEFAULT '' NOT NULL,
|
||||||
|
services_included TEXT NOT NULL,
|
||||||
|
|
||||||
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
|
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
|
||||||
crdate int(11) unsigned DEFAULT '0' NOT NULL,
|
crdate int(11) unsigned DEFAULT '0' NOT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user