feat: force booking status 'O' for selection id 1473

addresses #869d79q0r
This commit is contained in:
Björn Fromme committed 2026-06-11 15:53:56 +02:00
1 parent bcf75ce3c3
commit d207bc74cb
9 files changed
+318 -5

No files matched your search

+1 -1
View File
@@ -57,7 +57,7 @@ final class Constants
// Booking status codes from buchungstatusmoeglich attribute
public const BOOKING_STATUS_FREE = 'F';
public const BOOKING_STATUS_INQUIRY = 'A';
public const BOOKING_STATUS_OPEN = 'O'; // Optionsbuchung
public const BOOKING_STATUS_OPTION = 'O'; // Optionsbuchung
// Payment methods
public const PAYMENT_METHOD_TRANSFER = 'transfer';
+22
View File
@@ -218,6 +218,28 @@ class Travel
return $services;
}
/**
* Checks whether any CRM selection group contains the given selection ID.
*
* This scans all parsed groups and their selections, regardless of group.
*/
public function hasSelectionId(int $selectionId): bool
{
foreach ($this->selectionGroups as $selectionGroup) {
if (null === $selectionGroup->selections) {
continue;
}
foreach ($selectionGroup->selections as $selection) {
if ($selectionId === $selection->id) {
return true;
}
}
}
return false;
}
/**
* Retrieves rooms filtered by their IDs.
*
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Service\StatusRule;
use App\BusProNet\Service\Contract\BookingStatusRuleInterface;
use App\Form\Model\BookingDto;
/**
* Status rule for travels containing selection 1473.
*
* Forces Option status when the travel contains the CRM selection
* "NICHT-automatisch bestätigen".
*/
class Selection1473StatusRule implements BookingStatusRuleInterface
{
private const STATUS = 'O';
private const PRIORITY = 200;
private const SELECTION_ID = 1473;
public function evaluate(BookingDto $bookingDto): bool
{
return $bookingDto->travel->hasSelectionId(self::SELECTION_ID);
}
public function getStatus(): string
{
return self::STATUS;
}
public function getPriority(): int
{
return self::PRIORITY;
}
public function getDescription(): string
{
return 'Assigns Option status when selection 1473 is present';
}
}