Merge branch 'pickups'
This commit is contained in:
@@ -108,6 +108,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||||||
*/
|
*/
|
||||||
protected $servicesGeneral = '';
|
protected $servicesGeneral = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $pickups = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
@@ -368,6 +373,22 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||||||
$this->servicesGeneral = serialize($servicesGeneral);
|
$this->servicesGeneral = serialize($servicesGeneral);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPickups()
|
||||||
|
{
|
||||||
|
return unserialize($this->pickups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $pickups
|
||||||
|
*/
|
||||||
|
public function setPickups(array $pickups)
|
||||||
|
{
|
||||||
|
$this->pickups = serialize($pickups);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ class ProductRepository extends AbstractRepository
|
|||||||
'date.min_price dateMinPrice', 'date.discount dateDiscount', 'date.bus_price busPrice',
|
'date.min_price dateMinPrice', 'date.discount dateDiscount', 'date.bus_price busPrice',
|
||||||
'date.nights dateNights', 'date.bus_included dateBusIncluded', 'date.services_included dateServicesIncluded',
|
'date.nights dateNights', 'date.bus_included dateBusIncluded', 'date.services_included dateServicesIncluded',
|
||||||
'date.services_general dateServicesGeneral', 'date.skipass_included dateSkipassIncluded',
|
'date.services_general dateServicesGeneral', 'date.skipass_included dateSkipassIncluded',
|
||||||
'date.bus_pro_id dateBusProId', 'date.hotel_bus_pro_id hotelBusProId',
|
'date.bus_pro_id dateBusProId', 'date.hotel_bus_pro_id hotelBusProId', 'date.pickups pickups',
|
||||||
'room.uid as roomUid', 'room.bus_pro_id roomBusProId', 'room.name roomName',
|
'room.uid as roomUid', 'room.bus_pro_id roomBusProId', 'room.name roomName',
|
||||||
'room.price roomPrice', 'date.discount roomDiscount', 'date.bus_price busPrice',
|
'room.price roomPrice', 'date.discount roomDiscount', 'date.bus_price busPrice',
|
||||||
'room.services roomOptionalServices', 'room.nights roomNights', 'room.available roomAvailable'
|
'room.services roomOptionalServices', 'room.nights roomNights', 'room.available roomAvailable'
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ class Date
|
|||||||
*/
|
*/
|
||||||
public $rooms = [];
|
public $rooms = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $pickups = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@@ -100,6 +105,11 @@ class Date
|
|||||||
$date->services['service'][] = Service::fromArray($row);
|
$date->services['service'][] = Service::fromArray($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (unserialize($array['pickups']) as $row)
|
||||||
|
{
|
||||||
|
$date->pickups['pickup'][] = Pickup::fromArray($row);
|
||||||
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
namespace EP\EpProducts\Domain\Serialization;
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
*
|
||||||
|
* Copyright notice
|
||||||
|
*
|
||||||
|
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||||
|
*
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
* free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The GNU General Public License can be found at
|
||||||
|
* http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
*
|
||||||
|
* This script is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* This copyright notice MUST APPEAR in all copies of the script!
|
||||||
|
***************************************************************/
|
||||||
|
|
||||||
|
class Pickup
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $street;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $array
|
||||||
|
* @return Pickup
|
||||||
|
*/
|
||||||
|
public static function fromArray(array $array)
|
||||||
|
{
|
||||||
|
$pickup = new self;
|
||||||
|
|
||||||
|
$pickup->city = $array['city'];
|
||||||
|
$pickup->street = $array['street'];
|
||||||
|
$pickup->time = $array['time'];
|
||||||
|
$pickup->price = $array['price'];
|
||||||
|
|
||||||
|
return $pickup;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -66,6 +66,11 @@ class ImportService implements SingletonInterface
|
|||||||
*/
|
*/
|
||||||
protected $hotelMappings = [];
|
protected $hotelMappings = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $pickups = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Connection
|
* @var Connection
|
||||||
*/
|
*/
|
||||||
@@ -111,6 +116,7 @@ class ImportService implements SingletonInterface
|
|||||||
$this->logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
|
$this->logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
|
||||||
$this->getRoomMappings();
|
$this->getRoomMappings();
|
||||||
$this->getHotelMappings();
|
$this->getHotelMappings();
|
||||||
|
$this->importPickups();
|
||||||
$this->createTempTables();
|
$this->createTempTables();
|
||||||
$this->logger->info('starting product import');
|
$this->logger->info('starting product import');
|
||||||
$dateCount = $this->parseXmlFilesInFolder($path);
|
$dateCount = $this->parseXmlFilesInFolder($path);
|
||||||
@@ -394,6 +400,23 @@ class ImportService implements SingletonInterface
|
|||||||
}
|
}
|
||||||
$date['services_general'] = serialize($combinedServices);
|
$date['services_general'] = serialize($combinedServices);
|
||||||
|
|
||||||
|
$pickups = [];
|
||||||
|
foreach ($xmlDate->xpath('zustiege/zustieg') as $pickup)
|
||||||
|
{
|
||||||
|
$attributes = $pickup->attributes();
|
||||||
|
$busProId = (int) $attributes['idbuspro'];
|
||||||
|
if ($busProId === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$pickups[] = [
|
||||||
|
'city' => $this->pickups[$busProId]['city'],
|
||||||
|
'street' => $this->pickups[$busProId]['street'],
|
||||||
|
'price' => (float) str_replace(',', '.', (string) $attributes['preis']),
|
||||||
|
'time' => (string) $attributes['zeit'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$date['pickups'] = serialize($pickups);
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,4 +759,20 @@ class ImportService implements SingletonInterface
|
|||||||
$list[$key] = array_merge($list[$key], $section);
|
$list[$key] = array_merge($list[$key], $section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function importPickups()
|
||||||
|
{
|
||||||
|
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport/zustiege.xml');
|
||||||
|
$xmlData = simplexml_load_file($path);
|
||||||
|
|
||||||
|
foreach ($xmlData->zustieg as $entry)
|
||||||
|
{
|
||||||
|
$attributes = $entry->attributes();
|
||||||
|
$idBusPro = (int) $attributes['idbuspro'];
|
||||||
|
$this->pickups[$idBusPro] = [
|
||||||
|
'city' => (string) $entry->ort,
|
||||||
|
'street' => (string) $entry->strasse,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-2
@@ -27,12 +27,13 @@ return [
|
|||||||
'interface' => [
|
'interface' => [
|
||||||
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, bus_pro_id, hotel_bus_pro_id,
|
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, bus_pro_id, hotel_bus_pro_id,
|
||||||
code, date_start, date_end, nights, board, board_code, board_bus_pro_id, bus_included, bus_available,
|
code, date_start, date_end, nights, board, board_code, board_bus_pro_id, bus_included, bus_available,
|
||||||
skipass_included, services_included, services_general, discount, min_price, pseudo_price, available',
|
skipass_included, services_included, services_general, pickups, discount, min_price, pseudo_price,
|
||||||
|
available',
|
||||||
],
|
],
|
||||||
'types' => [
|
'types' => [
|
||||||
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, date_start, date_end, nights, board,
|
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, date_start, date_end, nights, board,
|
||||||
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
|
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
|
||||||
services_general, discount, min_price, pseudo_price, available'],
|
services_general, pickups, discount, min_price, pseudo_price, available'],
|
||||||
],
|
],
|
||||||
'palettes' => [
|
'palettes' => [
|
||||||
'1' => ['showitem' => ''],
|
'1' => ['showitem' => ''],
|
||||||
@@ -255,6 +256,16 @@ return [
|
|||||||
'eval' => 'trim'
|
'eval' => 'trim'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'pickups' => [
|
||||||
|
'exclude' => 0,
|
||||||
|
'label' => 'Zustiege',
|
||||||
|
'config' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'cols' => 40,
|
||||||
|
'rows' => 15,
|
||||||
|
'eval' => 'trim'
|
||||||
|
]
|
||||||
|
],
|
||||||
'discount' => [
|
'discount' => [
|
||||||
'exclude' => 0,
|
'exclude' => 0,
|
||||||
'label' => 'Rabatt',
|
'label' => 'Rabatt',
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ CREATE TABLE tx_epproducts_domain_model_date (
|
|||||||
bus_price int(11) DEFAULT '0' NOT NULL,
|
bus_price int(11) DEFAULT '0' NOT NULL,
|
||||||
services_included text NOT NULL,
|
services_included text NOT NULL,
|
||||||
services_general text NOT NULL,
|
services_general text NOT NULL,
|
||||||
|
pickups text NOT NULL,
|
||||||
discount int(11) DEFAULT '0' NOT NULL,
|
discount int(11) DEFAULT '0' NOT NULL,
|
||||||
min_price int(11) DEFAULT '0' NOT NULL,
|
min_price int(11) DEFAULT '0' NOT NULL,
|
||||||
pseudo_price int(11) DEFAULT '0' NOT NULL,
|
pseudo_price int(11) DEFAULT '0' NOT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user