Merge branch 'develop'

This commit is contained in:
Björn Fromme
2021-06-08 17:44:48 +02:00
4 changed files with 14 additions and 7 deletions
@@ -71,7 +71,7 @@ class AjaxCalendarController extends ActionController
$eventsRangeBegin = $range->getBegin()->sub(new \DateInterval('P1D'));
$eventsRangeEnd = $range->getEnd()->add(new \DateInterval('P1D'));
$eventsRange = new Range($eventsRangeBegin, $eventsRangeEnd);
$events = $factory->getEvents($eventsRange, [ 'hotel' => $hotel ]);
$events = $factory->getEvents($eventsRange, [ 'hotel' => $hotel, 'hotelCode' => $hotel->getCode() ]);
$yearStart = $factory->getYear($range->getBegin()->format('Y'));
$yearEnd = null;
@@ -43,6 +43,11 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
const ROOMCODE_STATUS = 'BelKal';
/**
* @var string[]
*/
protected $ignoredRoomTypes = ['PDGS', 'TEAM'];
/**
* @var ConfigurationManagerInterface
*/
@@ -240,6 +245,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
}
$roomType = $roomTypes[$roomTypeBusProId];
$roomCode = $roomType['code'];
if (in_array($roomCode, $this->ignoredRoomTypes, true)) {
continue;
}
$availablePax = 0;
$capacity = 0;
if ($roomType['ctrl'] === true) {
@@ -254,9 +262,6 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
$availableRooms = (int) $xmlRoom['frei'] > 0 ? (int) $xmlRoom['frei'] : 0;
$availablePax = $availableRooms * $roomType['pax'];
}
if ($availablePax === 0 && $roomType['ctrl'] === false) {
//continue;
}
$minPrice = (int) $xmlRoom['abpreis'];
$minNights = (int) $xmlRoom['abpreis_naechte'];
$additionalNightMinPrice = (int) $xmlRoom['abpreis_verlaengerung'];
@@ -211,6 +211,7 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
*/
protected function addItem(array $item, $status, $apiKey, $houseNumber): void
{
$this->logger->info(sprintf('Adding status %d in %s-%s for %s', $status, $item['from']->format('Y-m-d'), $item['to']->format('Y-m-d'), $houseNumber));
$url = sprintf(
'http://www.groups.swiss/api/1.0/json.php?apiKey=%s&method=setAvailabilityChart&house=%d&from=%s&till=%s&state=%d',
$apiKey,
@@ -221,8 +222,7 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
);
try {
$foo = 1;
// $this->httpClient->request('GET', $url);
$this->httpClient->request('GET', $url);
} catch (TransportExceptionInterface $e) {
$this->logger->error(sprintf('A problem occured: %s', $e->getMessage()));
}
@@ -30,7 +30,9 @@ class ImportTimestampService
$updatedTimestampPath = GeneralUtility::getFileAbsFileName($uploadTimestampFile);
if (!$updatedTimestampPath || !file_exists($updatedTimestampPath)) {
return false;
$this->writeImportTimestamp($importTimestampFile);
return true;
}
$line = trim(file($updatedTimestampPath)[0]);