fix: adopt travel info urls
This commit is contained in:
@@ -46,4 +46,6 @@ APP_BPN_IP=
|
|||||||
APP_BPN_PORT=
|
APP_BPN_PORT=
|
||||||
APP_BPN_DEBUG=false
|
APP_BPN_DEBUG=false
|
||||||
|
|
||||||
|
APP_TRAVEL_INFO_BASE_URL=https://www.ep-reisen.de/reiseinformationen/
|
||||||
|
|
||||||
API_KEYS=
|
API_KEYS=
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||||
parameters:
|
parameters:
|
||||||
|
travel_info_base_url: '%env(APP_TRAVEL_INFO_BASE_URL)%'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
@@ -12,6 +13,7 @@ services:
|
|||||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||||
bind:
|
bind:
|
||||||
$xmlPath: '%kernel.project_dir%/var/xmlexport'
|
$xmlPath: '%kernel.project_dir%/var/xmlexport'
|
||||||
|
$travelInfoBaseUrl: '%env(APP_TRAVEL_INFO_BASE_URL)%'
|
||||||
$logger: '@monolog.logger.core'
|
$logger: '@monolog.logger.core'
|
||||||
|
|
||||||
# makes classes in src/ available to be used as services
|
# makes classes in src/ available to be used as services
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class Booking
|
|||||||
public array $surcharges = [];
|
public array $surcharges = [];
|
||||||
public ?int $invoiceNumber = null;
|
public ?int $invoiceNumber = null;
|
||||||
public ?float $totalPrice = null;
|
public ?float $totalPrice = null;
|
||||||
|
public ?string $travelInfoUrl = null;
|
||||||
|
|
||||||
public function getBalance(): float
|
public function getBalance(): float
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class TravelLoader extends AbstractLoader
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly HotelLoader $hotelDataLoader,
|
private readonly HotelLoader $hotelDataLoader,
|
||||||
CacheInterface $cache,
|
CacheInterface $cache,
|
||||||
|
private readonly string $travelInfoBaseUrl,
|
||||||
?string $xmlPath = null
|
?string $xmlPath = null
|
||||||
) {
|
) {
|
||||||
parent::__construct($cache, $xmlPath);
|
parent::__construct($cache, $xmlPath);
|
||||||
@@ -345,7 +346,24 @@ class TravelLoader extends AbstractLoader
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$booking->travelData = $this->loadById($travelId);
|
$travelData = $this->loadById($travelId);
|
||||||
|
$booking->travelData = $travelData;
|
||||||
|
|
||||||
|
if (null === $travelData || null === $travelData->dateFrom) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = new \DateTimeImmutable();
|
||||||
|
$travelDate = $travelData->dateFrom;
|
||||||
|
$travelCode = $travelData->code;
|
||||||
|
|
||||||
|
if ($travelDate->modify('-5 days') < $now) {
|
||||||
|
$booking->travelInfoUrl = sprintf(
|
||||||
|
'%s/%s',
|
||||||
|
rtrim($this->travelInfoBaseUrl, '/'),
|
||||||
|
str_replace('/', '-', $travelCode)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,11 +75,11 @@
|
|||||||
target="_blank">
|
target="_blank">
|
||||||
Rechnung
|
Rechnung
|
||||||
</a>
|
</a>
|
||||||
{% if booking.hasDocuments %}
|
{% if booking.travelInfoUrl is not null %}
|
||||||
<a href="{{ path('app_booking_documents', { 'id': booking.id }) }}"
|
<a href="{{ booking.travelInfoUrl }}"
|
||||||
class="button bg-button bg-pink button--small"
|
class="button bg-button bg-pink button--small"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
Reisedokumente
|
Reiseinfos
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user