Merge branch 'master' into develop
This commit is contained in:
@@ -26,6 +26,7 @@ namespace EP\EpProducts\Service;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* This copyright notice MUST APPEAR in all copies of the script!
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
|
use CalendR\Period\Range;
|
||||||
use Doctrine\DBAL\DBALException;
|
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;
|
||||||
@@ -119,6 +120,8 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
|
|||||||
$events = [];
|
$events = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->resetChart($range, $config['key'], $config['number']);
|
||||||
|
|
||||||
// $this->generateAvailabilityChart(
|
// $this->generateAvailabilityChart(
|
||||||
// $events,
|
// $events,
|
||||||
// $config['key'],
|
// $config['key'],
|
||||||
@@ -172,6 +175,21 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
|
|||||||
$this->logger->info(sprintf('Published %d dates.', $itemCount));
|
$this->logger->info(sprintf('Published %d dates.', $itemCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Period $range
|
||||||
|
* @param string $apiKey
|
||||||
|
* @param string $houseNumber
|
||||||
|
*/
|
||||||
|
protected function resetChart(Period $range, $apiKey, $houseNumber): void
|
||||||
|
{
|
||||||
|
$item = [
|
||||||
|
'from' => $range->getStartDate()->format('Y-m-d'),
|
||||||
|
'to' => $range->getEndDate()->format('Y-m-d'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->addItem($item, 0, $apiKey, $houseNumber);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $events
|
* @param array $events
|
||||||
* @param string $apiKey
|
* @param string $apiKey
|
||||||
@@ -210,10 +228,6 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface
|
|||||||
*/
|
*/
|
||||||
protected function addItem(array $item, $status, $apiKey, $houseNumber): void
|
protected function addItem(array $item, $status, $apiKey, $houseNumber): void
|
||||||
{
|
{
|
||||||
if (0 === $item['occupancy']) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = sprintf(
|
$url = sprintf(
|
||||||
'http://www.groups.swiss/api/1.0/json.php?apiKey=%s&method=setAvailabilityChart&house=%d&from=%s&till=%s&state=%d',
|
'http://www.groups.swiss/api/1.0/json.php?apiKey=%s&method=setAvailabilityChart&house=%d&from=%s&till=%s&state=%d',
|
||||||
$apiKey,
|
$apiKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user