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, Product $product,
Hotel $hotel, Hotel $hotel,
string $dateFrom = null, string $dateFrom = null,
string $dateTo = null string $dateTo = null,
string $bpnBookingUrlTemplateCode = null
): void { ): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids); $filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -156,6 +157,7 @@ class AjaxTableController extends ActionController
'date' => $date['dateUid'], 'date' => $date['dateUid'],
'paCode' => $paCode, 'paCode' => $paCode,
'singleDate' => true, 'singleDate' => true,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
] ]
); );
} }
@@ -211,6 +213,7 @@ class AjaxTableController extends ActionController
'hasDiscount' => $hasSurchargeOrDiscount['discount'], 'hasDiscount' => $hasSurchargeOrDiscount['discount'],
'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept, 'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept,
'nonBookableInfo' => $nonBookableInfo, 'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode,
]); ]);
} }
@@ -227,7 +230,7 @@ class AjaxTableController extends ActionController
Hotel $hotel, Hotel $hotel,
Date $date, Date $date,
bool $singleDate = false, bool $singleDate = false,
string $bookingUrlTemplateCode = 'base' string $bpnBookingUrlTemplateCode = null
): void { ): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids); $filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -237,7 +240,7 @@ class AjaxTableController extends ActionController
'hotel' => $hotel, 'hotel' => $hotel,
'filterSettings' => $filterSettings, 'filterSettings' => $filterSettings,
'date' => $date, 'date' => $date,
'template' => $bookingUrlTemplateCode, 'template' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => GeneralUtility::_GET('pa'), 'paCode' => GeneralUtility::_GET('pa'),
]); ]);
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($priceTable); $hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($priceTable);
@@ -264,14 +267,16 @@ class AjaxTableController extends ActionController
'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept, 'isProductWithNoInfoConcept' => $isProductWithNoInfoConcept,
'isSingleDate' => $singleDate, 'isSingleDate' => $singleDate,
'nonBookableInfo' => $nonBookableInfo, 'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
]); ]);
} }
/** /**
* @param Product $product * @param Product $product
* @param Hotel $hotel * @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()) { if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode']; $paCode = $reseller['paCode'];
@@ -291,12 +296,14 @@ class AjaxTableController extends ActionController
$this->view->assign('pricetable', $pricetable); $this->view->assign('pricetable', $pricetable);
$this->view->assign('nonBookableInfo', $nonBookableInfo); $this->view->assign('nonBookableInfo', $nonBookableInfo);
$this->view->assign('bpnBookingUrlTemplateCode', $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode']);
} }
/** /**
* @param Product $product * @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']); $roomTypes = GeneralUtility::trimExplode(',', $this->settings['priceTableRoomTypes']);
$roomTypesPax = array_map(function ($type) { $roomTypesPax = array_map(function ($type) {
@@ -326,6 +333,7 @@ class AjaxTableController extends ActionController
'categories' => $categories, 'categories' => $categories,
'themekey' => $this->settings['themekey'], 'themekey' => $this->settings['themekey'],
'nonBookableInfo' => $nonBookableInfo, 'nonBookableInfo' => $nonBookableInfo,
'bpnBookingUrlTemplateCode' => $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode'],
]); ]);
} }
@@ -334,9 +342,15 @@ class AjaxTableController extends ActionController
* @param Product $product * @param Product $product
* @param string $dateFrom * @param string $dateFrom
* @param string $dateTo * @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); $period = new Period($dateFrom, $dateTo);
$nights = (int)$period->dateInterval()->format('%a') + 1; $nights = (int)$period->dateInterval()->format('%a') + 1;
@@ -351,6 +365,7 @@ class AjaxTableController extends ActionController
$this->view->assign('nights', $nights); $this->view->assign('nights', $nights);
$this->view->assign('rooms', $rooms); $this->view->assign('rooms', $rooms);
$this->view->assign('bpnBookingUrlTemplateCode', $bpnBookingUrlTemplateCode ?? $this->settings['bpnBookingUrlTemplateCode']);
} }
/** /**
@@ -54,7 +54,13 @@
<button type="button" <button type="button"
class="text-left text-ep-primary-light ser:text-ser-primary text-sm md:text-base" class="text-left text-ep-primary-light ser:text-ser-primary text-sm md:text-base"
data-action="product-details#loadPrices" 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} {row.dateStart} - {row.dateEnd}
</button> </button>
</f:then> </f:then>
@@ -14,7 +14,7 @@
<f:else> <f:else>
data-controller="product-details" data-controller="product-details"
data-action="tabs:selected->product-details#switchView" 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')}" data-product-details-disable-tables-value="{f:if(condition: hotel.groupsPriceConfigs, then: 'true', else: 'false')}"
</f:else> </f:else>
</f:if> </f:if>