feat: enable entering additional remarks in offer confirmation

This commit is contained in:
Björn Fromme
2026-08-17 15:30:17 +02:00
parent 582e54ddc4
commit a5d97f1206
15 changed files with 387 additions and 20 deletions
+24 -2
View File
@@ -387,14 +387,28 @@ class AccommodationBookingService
/**
* All accommodation mail is sent from the group desk address so customer replies
* land there rather than in the general inbox.
*
* A booking can legitimately have no email yet (drafts, and offers created without
* contact data), so a missing recipient is logged and skipped rather than thrown:
* the caller's own work — accepting an offer, for instance — is already done and
* must not fail over an undeliverable notification.
*/
private function sendBookingEmail(
AccommodationBooking $booking,
string $to,
?string $to,
string $subject,
string $template,
string $errorMessage,
): void {
if (null === $to || '' === trim($to)) {
$this->logger->warning($errorMessage, [
'booking_id' => $booking->getId(),
'error' => 'No recipient email address on the booking.',
]);
return;
}
try {
$this->mailer->createAndSendEmail(
[
@@ -486,13 +500,21 @@ class AccommodationBookingService
* only the status moves to Bestätigt, so an offer-originated booking remains
* distinguishable from a direct one.
* Idempotent — a no-op (including no emails) if the offer is not open any more.
*
* @param ?string $remarks null leaves the stored remark untouched, a string replaces it,
* an empty string clears it
*/
public function acceptBooking(AccommodationBooking $booking): void
public function acceptBooking(AccommodationBooking $booking, ?string $remarks = null): void
{
if (!$booking->isInquiry() || !$booking->isOpen()) {
return;
}
if (null !== $remarks) {
$trimmed = trim($remarks);
$booking->setRemarks('' === $trimmed ? null : $trimmed);
}
$booking->setStatus(AccommodationBookingStatus::Accepted);
$booking->setAcceptedAt(new \DateTimeImmutable());
$this->entityManager->flush();