fix: don't hide voucher fields for booking status 'O'

closes #869bvbkrd
This commit is contained in:
Björn Fromme
2026-01-20 16:06:17 +01:00
parent e7a139b025
commit 24ac2efc53
@@ -4,30 +4,33 @@ declare(strict_types=1);
namespace App\Form\Service\Condition; namespace App\Form\Service\Condition;
use App\BusProNet\Constants;
use App\Form\Model\BookingDto; use App\Form\Model\BookingDto;
use App\Form\Service\Contract\FieldConditionInterface; use App\Form\Service\Contract\FieldConditionInterface;
/** /**
* Condition that checks if the booking is a final booking (not an inquiry). * Condition that checks if the booking is not an inquiry booking.
* *
* This condition is used to exclude certain fields (like vouchers) from inquiry * This condition is used to exclude certain fields (like vouchers) from inquiry
* bookings where they are not applicable. When a booking has inquiry status ('A'), * bookings where they are not applicable. When a booking has inquiry status ('A'),
* fields with this condition will be excluded from the form. * fields with this condition will be excluded from the form.
*
* Returns true for both final ('F') and option ('O') bookings.
*/ */
class FinalBookingOnlyCondition implements FieldConditionInterface class FinalBookingOnlyCondition implements FieldConditionInterface
{ {
/** /**
* Evaluates if the booking is a final booking. * Evaluates if the booking is not an inquiry booking.
* *
* @param BookingDto $bookingDto The current booking data (create or edit) * @param BookingDto $bookingDto The current booking data (create or edit)
* @param int $participantIndex The index of the participant being evaluated * @param int $participantIndex The index of the participant being evaluated
* @param array<string, mixed> $formData Current form data (unused) * @param array<string, mixed> $formData Current form data (unused)
* *
* @return bool True if booking status is 'F' (final), false if 'A' (inquiry) * @return bool True if booking status is not 'A' (inquiry), false otherwise
*/ */
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool
{ {
return 'F' === $bookingDto->bookingStatus; return Constants::BOOKING_STATUS_INQUIRY !== $bookingDto->bookingStatus;
} }
public function getDependentFields(): array public function getDependentFields(): array
@@ -37,6 +40,6 @@ class FinalBookingOnlyCondition implements FieldConditionInterface
public function getDescription(): string public function getDescription(): string
{ {
return 'Only available for final bookings (not inquiry bookings)'; return 'Only available for non-inquiry bookings (final or option)';
} }
} }