Eindeutige iCal-Kalenderspiegelungen automatisch und widerrufbar zuordnen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m53s

This commit is contained in:
Lars committed 2026-10-29 17:01:30 +01:00
1 parent 8b36e07dc4
commit add2367869
16 files changed
+540 -31

No files matched your search

+4 -1
View File
@@ -5,6 +5,7 @@
use App\Models\BlockedPeriod;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\Property;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\ValidationException;
@@ -13,6 +14,7 @@ class ResolveChannelOccupation
public function handle(BlockedPeriod $block, string $resolution, ?int $targetId = null, ?int $originId = null): BlockedPeriod
{
return DB::transaction(function () use ($block, $resolution, $targetId, $originId): BlockedPeriod {
Property::query()->whereKey($block->property_id)->lockForUpdate()->firstOrFail();
$block = BlockedPeriod::query()->whereKey($block->id)->lockForUpdate()->firstOrFail();
if (! in_array($block->source, ['channel', 'email'], true)) {
throw ValidationException::withMessages(['resolution' => 'Nur importierte Portalereignisse benötigen diese Zuordnung.']);
@@ -42,7 +44,8 @@ public function handle(BlockedPeriod $block, string $resolution, ?int $targetId
'linked_booking_id' => $resolution === 'booking' ? $target->id : null,
'review_note' => 'Persönlich zugeordnet; nur die führende Belegung steuert Verfügbarkeit und Export.'];
}
$block->update($attributes);
$block->forceFill(['representation_automatic' => false])->fill($attributes)->save();
app(ReconcileChannelRepresentations::class)->handle($block->property);
return $block->refresh();
});