Compare commits
15
Commits
c7f43ad02c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8be8b5042 | ||
|
|
85b1bd1578 | ||
|
|
f4f0857870 | ||
|
|
2771be2d67 | ||
|
|
11f46d0acf | ||
|
|
4279669aa3 | ||
|
|
aa3d81102e | ||
|
|
739a4c49f7 | ||
|
|
88e0488b49 | ||
|
|
f57671b4d4 | ||
|
|
313fb151bc | ||
|
|
6350742084 | ||
|
|
ef7d81fe99 | ||
|
|
0477589a7a | ||
|
|
38962845d3 |
No files matched your search
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
## Description: Export the TYPO3 sites as static document roots (no PHP)
|
||||
## Usage: static-export [--site <identifier>] [--url <ddev url>] [--no-follow] [--out <dir>] [--workers <n>] [--hybrid --typo3-current <path> [--live-ajax]]
|
||||
## Example: "ddev static-export --site ep-reisen"
|
||||
set -euo pipefail
|
||||
|
||||
exec python3 -I "${DDEV_APPROOT}/.ddev/static-export/export.py" "$@"
|
||||
+10
-13
@@ -1,26 +1,23 @@
|
||||
name: ep-reisen
|
||||
name: ep-reisen-10
|
||||
type: typo3
|
||||
docroot: public
|
||||
php_version: "7.4"
|
||||
webserver_type: nginx-fpm
|
||||
xdebug_enabled: false
|
||||
additional_hostnames:
|
||||
- ep-events
|
||||
- ski-boarderweek
|
||||
- snowzone
|
||||
- unichamp
|
||||
- ski-wochenenden
|
||||
- schnee-event
|
||||
- semesterende
|
||||
- ep-events-10
|
||||
- ski-boarderweek-10
|
||||
- snowzone-10
|
||||
- unichamp-10
|
||||
- ski-wochenenden-10
|
||||
- schnee-event-10
|
||||
- semesterende-10
|
||||
- alvac-10
|
||||
- cllt-10
|
||||
additional_fqdns: []
|
||||
database:
|
||||
type: mariadb
|
||||
version: "11.4"
|
||||
hooks:
|
||||
post-start:
|
||||
- exec: .ddev/claude-code/install.sh
|
||||
- exec: .ddev/codex-cli/install.sh
|
||||
webimage_extra_packages: [ripgrep, bubblewrap, socat]
|
||||
use_dns_when_possible: true
|
||||
timezone: Europe/Berlin
|
||||
composer_version: "2"
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Fetch every exported page of a site live, then check every referenced asset/link on the site, its CDN and ajax files."""
|
||||
import os, re, sys, html, urllib.parse, urllib.request, urllib.error, concurrent.futures, collections
|
||||
root, prod = sys.argv[1], sys.argv[2].rstrip('/')
|
||||
host = urllib.parse.urlsplit(prod).netloc
|
||||
class NoRedir(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(NoRedir)
|
||||
def get(url, body=False):
|
||||
try:
|
||||
with op.open(urllib.request.Request(url, headers={'User-Agent': 'ep-static-check', 'Accept': 'image/webp,*/*'}), timeout=60) as r:
|
||||
return r.status, (r.read().decode('utf-8', 'replace') if body else '')
|
||||
except urllib.error.HTTPError as e: return e.code, ''
|
||||
except Exception as e: return str(e)[:60], ''
|
||||
pages = []
|
||||
for d, _, files in os.walk(root):
|
||||
if '/_ajax' in d: continue
|
||||
for f in files:
|
||||
if f == 'index.html': pages.append('/' + os.path.relpath(d, root).replace('.', '', 1).lstrip('/') + ('/' if d != root else ''))
|
||||
pages = sorted(set(p.replace('//', '/') for p in pages))
|
||||
with concurrent.futures.ThreadPoolExecutor(12) as ex:
|
||||
res = dict(zip(pages, ex.map(lambda p: get(prod + p, True), pages)))
|
||||
refs = set()
|
||||
for p, (st, body) in res.items():
|
||||
for v in re.findall(r'(?:href|src|srcset|hx-get|data-[\w-]+)="([^"]*)"', body):
|
||||
for c in html.unescape(v).split(','):
|
||||
c = c.strip().split(' ')[0]; u = urllib.parse.urlsplit(c)
|
||||
if u.netloc in ('', host, 'cdn.ep-reisen.de') and u.path.startswith('/') and not u.path.startswith('//'):
|
||||
base = 'https://' + (u.netloc or host)
|
||||
refs.add(base + u.path + ('?' + u.query if u.path.startswith('/_ajax/') else ''))
|
||||
with concurrent.futures.ThreadPoolExecutor(16) as ex:
|
||||
rr = dict(zip(sorted(refs), ex.map(lambda u: get(u)[0], sorted(refs))))
|
||||
print('pages: %d → %s' % (len(res), dict(collections.Counter(st for st, _ in res.values()))))
|
||||
by = collections.Counter((urllib.parse.urlsplit(u).netloc, s if s in (200, 404) else ('3xx' if isinstance(s, int) and 300 <= s < 400 else s)) for u, s in rr.items())
|
||||
print('references by host/status:'); [print(' %-26s %-5s %d' % (h, s, n)) for (h, s), n in sorted(by.items(), key=str)]
|
||||
bad = [(s, u) for u, s in rr.items() if not (isinstance(s, int) and (s == 200 or 300 <= s < 400))]
|
||||
for s, u in sorted(bad, key=str)[:20]: print(' FAIL %s %s' % (s, u))
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Request every exported page and every local URL referenced in pages/fragments via a local Apache."""
|
||||
import os, re, sys, html, urllib.parse, urllib.request, urllib.error, concurrent.futures
|
||||
root, host, base = sys.argv[1], sys.argv[2], 'http://127.0.0.1:8099'
|
||||
class NoRedir(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(NoRedir)
|
||||
def get(path):
|
||||
try:
|
||||
with op.open(urllib.request.Request(base + path, headers={'Host': host}), timeout=30) as r: return r.status
|
||||
except urllib.error.HTTPError as e: return e.code
|
||||
except Exception as e: return str(e)
|
||||
pages, refs = [], set()
|
||||
for d, _, files in os.walk(root):
|
||||
for f in files:
|
||||
if not f.endswith('.html'): continue
|
||||
rel = '/' + os.path.relpath(os.path.join(d, f), root)
|
||||
if not rel.startswith('/_ajax/') and rel != '/404.html': pages.append(rel[:-10] if rel.endswith('/index.html') else rel)
|
||||
t = open(os.path.join(d, f), encoding='utf-8').read()
|
||||
for v in re.findall(r'(?:href|src|srcset|hx-get|data-[\w-]+)="([^"]*)"', t):
|
||||
for c in html.unescape(v).split(','):
|
||||
c = c.strip().split(' ')[0]; p = urllib.parse.urlsplit(c)
|
||||
if p.netloc in ('', host, 'cdn.ep-reisen.de') and p.path.startswith('/') and not p.path.startswith('//'):
|
||||
refs.add(p.path + ('?' + p.query if p.path.startswith('/_ajax/') else ''))
|
||||
with concurrent.futures.ThreadPoolExecutor(16) as ex:
|
||||
pr = dict(zip(pages, ex.map(get, pages))); rr = dict(zip(sorted(refs), ex.map(get, sorted(refs))))
|
||||
bad_p = {k: v for k, v in pr.items() if v != 200}
|
||||
bad_r = {k: v for k, v in rr.items() if v not in (200, 301, 302, 303, 307, 308)}
|
||||
print('pages: %d, not 200: %d' % (len(pr), len(bad_p)))
|
||||
print('referenced local URLs: %d (ajax: %d), failing: %d' % (len(rr), sum(1 for k in rr if k.startswith('/_ajax/')), len(bad_r)))
|
||||
for k, v in list(bad_p.items())[:10] + list(bad_r.items())[:25]: print(' %s %s' % (v, k))
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Compare /api/hotel + /api/product of a static export (Apache on 127.0.0.1:8099) with live local TYPO3.
|
||||
|
||||
Usage: compare_api.py <export dir>. Case list: every hotel/product code, sampled pairs, random
|
||||
unlinked pairs, empty/missing params, missing/wrong/query-string key, direct snapshot access.
|
||||
"""
|
||||
import sys, os, random, importlib.util, urllib.request, urllib.error, concurrent.futures
|
||||
spec = importlib.util.spec_from_file_location('export', '/var/www/html/.ddev/static-export/export.py'); m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
|
||||
sites = m.load_sites(); exp = m.Exporter('ep-reisen', sites['ep-reisen'], sites, '/nonexistent', follow=False, workers=1); key = m.cms_api_key()
|
||||
class N(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(N)
|
||||
def call(url, headers):
|
||||
try:
|
||||
with op.open(urllib.request.Request(url, headers=headers), timeout=60) as r: return r.status, r.read().decode(), r.headers.get('Content-Type')
|
||||
except urllib.error.HTTPError as e: return e.code, e.read().decode(), e.headers.get('Content-Type')
|
||||
typo3 = lambda q, h: call('http://127.0.0.1/' + q, dict(h, **{'Host': 'ep-reisen.ddev.site', 'X-Forwarded-Proto': 'https'}))
|
||||
static = lambda q, h: call('http://127.0.0.1:8099/' + q, dict(h, **{'Host': 'www.ep-reisen.de'}))
|
||||
root = sys.argv[1]; K = {'X-Api-Key': key}
|
||||
hotels = sorted(f[:-5] for f in os.listdir(root + '/_api/hotel')); products = sorted(f[:-5] for f in os.listdir(root + '/_api/product') if f.endswith('.json'))
|
||||
pairs = sorted((p, f[:-5]) for p in products if os.path.isdir(root + '/_api/product/' + p) for f in os.listdir(root + '/_api/product/' + p) if not f.startswith('_'))
|
||||
random.seed(1)
|
||||
cases = [('api/hotel?hotel=' + c, K) for c in hotels] + [('api/product?product=' + c, K) for c in products]
|
||||
cases += [('api/product?product=%s&hotel=%s' % pc, K) for pc in random.sample(pairs, 150)]
|
||||
cases += [('api/product?hotel=%s&product=%s' % (h, p), K) for p, h in random.sample(pairs, 10)]
|
||||
cases += [('api/product?product=%s&hotel=%s' % (p, random.choice(hotels)), K) for p in random.sample(products, 60)]
|
||||
cases += [(q, K) for q in ['api/hotel?hotel=_empty', 'api/product?product=_empty', 'api/hotel?hotel=%40empty', 'api/product?product=3VIIN&hotel=@empty', 'api/product?product=3VIIN&hotel=PMVSW%26A', 'api/hotel?hotel=a%20b', 'api/product?product=%40empty&hotel=', 'api/hotel', 'api/product', 'api/hotel?hotel=', 'api/product?product=', 'api/product?product=&hotel=X',
|
||||
'api/hotel?hotel=NOPE', 'api/product?product=NOPE', 'api/product?product=NOPE&hotel=' + hotels[0],
|
||||
'api/product?product=%s&hotel=' % products[0], 'api/product?product=%s&hotel=NOPE' % products[0]]]
|
||||
cases += [('api/hotel?hotel=' + hotels[0], {}), ('api/hotel?hotel=' + hotels[0], {'X-Api-Key': 'wrong'}),
|
||||
('api/hotel?hotel=%s&key=%s' % (hotels[0], key), {}), ('api/product?key=%s&product=%s' % (key, products[0]), {}),
|
||||
('api/product?product=%s&key=wrong' % products[0], {})]
|
||||
def compare(c):
|
||||
q, h = c; a, b = typo3(q, h), static(q, h)
|
||||
return q, (a[0], exp.to_prod(a[1]), a[2]), b
|
||||
bad = []
|
||||
with concurrent.futures.ThreadPoolExecutor(8) as ex:
|
||||
for q, a, b in ex.map(compare, cases):
|
||||
if a != b: bad.append((q, a, b))
|
||||
print('cases: %d, identical: %d, different: %d' % (len(cases), len(cases) - len(bad), len(bad)))
|
||||
for q, a, b in bad[:6]: print(' DIFF', q, '| typo3', a[0], a[2], '| static', b[0], b[2], repr(b[1][:90]))
|
||||
for q in ['_api/hotel/%s.json' % hotels[0], '_api/pair.shtml', '_api/product-part/%s.part' % products[0]]: print(' direct', q, static(q, {})[0])
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Import the same buspro data twice (XML files, MyE&P API) into the local DB and keep each
|
||||
* result as cmp_<source>_<table>. The live tables are backed up first and restored at the end.
|
||||
*/
|
||||
putenv('TYPO3_PATH_ROOT=/var/www/html/public');
|
||||
putenv('TYPO3_PATH_APP=/var/www/html');
|
||||
$classLoader = require '/var/www/html/vendor/autoload.php';
|
||||
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI);
|
||||
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader);
|
||||
|
||||
use EP\EpProducts\Service\ApiImportSource;
|
||||
use EP\EpProducts\Service\DateImportService;
|
||||
use EP\EpProducts\Service\XmlProductReader;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
$db = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionByName('Default');
|
||||
$tables = ['date' => 'tx_epproducts_domain_model_date', 'room' => 'tx_epproducts_domain_model_room', 'product' => 'tx_epproducts_domain_model_product'];
|
||||
|
||||
$snapshot = function (string $prefix) use ($db, $tables) {
|
||||
foreach ($tables as $short => $table) {
|
||||
$db->executeStatement("DROP TABLE IF EXISTS cmp_{$prefix}_{$short}");
|
||||
$db->executeStatement("CREATE TABLE cmp_{$prefix}_{$short} AS SELECT * FROM {$table}");
|
||||
}
|
||||
};
|
||||
$restore = function () use ($db, $tables) {
|
||||
foreach ($tables as $short => $table) {
|
||||
$db->executeStatement("DELETE FROM {$table}");
|
||||
$db->executeStatement("INSERT INTO {$table} SELECT * FROM cmp_bak_{$short}");
|
||||
}
|
||||
};
|
||||
|
||||
$snapshot('bak');
|
||||
try {
|
||||
$reader = new XmlProductReader(GeneralUtility::getFileAbsFileName('fileadmin/xmlexport'));
|
||||
$rows = iterator_to_array($reader, false);
|
||||
$count = GeneralUtility::makeInstance(DateImportService::class)->import($rows);
|
||||
printf("xml: %d rows, %d dates imported, source generated at %s\n", count($rows), $count,
|
||||
$reader->getSourceGeneratedAt() ? $reader->getSourceGeneratedAt()->format('c') : '?');
|
||||
$snapshot('xml');
|
||||
$restore();
|
||||
|
||||
// Bypass the "already imported" baseline: walk the export pages directly
|
||||
$api = GeneralUtility::makeInstance(ApiImportSource::class);
|
||||
$walk = new \ReflectionMethod($api, 'walkPages');
|
||||
$walk->setAccessible(true);
|
||||
$export = $walk->invoke($api);
|
||||
if (!is_array($export)) {
|
||||
throw new \RuntimeException('MyE&P export walk returned ' . var_export($export, true));
|
||||
}
|
||||
[$apiRows, $generatedAt] = $export;
|
||||
$count = GeneralUtility::makeInstance(DateImportService::class)->import($apiRows);
|
||||
printf("api: %d rows, %d dates imported, source generated at %s\n", count($apiRows), $count,
|
||||
$generatedAt ? $generatedAt->format('c') : '?');
|
||||
$snapshot('api');
|
||||
|
||||
// Raw rows of both sources, for a field-by-field comparison independent of the import
|
||||
file_put_contents('/var/www/html/var/rows_xml.json', json_encode($rows));
|
||||
file_put_contents('/var/www/html/var/rows_api.json', json_encode($apiRows));
|
||||
} finally {
|
||||
$restore();
|
||||
echo "live tables restored\n";
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -21,3 +21,4 @@ public/typo3temp
|
||||
public/uploads
|
||||
var
|
||||
http-client.private.env.json
|
||||
.ddev/static-export/__pycache__/export.cpython-313.pyc
|
||||
@@ -0,0 +1,22 @@
|
||||
base: 'https://www.alpinevacation.ch'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://alvac.ddev.site'
|
||||
condition: 'applicationContext == "Development"'
|
||||
disableStaticFileCache: false
|
||||
languages:
|
||||
-
|
||||
title: Deutsch
|
||||
enabled: true
|
||||
base: /
|
||||
typo3Language: de
|
||||
locale: de_DE
|
||||
iso-639-1: de
|
||||
websiteTitle: ''
|
||||
navigationTitle: ''
|
||||
hreflang: ''
|
||||
direction: ''
|
||||
flag: de
|
||||
languageId: 0
|
||||
rootPageId: 2458
|
||||
websiteTitle: ''
|
||||
@@ -0,0 +1,22 @@
|
||||
base: 'https://www.cllt-touristik.at'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://cllt.ddev.site'
|
||||
condition: 'applicationContext == "Development"'
|
||||
disableStaticFileCache: false
|
||||
languages:
|
||||
-
|
||||
title: Deutsch
|
||||
enabled: true
|
||||
base: /
|
||||
typo3Language: de
|
||||
locale: de_DE
|
||||
iso-639-1: de
|
||||
websiteTitle: ''
|
||||
navigationTitle: ''
|
||||
hreflang: ''
|
||||
direction: ''
|
||||
flag: de
|
||||
languageId: 0
|
||||
rootPageId: 2457
|
||||
websiteTitle: ''
|
||||
@@ -1,4 +1,4 @@
|
||||
base: 'https://www.unichamp.de'
|
||||
base: 'https://snowbreak.ep-reisen.de'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://unichamp.ddev.site'
|
||||
|
||||
+4
-1
@@ -70,7 +70,10 @@ host('prod')
|
||||
->set('writable_mode', 'chmod')
|
||||
->set('rsync_src', __DIR__)
|
||||
->set('rsync', $rsyncOptions)
|
||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{current_path}}/{{typo3_webroot}}/ --web-url=https://www.ep-reisen.de')
|
||||
// The temp script goes into the shared typo3temp, which resolves to the same directory from every
|
||||
// release: PHP workers with a stale realpath cache still map "current" to the previous release and
|
||||
// would 404 on a script placed inside the new one.
|
||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{deploy_path}}/shared/{{typo3_webroot}}/typo3temp/ --web-url=https://www.ep-reisen.de/typo3temp')
|
||||
;
|
||||
|
||||
task('deploy', [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -90,6 +90,14 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline']
|
||||
// by the CDN, so stop generating them. mod_deflate still compresses direct origin hits.
|
||||
$GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 0;
|
||||
|
||||
// utf8 in MySQL/MariaDB is utf8mb3 (max. 3 bytes) and rejects 4-byte characters like emoji.
|
||||
// Set here because LocalConfiguration.php is a Deployer shared file and not deployed from the repo.
|
||||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['charset'] = 'utf8mb4';
|
||||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['tableoptions'] = [
|
||||
'charset' => 'utf8mb4',
|
||||
'collate' => 'utf8mb4_unicode_ci',
|
||||
];
|
||||
|
||||
// suppress php deprecation warnings flooding typo3 logs
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] =
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] & ~E_DEPRECATED & ~E_USER_DEPRECATED;
|
||||
|
||||
@@ -59,6 +59,7 @@ call_user_func(function() {
|
||||
'label' => 'Reiseart',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'items' => [
|
||||
['Keine Zuordnung', 0],
|
||||
@@ -74,6 +75,7 @@ call_user_func(function() {
|
||||
'label' => 'Angebot/Beispielangebot',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'items' => [
|
||||
['Keine Zuordnung', 0],
|
||||
|
||||
@@ -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
@@ -403,6 +403,7 @@ return [
|
||||
'label' => 'Produkte',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectMultipleSideBySide',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_product',
|
||||
'size' => 10,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ call_user_func(function() {
|
||||
'label' => 'Land',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_country',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
@@ -39,6 +40,7 @@ call_user_func(function() {
|
||||
'label' => 'Gebiet',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_region',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
@@ -106,6 +108,7 @@ call_user_func(function() {
|
||||
'label' => 'Badge',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_badge',
|
||||
'foreign_table_where' => 'ORDER BY title',
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ call_user_func(function() {
|
||||
'label' => 'Mitarbeiter',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_teammember',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<f:render partial="Disrupter/Outlines" section="Top1" arguments="{classes: '-translate-y-2 text-white'}"/>
|
||||
</f:if>
|
||||
<div class="py-4 relative">
|
||||
<div class="container grid grid-cols-2 lg:grid-cols-4 gap-8 pb-4">
|
||||
<div class="container grid md:grid-cols-2 lg:grid-cols-4 gap-8 pb-4 text-center md:text-left">
|
||||
<f:if condition="{settings.footerNavPid}">
|
||||
<f:for each="{footernav}" as="menuheader">
|
||||
<div>
|
||||
@@ -32,7 +32,7 @@
|
||||
</f:if>
|
||||
</div>
|
||||
|
||||
<div class="container py-4 text-white text-xl border-t border-white">
|
||||
<div class="container py-4 text-white text-xl border-t border-white text-center md:text-left">
|
||||
{totalRatings.totalAverage -> f:format.number(decimalSeparator: ',')} Sterne bei {totalRatings.totalCount} Bewertungen
|
||||
</div>
|
||||
|
||||
@@ -184,10 +184,8 @@
|
||||
<f:format.raw>{totalRatings.jsonData->f:format.json()}</f:format.raw>
|
||||
</script>
|
||||
|
||||
<f:comment><!--
|
||||
<f:if condition="{site.identifier} == 'ep-reisen'">
|
||||
<f:render partial="Chatbot" arguments="{_all}"/>
|
||||
</f:if>
|
||||
--></f:comment>
|
||||
|
||||
</html>
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user