Compare commits

...
5 Commits
7 changed files with 39 additions and 40 deletions

No files matched your search

-9
View File
@@ -285,9 +285,6 @@ AddDefaultCharset utf-8
<FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
<FilesMatch "\.(png|gif|jpe?g)$">
Header append Vary Accept
</FilesMatch>
</IfModule>
### End: Cross Origin ###
@@ -395,12 +392,6 @@ AddDefaultCharset utf-8
# NOTE: Add your additional local storages here
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(png|gif|jpe?g)$
RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]
### Begin: StaticFileCache (preparation) ####
# Document root configuration
@@ -73,6 +73,13 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
const SELECTION_CUSTOMER_GROUP = 1418;
const SELECTION_CUSTOMER_END = 1419;
/**
* Fallback for dates the office has not tagged with either selection: these
* trip type markers in front of the travel code's trailing date mean
* end-customer travel.
*/
const END_CUSTOMER_CODE_PATTERN = '/(?:MP|WE|KT|PM|MW|FA)\d{6}$/';
/**
* 'Leistungen Personal' occurs in no export so far, so its id is unknown and
* it is still matched by label. Register its id once the warning fires.
@@ -422,8 +429,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
$skiPassIncluded = (int) (count($includedSkiPass) > 0);
$date['skipass_included'] = $skiPassIncluded;
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$date['group_travel'] = (int) isset($customer[static::SELECTION_CUSTOMER_GROUP]);
$date['group_travel'] = (int) $this->isGroupTravel($row);
$servicesTransportation = $this->parseService($row['transportServices']);
$discount = $this->determineDiscount($servicesTransportation);
@@ -787,8 +793,27 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
}
/**
* A date without 'Gruppenkunde' imports as end-customer travel, which is
* only right when BusPro says 'Endkunde'.
* 'Gruppenkunde' and 'Endkunde' decide. A date carrying neither is judged by
* its travel code.
*
* @param array $row
* @return bool
*/
protected function isGroupTravel(array $row): bool
{
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
$isEnd = isset($customer[static::SELECTION_CUSTOMER_END]);
if ($isGroup || $isEnd) {
return $isGroup;
}
return !preg_match(static::END_CUSTOMER_CODE_PATTERN, (string) $row['date']['code']);
}
/**
* Reports dates whose customer selection is missing or contradictory, along
* with what they import as.
*
* @param array $row
*/
@@ -804,7 +829,8 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
$this->logger->warning(
$isGroup
? 'date has both Gruppenkunde and Endkunde selected, importing as group travel'
: 'date has neither Gruppenkunde nor Endkunde selected, importing as end-customer travel',
: 'date has neither Gruppenkunde nor Endkunde selected, falling back to travel code, importing as '
. ($this->isGroupTravel($row) ? 'group travel' : 'end-customer travel'),
['product' => $row['product']['code'], 'date' => $row['date']['code']]
);
}
@@ -5,7 +5,6 @@ namespace EP\EpProducts\Service;
use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\DateRepository;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
/**
* Lists the pickup points of a product's latest upcoming end-customer date that
@@ -17,11 +16,6 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
*
* The returned shape is meant to be served by MyE&P later on, so that only the
* data source has to change once the local date table goes away.
*
* Switched by pickupsOverviewEnabled in the extension configuration. A missing
* key means off: a key added to ext_conf_template.txt is absent until the
* extension configuration is saved in the backend, and the overview must not
* go live before it is approved.
*/
class PickupOverviewService
{
@@ -30,16 +24,9 @@ class PickupOverviewService
*/
private $dateRepository;
/**
* @var bool
*/
private $enabled;
public function __construct(DateRepository $dateRepository, ExtensionConfiguration $extensionConfiguration)
public function __construct(DateRepository $dateRepository)
{
$this->dateRepository = $dateRepository;
$configuration = (array) $extensionConfiguration->get('ep_products');
$this->enabled = (bool) ($configuration['pickupsOverviewEnabled'] ?? false);
}
/**
@@ -48,7 +35,7 @@ class PickupOverviewService
public function getOverview(Product $product, ?Hotel $hotel): array
{
$overview = ['pickups' => []];
if (!$this->enabled || $hotel === null || $product->isDaytrip()) {
if ($hotel === null || $product->isDaytrip()) {
return $overview;
}
@@ -1,9 +1,6 @@
# cat=General; type=int; label=Searchresult PID
searchPageUid = 0
# cat=General; type=boolean; label=Show the bus pickups table on product detail pages
pickupsOverviewEnabled = 0
# cat=MyEp; type=string; label=MyE&P URL
myEpUrl = https://my.ep-reisen.de
@@ -2,7 +2,7 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<div class="odd:bg-zinc-50 p-4" data-rte-content>
<div class="group odd:bg-zinc-50 p-4" data-rte-content>
<f:if condition="{journey.byBus}">
<h3>
Busanreise
@@ -11,6 +11,9 @@
{journey.byBus -> f:format.html()}
</div>
</f:if>
<f:if condition="{pickupsOverview.pickups}">
<f:render partial="Product/Pickups" arguments="{pickupsOverview: pickupsOverview}"/>
</f:if>
<f:if condition="{journey.byCar}">
<h3>
Eigenanreise
@@ -2,7 +2,7 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<div class="group odd:bg-zinc-50 p-4" data-rte-content>
<div class="pb-8">
<h3>
Bus-Zustiege
</h3>
@@ -162,12 +162,7 @@
<div class="mb-4 hidden"
data-tabs-target="tab"
data-tab="journey">
<f:if condition="{product.journey}">
<f:render partial="Journey/Details" arguments="{journey: product.journey, bars: 1}"/>
</f:if>
<f:if condition="{pickupsOverview.pickups}">
<f:render partial="Product/Pickups" arguments="{pickupsOverview: pickupsOverview}"/>
</f:if>
<f:render partial="Journey/Details" arguments="{journey: product.journey, pickupsOverview: pickupsOverview, bars: 1}"/>
</div>
</f:if>
</f:section>