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:
LarsandClaude Opus 5.5 committed 2026-11-04 14:49:44 +01:00
1 parent 98df5e9e3b
commit 7e22e12cac
80 files changed
+4628 -445

No files matched your search

@@ -0,0 +1,62 @@
<?php
namespace App\Process\Modules\Settlement;
use App\Enums\ActivityState;
use App\Enums\BookingStatus;
use App\Enums\InternalKind;
use App\Models\BookingTask;
use App\Process\Activity;
use App\Process\CaseClosure;
use App\Process\CaseContext;
use App\Process\Modules\Module;
use App\Process\Modules\ModuleDefinition;
/**
* P05 (package 9): closing the stay once nothing is open for it (CaseClosure, overnight or by hand).
*/
final class StayClosure extends Module
{
public static function key(): string
{
return 'case.closure';
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Aufenthalt abschließen',
purpose: 'Schließt den Aufenthalt ab, sobald nach der Abreise nichts mehr für ihn offen ist.',
phase: 'P05',
effects: ['case_write'],
waits: ['time', 'landlord'],
triggers: ['schedule:daily'],
performers: ['system', 'landlord'],
events: ['task', 'status', 'settled'],
);
}
public function applies(CaseContext $case): bool
{
return ! $case->closed && ($case->booking->isBinding() || $case->booking->status === BookingStatus::Completed);
}
public function activities(CaseContext $case): array
{
$booking = $case->booking;
$today = $case->today;
$completed = $booking->status === BookingStatus::Completed;
$blockers = $booking->isBinding() && ! $completed ? CaseClosure::stayBlockers($booking) : collect();
return [new Activity('closure', $booking->isInternal() && $booking->internal_kind === InternalKind::Block ? 'Sperrzeit abschließen' : 'Aufenthalt abschließen', match (true) {
$completed => ActivityState::Done,
! $booking->isBinding() || $booking->departure > $today => ActivityState::Later,
default => ActivityState::Waiting,
}, match (true) {
$completed => 'abgeschlossen am '.($booking->completed_at ?? $booking->updated_at)?->format('d.m.Y'),
$blockers->isNotEmpty() => 'wartet auf: '.$blockers->map(fn (BookingTask $task): string => $task->label())->implode(', '),
$booking->isBinding() && $booking->departure <= $today => 'geschieht automatisch über Nacht – oder jetzt von Hand',
default => 'nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist',
}, $booking->isBinding() && ! $completed && $booking->departure <= $today ? 'closeStay' : null)];
}
}