feat: update filename formatting of booking confirmation pdf
This commit is contained in:
@@ -11,7 +11,6 @@ use Dompdf\Options;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\String\Slugger\AsciiSlugger;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
@@ -81,10 +80,6 @@ class AccommodationBookingPdfGenerator
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Named after arrival date and group rather than the entity id, which is a local
|
||||
* detail with no counterpart in BusPro and would read as a booking number.
|
||||
*/
|
||||
/**
|
||||
* @throws \RuntimeException when the booking carries no price information
|
||||
*/
|
||||
@@ -95,14 +90,13 @@ class AccommodationBookingPdfGenerator
|
||||
|
||||
private function buildFilename(AccommodationBooking $booking): string
|
||||
{
|
||||
$groupName = (new AsciiSlugger('de'))->slug((string) $booking->getGroupName())->lower()->toString();
|
||||
$parts = array_filter([
|
||||
$booking->getDateFrom()?->format('Y-m-d'),
|
||||
$booking->getAccommodation()?->getCalendarCode(),
|
||||
'Buchung',
|
||||
]);
|
||||
|
||||
return sprintf(
|
||||
'%s-%s%s.pdf',
|
||||
mb_strtolower($booking->recordLabel()),
|
||||
$booking->getDateFrom()?->format('Y-m-d') ?? 'ohne-datum',
|
||||
'' !== $groupName ? '-'.$groupName : ''
|
||||
);
|
||||
return implode(' ', $parts).'.pdf';
|
||||
}
|
||||
|
||||
private function logoDataUri(): string
|
||||
|
||||
Reference in New Issue
Block a user