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
@@ -4,9 +4,12 @@
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Guest;
|
||||
use App\Models\Property;
|
||||
use App\Models\Tenant;
|
||||
use App\Support\Settings;
|
||||
use DomainException;
|
||||
|
||||
/**
|
||||
* Model hooks of a case: freezes the process profile when the case comes in (and again when what defines it – intake
|
||||
@@ -30,10 +33,32 @@ public static function freeze(Booking $booking): void
|
||||
|
||||
$booking->intake ??= ProcessSettings::intakeFor($booking);
|
||||
$profile = app(ProcessSettings::class)->forBooking($booking)->withOrigin($booking->exists ? 'changed' : 'intake');
|
||||
$booking->profile = $profile->toArray();
|
||||
// Architektur V2: the process plan (model, variant, module versions, step settings) is frozen with the profile.
|
||||
try {
|
||||
$plan = ProcessPlan::freeze($profile, ProcessPlan::configurationOf(self::configurationChannel($booking), $profile->intake));
|
||||
} catch (DomainException $exception) {
|
||||
// Never lose an incoming case over its configuration (e.g. a tester-only variant): it follows the derived plan.
|
||||
report($exception);
|
||||
$plan = ProcessPlan::derive($profile);
|
||||
}
|
||||
$booking->profile = [...$profile->toArray(), 'plan' => $plan->toArray()];
|
||||
$booking->case_type = $profile->caseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The channel whose configuration (Kanal › Ablauf) applies to the case: its portal, or the own website's entry.
|
||||
*/
|
||||
private static function configurationChannel(Booking $booking): ?Channel
|
||||
{
|
||||
$channel = $booking->processChannel();
|
||||
if ($channel === null && $booking->source === 'website' && $booking->property_id !== null) {
|
||||
$property = $booking->property ?? Property::withoutGlobalScope('tenant')->find($booking->property_id);
|
||||
$channel = $property === null ? null : Channel::existingWebsiteOf($property);
|
||||
}
|
||||
|
||||
return $channel;
|
||||
}
|
||||
|
||||
public static function created(Booking $booking): void
|
||||
{
|
||||
CaseLog::record($booking, 'created', 'Vorgang angelegt: '.$booking->caseType()->getLabel().' ('.$booking->bookingChannelLabel().')', data: [
|
||||
|
||||
Reference in new issue
Block a user