Merge branch 'release/2021.06-02'

This commit is contained in:
Björn Fromme
2021-06-26 15:22:02 +02:00
4 changed files with 64 additions and 71 deletions
Generated
+36 -35
View File
@@ -1296,28 +1296,29 @@
}, },
{ {
"name": "kigkonsult/icalcreator", "name": "kigkonsult/icalcreator",
"version": "v2.30.5", "version": "v2.39",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/iCalcreator/iCalcreator.git", "url": "https://github.com/iCalcreator/iCalcreator.git",
"reference": "e98cf1d28df690ac1029fe10db0d8dabe0d4ff5b" "reference": "f6bde4e517ac508db6b78d003de71894fde5e718"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/iCalcreator/iCalcreator/zipball/e98cf1d28df690ac1029fe10db0d8dabe0d4ff5b", "url": "https://api.github.com/repos/iCalcreator/iCalcreator/zipball/f6bde4e517ac508db6b78d003de71894fde5e718",
"reference": "e98cf1d28df690ac1029fe10db0d8dabe0d4ff5b", "reference": "f6bde4e517ac508db6b78d003de71894fde5e718",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-openssl": "*", "ext-openssl": "*",
"ext-simplexml": "*", "ext-simplexml": "*",
"ext-zlib": "*", "ext-zlib": "*",
"php": ">=5.6" "php": ">=7.0"
}, },
"require-dev": { "require-dev": {
"phpcompatibility/php-compatibility": "9.3.5", "phpcompatibility/php-compatibility": ">=9.3.5",
"phpunit/phpunit": "6.5.13", "phpstan/phpstan": ">=0.9.3",
"squizlabs/php_codesniffer": "3.5.5" "phpunit/phpunit": ">=6.5.13",
"squizlabs/php_codesniffer": ">=3.5.5"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -1334,7 +1335,7 @@
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"lgpl-3.0" "LGPL-3.0-or-later"
], ],
"authors": [ "authors": [
{ {
@@ -1365,7 +1366,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/iCalcreator/iCalcreator/issues", "issues": "https://github.com/iCalcreator/iCalcreator/issues",
"source": "https://github.com/iCalcreator/iCalcreator/tree/v2.30.5" "source": "https://github.com/iCalcreator/iCalcreator/tree/v2.39"
}, },
"funding": [ "funding": [
{ {
@@ -1373,7 +1374,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2021-05-12T15:50:20+00:00" "time": "2021-06-21T10:09:46+00:00"
}, },
{ {
"name": "league/csv", "name": "league/csv",
@@ -2280,16 +2281,16 @@
}, },
{ {
"name": "symfony/asset", "name": "symfony/asset",
"version": "v5.3.0", "version": "v5.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/asset.git", "url": "https://github.com/symfony/asset.git",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637" "reference": "29a4d5e6e39ffe16cea394fd5041d7a638bd580d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/asset/zipball/4c8d354b8931788f2b07953cfe6846e5cda27637", "url": "https://api.github.com/repos/symfony/asset/zipball/29a4d5e6e39ffe16cea394fd5041d7a638bd580d",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637", "reference": "29a4d5e6e39ffe16cea394fd5041d7a638bd580d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2333,7 +2334,7 @@
"description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/asset/tree/v5.3.0" "source": "https://github.com/symfony/asset/tree/v5.3.2"
}, },
"funding": [ "funding": [
{ {
@@ -2349,7 +2350,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-26T17:43:10+00:00" "time": "2021-06-06T08:05:27+00:00"
}, },
{ {
"name": "symfony/cache", "name": "symfony/cache",
@@ -2966,16 +2967,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v5.3.1", "version": "v5.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "8827b90cf8806e467124ad476acd15216c2fceb6" "reference": "7b6dd714d95106b831aaa7f3c9c612ab886516bd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/8827b90cf8806e467124ad476acd15216c2fceb6", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/7b6dd714d95106b831aaa7f3c9c612ab886516bd",
"reference": "8827b90cf8806e467124ad476acd15216c2fceb6", "reference": "7b6dd714d95106b831aaa7f3c9c612ab886516bd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3019,7 +3020,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.3.1" "source": "https://github.com/symfony/http-foundation/tree/v5.3.2"
}, },
"funding": [ "funding": [
{ {
@@ -3035,7 +3036,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-06-02T09:32:00+00:00" "time": "2021-06-12T10:15:17+00:00"
}, },
{ {
"name": "symfony/inflector", "name": "symfony/inflector",
@@ -4313,16 +4314,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.3.0", "version": "v5.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b" "reference": "0732e97e41c0a590f77e231afc16a327375d50b0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", "url": "https://api.github.com/repos/symfony/string/zipball/0732e97e41c0a590f77e231afc16a327375d50b0",
"reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", "reference": "0732e97e41c0a590f77e231afc16a327375d50b0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -4376,7 +4377,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.3.0" "source": "https://github.com/symfony/string/tree/v5.3.2"
}, },
"funding": [ "funding": [
{ {
@@ -4392,20 +4393,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-26T17:43:10+00:00" "time": "2021-06-06T09:51:56+00:00"
}, },
{ {
"name": "symfony/var-exporter", "name": "symfony/var-exporter",
"version": "v5.3.0", "version": "v5.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-exporter.git", "url": "https://github.com/symfony/var-exporter.git",
"reference": "7a7c9dd972541f78e7815c03c0bae9f81e0e9dbb" "reference": "df663fb63bdcd7298373cbd431165ab031706cb2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/7a7c9dd972541f78e7815c03c0bae9f81e0e9dbb", "url": "https://api.github.com/repos/symfony/var-exporter/zipball/df663fb63bdcd7298373cbd431165ab031706cb2",
"reference": "7a7c9dd972541f78e7815c03c0bae9f81e0e9dbb", "reference": "df663fb63bdcd7298373cbd431165ab031706cb2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -4449,7 +4450,7 @@
"serialize" "serialize"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-exporter/tree/v5.3.0" "source": "https://github.com/symfony/var-exporter/tree/v5.3.2"
}, },
"funding": [ "funding": [
{ {
@@ -4465,7 +4466,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-26T17:40:38+00:00" "time": "2021-06-09T10:57:10+00:00"
}, },
{ {
"name": "symfony/web-link", "name": "symfony/web-link",
@@ -58,12 +58,12 @@ class GroupsSwissCommand extends Command
$this->addArgument( $this->addArgument(
'hotel', 'hotel',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'E&P hotel code' 'E&P hotel uid'
); );
$this->addArgument( $this->addArgument(
'house', 'house',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'House number' 'Groups.swiss house number'
); );
$this->addArgument( $this->addArgument(
'key', 'key',
@@ -74,11 +74,11 @@ class GroupsSwissCommand extends Command
public function execute(InputInterface $input, OutputInterface $output) public function execute(InputInterface $input, OutputInterface $output)
{ {
$hotelCode = $input->getArgument('hotel'); $hotelUid = $input->getArgument('hotel');
$houseNumber = $input->getArgument('house'); $houseNumber = $input->getArgument('house');
$apiKey = $input->getArgument('key'); $apiKey = $input->getArgument('key');
$success = $this->groupsSwissService->publishContingents($hotelCode, $houseNumber, $apiKey); $success = $this->groupsSwissService->publishContingents($hotelUid, $houseNumber, $apiKey);
return $success ? 1 : 0; return $success ? 1 : 0;
} }
@@ -27,7 +27,9 @@ namespace EP\EpProducts\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use CalendR\Event\EventInterface;
use CalendR\Event\Provider\ProviderInterface; use CalendR\Event\Provider\ProviderInterface;
use Doctrine\DBAL\DBALException;
use EP\EpProducts\Domain\Model\Contingent; use EP\EpProducts\Domain\Model\Contingent;
use EP\EpProducts\Domain\Model\Hotel; use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Model\Product; use EP\EpProducts\Domain\Model\Product;
@@ -37,23 +39,22 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
{ {
/** /**
* @param \DateTime $dateFrom * @param \DateTime $begin
* @param \DateTime $dateTo * @param \DateTime|null $end
* @param array $options * @param array $options
* @return \CalendR\Event\EventInterface[] * @return EventInterface[]
* @throws \Doctrine\DBAL\DBALException * @throws DBALException
*/ */
public function getEvents(\DateTime $dateFrom, \DateTime $dateTo = null, array $options = []) public function getEvents(\DateTime $begin, \DateTime $end = null, array $options = []): array
{ {
$optionsResolver = new OptionsResolver(); $optionsResolver = new OptionsResolver();
$optionsResolver->setRequired(['hotelCode']); $optionsResolver->setRequired(['hotel']);
$optionsResolver->setDefined(['hotel']);
$optionsResolver->setDefaults(['hotel' => null]);
$optionsResolver->setAllowedTypes('hotel', Hotel::class); $optionsResolver->setAllowedTypes('hotel', Hotel::class);
$resolvedOptions = $optionsResolver->resolve($options); $resolvedOptions = $optionsResolver->resolve($options);
/** @var Hotel $hotel */
$hotel = $resolvedOptions['hotel']; $hotel = $resolvedOptions['hotel'];
$hotelCode = $resolvedOptions['hotelCode']; $hotelCode = $hotel->getCode();
$qb = $this->getDbConnection()->createQueryBuilder(); $qb = $this->getDbConnection()->createQueryBuilder();
@@ -63,14 +64,14 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
->where('hotel_code = :hotelCode') ->where('hotel_code = :hotelCode')
->andWhere('date >= :dateFrom') ->andWhere('date >= :dateFrom')
->setParameter('hotelCode', $hotelCode) ->setParameter('hotelCode', $hotelCode)
->setParameter('dateFrom', $dateFrom->format('Y-m-d')) ->setParameter('dateFrom', $begin->format('Y-m-d'))
->orderBy('date') ->orderBy('date')
; ;
if (null !== $dateTo) { if (null !== $end) {
$qb $qb
->andWhere('date <= :dateTo') ->andWhere('date <= :dateTo')
->setParameter('dateTo', $dateTo->format('Y-m-d')) ->setParameter('dateTo', $end->format('Y-m-d'))
; ;
} }
@@ -101,9 +102,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
foreach ($dates as $row) foreach ($dates as $row)
{ {
if ($hotel) { $row['hotel'] = $hotel;
$row['hotel'] = $hotel;
}
$events[] = Contingent::fromArray($row); $events[] = Contingent::fromArray($row);
} }
@@ -114,7 +113,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
* @param Hotel $hotel * @param Hotel $hotel
* @param Product $product * @param Product $product
* @return array * @return array
* @throws \Doctrine\DBAL\DBALException * @throws DBALException
*/ */
public function getAvailableContingents(Hotel $hotel, Product $product) public function getAvailableContingents(Hotel $hotel, Product $product)
{ {
@@ -147,7 +146,7 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
* @param Hotel $hotel * @param Hotel $hotel
* @param Product $product * @param Product $product
* @return array * @return array
* @throws \Doctrine\DBAL\DBALException * @throws DBALException
*/ */
public function getAvailableRooms(\DateTime $dateFrom, \DateTime $dateTo, Hotel $hotel, Product $product) public function getAvailableRooms(\DateTime $dateFrom, \DateTime $dateTo, Hotel $hotel, Product $product)
{ {
@@ -37,8 +37,6 @@ use Psr\Log\LoggerAwareTrait;
use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Configuration\Exception;
class GroupsSwissService implements SingletonInterface, LoggerAwareInterface class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
{ {
@@ -62,26 +60,22 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
/** /**
* @param HotelRepository $hotelRepository * @param HotelRepository $hotelRepository
* @param ContingentRepository $contingentRepository * @param ContingentRepository $contingentRepository
* @param ConfigurationManagerInterface $configurationManager
*/ */
public function __construct( public function __construct(HotelRepository $hotelRepository, ContingentRepository $contingentRepository)
HotelRepository $hotelRepository, {
ContingentRepository $contingentRepository,
ConfigurationManagerInterface $configurationManager
) {
$this->hotelRepository = $hotelRepository; $this->hotelRepository = $hotelRepository;
$this->contingentRepository = $contingentRepository; $this->contingentRepository = $contingentRepository;
$this->httpClient = HttpClient::create(); $this->httpClient = HttpClient::create();
} }
public function publishContingents(string $hotelCode, int $houseNumber, string $apiKey): bool public function publishContingents(int $hotelUid, int $houseNumber, string $apiKey): bool
{ {
$range = Period::after(new \DateTime('now'), '1 year'); $range = Period::after(new \DateTime('now'), '1 year');
$result = $this->hotelRepository->findByCode($hotelCode); $result = $this->hotelRepository->findByIdentifier($hotelUid);
if (null === $result) { if (null === $result) {
$this->logger->error(sprintf('Hotel with code %s not found', $hotelCode)); $this->logger->error(sprintf('Hotel with uid %d not found', $hotelUid));
return false; return false;
} }
@@ -92,11 +86,12 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
$events = $this->contingentRepository->getEvents( $events = $this->contingentRepository->getEvents(
\DateTime::createFromImmutable($range->getStartDate()), \DateTime::createFromImmutable($range->getStartDate()),
\DateTime::createFromImmutable($range->getEndDate()), \DateTime::createFromImmutable($range->getEndDate()),
['hotel' => $hotel, 'hotelCode' => $hotelCode] ['hotel' => $hotel]
); );
} }
catch (DBALException $e) { catch (DBALException $e) {
$events = []; $this->logger->error(sprintf('No dates found for hotel with uid %d', $hotelUid));
return false;
} }
$this->resetChart($range, $apiKey, $houseNumber); $this->resetChart($range, $apiKey, $houseNumber);
@@ -134,7 +129,6 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
*/ */
protected function generateChart(array $events, $apiKey, $houseNumber): void protected function generateChart(array $events, $apiKey, $houseNumber): void
{ {
$itemCount = 0;
$item = null; $item = null;
$status = null; $status = null;
@@ -151,7 +145,6 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
$statusCode = Contingent::STATUS_ONREQUEST === $status ? 1 : 2; $statusCode = Contingent::STATUS_ONREQUEST === $status ? 1 : 2;
$this->addItem($item, $statusCode, $apiKey, $houseNumber); $this->addItem($item, $statusCode, $apiKey, $houseNumber);
$item = null; $item = null;
$itemCount++;
} }
} }
} }