fix: properly assign bpn template code to all templates

This commit is contained in:
Björn Fromme
2024-02-28 15:27:18 +01:00
parent 935c360ee0
commit 95b1157ce3
3 changed files with 30 additions and 9 deletions
@@ -126,7 +126,8 @@ class AjaxTableController extends ActionController
Product $product,
Hotel $hotel,
string $dateFrom = null,
string $dateTo = null
string $dateTo = null,
string $bpnBookingUrlTemplateCode = null
): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -156,6 +157,7 @@ class AjaxTableController extends ActionController
'date' => $date['dateUid'],
'paCode' => $paCode,
'singleDate' => true,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
]
);
}
@@ -211,6 +213,7 @@ class AjaxTableController extends ActionController
'hasDiscount' => $hasSurchargeOrDiscount['discount'],
'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept,
'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode,
]);
}
@@ -227,7 +230,7 @@ class AjaxTableController extends ActionController
Hotel $hotel,
Date $date,
bool $singleDate = false,
string $bookingUrlTemplateCode = 'base'
string $bpnBookingUrlTemplateCode = null
): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -237,7 +240,7 @@ class AjaxTableController extends ActionController
'hotel' => $hotel,
'filterSettings' => $filterSettings,
'date' => $date,
'template' => $bookingUrlTemplateCode,
'template' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => GeneralUtility::_GET('pa'),
]);
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($priceTable);
@@ -264,14 +267,16 @@ class AjaxTableController extends ActionController
'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept,
'isSingleDate' => $singleDate,
'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
]);
}
/**
* @param Product $product
* @param Hotel $hotel
* @param string $bpnBookingUrlTemplateCode
*/
public function pricetableHtmlAction(Product $product, Hotel $hotel): void
public function pricetableHtmlAction(Product $product, Hotel $hotel, string $bpnBookingUrlTemplateCode = null): void
{
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
@@ -291,12 +296,14 @@ class AjaxTableController extends ActionController
$this->view->assign('pricetable', $pricetable);
$this->view->assign('nonBookableInfo', $nonBookableInfo);
$this->view->assign('bpnBookingUrlTemplateCode', $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode']);
}
/**
* @param Product $product
* @param string $bpnBookingUrlTemplateCode
*/
public function eventPricetableAction(Product $product): void
public function eventPricetableAction(Product $product, string $bpnBookingUrlTemplateCode = null): void
{
$roomTypes = GeneralUtility::trimExplode(',', $this->settings['priceTableRoomTypes']);
$roomTypesPax = array_map(function ($type) {
@@ -326,6 +333,7 @@ class AjaxTableController extends ActionController
'categories' => $categories,
'themekey' => $this->settings['themekey'],
'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
]);
}
@@ -334,9 +342,15 @@ class AjaxTableController extends ActionController
* @param Product $product
* @param string $dateFrom
* @param string $dateTo
* @param string $bpnBookingUrlTemplateCode
*/
public function daytripRoomsAction(Hotel $hotel, Product $product, string $dateFrom, string $dateTo): void
{
public function daytripRoomsAction(
Hotel $hotel,
Product $product,
string $dateFrom,
string $dateTo,
string $bpnBookingUrlTemplateCode = null
): void {
$period = new Period($dateFrom, $dateTo);
$nights = (int)$period->dateInterval()->format('%a') + 1;
@@ -351,6 +365,7 @@ class AjaxTableController extends ActionController
$this->view->assign('nights', $nights);
$this->view->assign('rooms', $rooms);
$this->view->assign('bpnBookingUrlTemplateCode', $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode']);
}
/**
@@ -54,7 +54,13 @@
<button type="button"
class="text-left text-ep-primary-light ser:text-ser-primary text-sm md:text-base"
data-action="product-details#loadPrices"
data-product-details-prices-url-param="{ep:uri.ajax(action: 'pricetable', controller: 'AjaxTable', arguments: '{product: product, hotel: hotel, date: row.dateUid}', format: 'html', pageUid: settings.defaultAjaxUid)}">
data-product-details-prices-url-param="{ep:uri.ajax(
action: 'pricetable',
controller: 'AjaxTable',
arguments: '{product: product, hotel: hotel, date: row.dateUid, bookingUrlTemplateCode: bookingUrlTemplateCode}',
format: 'html',
pageUid: settings.defaultAjaxUid
)}">
{row.dateStart} - {row.dateEnd}
</button>
</f:then>
@@ -14,7 +14,7 @@
<f:else>
data-controller="product-details"
data-action="tabs:selected->product-details#switchView"
data-product-details-datestable-uri-value="{ep:uri.ajax(action: 'datestable', controller: 'AjaxTable', arguments: '{product: product, hotel: hotel}', format: 'html', pageUid: settings.defaultAjaxUid)}"
data-product-details-datestable-uri-value="{ep:uri.ajax(action: 'datestable', controller: 'AjaxTable', arguments: '{product: product, hotel: hotel, bpnBookingUrlTemplateCode: settings.bpnBookingUrlTemplateCode}', format: 'html', pageUid: settings.defaultAjaxUid)}"
data-product-details-disable-tables-value="{f:if(condition: hotel.groupsPriceConfigs, then: 'true', else: 'false')}"
</f:else>
</f:if>