U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester
CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98df5e9e3b
commit
7e22e12cac
80 files changed
+4628
-445
No files matched your search
@@ -6,6 +6,7 @@
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\FactSource;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\NewReservation;
|
||||
use App\Mail\ReservationReceived;
|
||||
@@ -16,6 +17,7 @@
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\StayRequest;
|
||||
use App\Process\ProcessRunner;
|
||||
use App\Process\ProcessSettings;
|
||||
use App\Process\RequestHold;
|
||||
use App\Support\Settings;
|
||||
@@ -174,35 +176,27 @@ private function sendMails(Booking $booking): void
|
||||
{
|
||||
$blockers = [];
|
||||
$offerSent = false;
|
||||
$asked = false;
|
||||
|
||||
// The process core answers the request as far as its data allows (Architektur V2, trigger request.created):
|
||||
// automatic mode sends the offer or information; if details are missing, the data request asks for them
|
||||
// (and then replaces the receipt) – independently of the offer, which waits for the details.
|
||||
try {
|
||||
$auto = app(AutoOffer::class);
|
||||
if ($auto->applies($booking)) {
|
||||
$blockers = $auto->handle($booking);
|
||||
$offerSent = $blockers === [];
|
||||
if (! $offerSent) {
|
||||
$booking->update(['internal_notes' => trim(($booking->internal_notes ? $booking->internal_notes."\n\n" : '')."Automatisches Angebot nicht versendet:\n- ".implode("\n- ", $blockers))]);
|
||||
}
|
||||
$booking->refresh();
|
||||
$result = app(ProcessRunner::class)->advance($booking, 'request.created');
|
||||
$offerSent = $result->ran('offer.binding') || $result->ran('offer.information');
|
||||
$booking->refresh();
|
||||
if (! $offerSent && $booking->processingMode() === ProcessingMode::Automatic) {
|
||||
$blockers = [...$result->reasons('offer.binding'), ...$result->reasons('offer.information')];
|
||||
$booking->update(['internal_notes' => trim(($booking->internal_notes ? $booking->internal_notes."\n\n" : '')."Automatisches Angebot nicht versendet:\n- ".implode("\n- ", $blockers))]);
|
||||
}
|
||||
$asked = $result->ran('guest.data_request') && $booking->openDataRequest()?->last_sent_at !== null;
|
||||
$booking->refresh();
|
||||
} catch (Throwable $exception) {
|
||||
Log::warning('Automatisches Angebot fehlgeschlagen', ['booking' => $booking->id, 'exception' => $exception::class]);
|
||||
$blockers = ['Technischer Fehler beim automatischen Angebot – bitte von Hand bearbeiten.'];
|
||||
$offerSent = false;
|
||||
}
|
||||
|
||||
// v0.11: details for the offer are missing – the data request asks for them (and then replaces the receipt).
|
||||
$asked = false;
|
||||
if (! $offerSent) {
|
||||
try {
|
||||
$request = app(RequestCaseData::class)->forNextStep($booking);
|
||||
$asked = $request?->last_sent_at !== null;
|
||||
$booking->refresh();
|
||||
} catch (Throwable $exception) {
|
||||
Log::warning('Rückfrage fehlgeschlagen', ['booking' => $booking->id, 'exception' => $exception::class]);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (! $offerSent && ! $asked && filled($booking->guest?->email)) {
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new ReservationReceived($booking));
|
||||
|
||||
Reference in new issue
Block a user