Fix contingent import using wrong hotel code
This commit is contained in:
@@ -167,21 +167,28 @@ class ContingentImportService implements SingletonInterface
|
|||||||
protected function parseContingent(\SimpleXMLElement $xmlContingent)
|
protected function parseContingent(\SimpleXMLElement $xmlContingent)
|
||||||
{
|
{
|
||||||
$hotelCode = (string) $xmlContingent['code'];
|
$hotelCode = (string) $xmlContingent['code'];
|
||||||
$sql = 'SELECT uid, code, groupsch_id FROM tx_epproducts_domain_model_hotel WHERE deleted = 0 AND hidden = 0 AND code = :code';
|
$sql = 'SELECT h.uid uid, h.groupsch_id groupsch_id
|
||||||
|
FROM tx_epproducts_domain_model_hotel h
|
||||||
|
LEFT JOIN tx_epproducts_domain_model_matchcode m ON (h.uid = m.entity AND m.entity_type = "hotel")
|
||||||
|
WHERE h.deleted = 0 AND h.hidden = 0 AND h.code = :code OR m.code = :code
|
||||||
|
LIMIT 0,1';
|
||||||
$hotelData = $this->db->fetchAssoc($sql, ['code' => $hotelCode]);
|
$hotelData = $this->db->fetchAssoc($sql, ['code' => $hotelCode]);
|
||||||
|
|
||||||
// Skip import in case hotel can't be found
|
// Skip import in case hotel can't be found
|
||||||
if ($hotelData === false) {
|
if ($hotelData === false) {
|
||||||
$this->logger->warning('hotel not found', ['code' => $hotelCode]);
|
$this->logger->warning('hotel not found', ['code' => $hotelCode]);
|
||||||
return 0;
|
return 0;
|
||||||
} elseif (empty($xmlContingent->kapazitaeten)) {
|
}
|
||||||
|
|
||||||
|
if ($xmlContingent->kapazitaeten === null) {
|
||||||
$this->logger->warning('hotel has no contingents', ['code' => $hotelCode]);
|
$this->logger->warning('hotel has no contingents', ['code' => $hotelCode]);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
$hotelData['busProId'] = (string) $xmlContingent['idbuspro'];
|
|
||||||
$roomTypes = $this->parseRoomTypes($xmlContingent->unterbringungen);
|
|
||||||
return $this->parseRooms($xmlContingent->kapazitaeten, $hotelData, $roomTypes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hotelData['busProId'] = (string) $xmlContingent['idbuspro'];
|
||||||
|
$hotelData['code'] = $hotelCode;
|
||||||
|
$roomTypes = $this->parseRoomTypes($xmlContingent->unterbringungen);
|
||||||
|
return $this->parseRooms($xmlContingent->kapazitaeten, $hotelData, $roomTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user