- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt - Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße - Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition - Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter, "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus - Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben als Abweichung), Bericht: php artisan process:settings-report Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace App\Actions;
|
||
|
||
use App\Exceptions\ReservationException;
|
||
use App\Models\BlockedPeriod;
|
||
use App\Models\Booking;
|
||
use Carbon\CarbonImmutable;
|
||
|
||
/**
|
||
* Takes over a reservation found in a portal calendar as a case ({@see TakeOverExternalBooking}). The calendar only
|
||
* says "these nights are taken"; the case gives the reservation its handling. The calendar entry stays as the portal's
|
||
* mirror of the case. A first name from the calendar is no guest identity – it is kept as a note, not as a guest.
|
||
*/
|
||
class OpenPortalFile
|
||
{
|
||
public function __construct(private TakeOverExternalBooking $takeOver) {}
|
||
|
||
/**
|
||
* @throws ReservationException
|
||
*/
|
||
public function handle(BlockedPeriod $block): Booking
|
||
{
|
||
if ($block->channel === null) {
|
||
throw new ReservationException('Übernehmen lassen sich nur Reservierungen aus einem Portalkalender.');
|
||
}
|
||
|
||
$fields = (array) ($block->ical_interpretation['fields'] ?? []);
|
||
$name = trim((string) ($fields['guest_first_name'] ?? ''));
|
||
|
||
return $this->takeOver->handle(
|
||
$block->property,
|
||
$block->channel,
|
||
CarbonImmutable::parse($block->starts_on),
|
||
CarbonImmutable::parse($block->ends_on),
|
||
['notes' => 'Aus dem Portalkalender „'.$block->channel->name.'“ übernommen.'.($name !== '' ? ' Name laut Kalender: '.$name.'.' : '')],
|
||
$block,
|
||
);
|
||
}
|
||
}
|