Dokumentenzusammenstellung und Vorlagensteuerung (Paket 3, Prozessarchitektur v0.10)
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
Eine Zusammenstellung vor jedem Dokument (Angebot, Bestaetigung, Buchungsunterlagen extern), Dokumentart je Vorgangsart, Freigaben fuer Vorlagen und Dokumentarten, Schutz vor unvereinbarten Bedingungen bei Portalbuchungen (E-004), kein doppelter Versand, Absicherung Hold 0 bis Paket 7, A6-Aufenthaltsbestaetigung vorbereitet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64248c09fa
commit
cf11c8a474
45 files changed
+2385
-144
No files matched your search
@@ -6,11 +6,14 @@
|
||||
use App\Documents\OfferTerms;
|
||||
use App\Documents\RentalContract;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\InboxMessageKind;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Mail\BookingConfirmed;
|
||||
use App\Mail\BookingDocumentation;
|
||||
use App\Models\Booking;
|
||||
use App\Process\CaseLog;
|
||||
use App\Support\Inbox;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -84,18 +87,28 @@ public function bind(Booking $booking): void
|
||||
*
|
||||
* @return bool whether the guest has the confirmation (true when no mail was requested)
|
||||
*/
|
||||
public function deliver(Booking $booking, bool $notifyGuest = true): bool
|
||||
public function deliver(Booking $booking, bool $notifyGuest = true, ?DocumentKind $kind = null): bool
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$kind ??= DocumentKind::forCase($booking) ?? DocumentKind::Confirmation;
|
||||
|
||||
try {
|
||||
$this->contract->generate($booking);
|
||||
$created = $booking->contract_path === null;
|
||||
$this->contract->generate($booking, kind: $kind);
|
||||
if ($created) {
|
||||
CaseLog::record($booking, 'document', $kind->getLabel().' erstellt'.(isset($booking->offer_terms['template']['name']) ? ' (Vorlage '.$booking->offer_terms['template']['name'].', Version '.$booking->offer_terms['template']['version'].')' : ' (Texte der Webseite)'), data: [
|
||||
'kind' => $kind->value,
|
||||
'template' => $booking->offer_terms['template'] ?? null,
|
||||
'annexes' => array_map(fn (array $annex): string => $annex['name'].' (Version '.$annex['version'].')', (array) ($booking->offer_terms['annexes'] ?? [])),
|
||||
'pdf_sha256' => $booking->contract_pdf_sha256,
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $notifyGuest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new BookingConfirmed($booking));
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send($kind === DocumentKind::ExternalRecord ? new BookingDocumentation($booking) : new BookingConfirmed($booking));
|
||||
$booking->forceFill(['confirmation_sent_at' => now(), 'confirmation_failed_at' => null])->save();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user