Modellwahl über Kanalfähigkeiten mit erklärten Einschränkungen, Abgleich alter Werte, Ausführungsvarianten je Modul, getrennte Vertrags-/Buchungsinformation, Warten auf die Portalbestätigung mit Eskalation und Wiederaufnahme (Fälle C und D getestet). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
48 lines
1.9 KiB
PHP
48 lines
1.9 KiB
PHP
<?php
|
||
|
||
namespace App\Console\Commands;
|
||
|
||
use App\Models\Booking;
|
||
use App\Models\Tenant;
|
||
use App\Process\ProcessRunner;
|
||
use App\Tenancy\TenantRunner;
|
||
use Illuminate\Console\Attributes\Description;
|
||
use Illuminate\Console\Attributes\Signature;
|
||
use Illuminate\Console\Command;
|
||
use Throwable;
|
||
|
||
/**
|
||
* Evaluates binding bookings that wait for an event again (V2.1, docs/Prozessarchitektur/V2.1/02 §5): the portal's
|
||
* confirmation mail did not come in time (escalate once), came meanwhile (close the escalation, go on) – without this nothing
|
||
* would resume or time out, because no scheduler looks at binding cases. Only cases whose channel makes them wait are
|
||
* touched; once per landlord.
|
||
*/
|
||
#[Signature('bookings:advance-waiting')]
|
||
#[Description('Re-evaluate binding bookings that wait for a portal confirmation (deadline, escalation, resume) – once per landlord')]
|
||
class AdvanceWaitingCases extends Command
|
||
{
|
||
public function handle(TenantRunner $tenants, ProcessRunner $runner): int
|
||
{
|
||
$tenants->each(function (Tenant $tenant) use ($runner): void {
|
||
$evaluated = 0;
|
||
Booking::query()->occupying()->where('intake', 'booking')->where('created_at', '>', now()->subDays(90))
|
||
->with(['property', 'guest', 'importChannel', 'originChannel'])
|
||
->each(function (Booking $booking) use ($runner, &$evaluated): void {
|
||
if (! $booking->process()->awaitsPortalConfirmation()) {
|
||
return;
|
||
}
|
||
try {
|
||
$runner->advance($booking, 'schedule:waiting');
|
||
$evaluated++;
|
||
} catch (Throwable $exception) {
|
||
report($exception);
|
||
}
|
||
});
|
||
|
||
$this->info("{$tenant->name}: {$evaluated} wartende Vorgang/Vorgänge bewertet.");
|
||
});
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
}
|