fix: don't require transportation services for canceled participants
This commit is contained in:
@@ -28,8 +28,6 @@ class BookingData
|
||||
$participantData = ParticipantData::fromPersonalData($participant);
|
||||
$participantData->index = $index;
|
||||
|
||||
// update services only for active participants
|
||||
if ('S' !== $participantData->status) {
|
||||
$participantData->courses = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_COURSES);
|
||||
$participantData->skiPass = $booking
|
||||
@@ -46,7 +44,6 @@ class BookingData
|
||||
$participantData->transportationServiceFro = $booking
|
||||
->getTransportationServiceForParticipantAndDirection($index, 'R');
|
||||
$participantData->pickup = $booking->getPickupForParticipant($index);
|
||||
}
|
||||
|
||||
$instance->participants[$index] = $participantData;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,8 @@ class ParticipantData
|
||||
public array $skiPass = [];
|
||||
public array $board = [];
|
||||
public array $rentals = [];
|
||||
|
||||
#[Assert\NotNull(message: 'Bitte angeben')]
|
||||
public ?Service $transportationServiceTo = null;
|
||||
|
||||
#[Assert\NotNull(message: 'Bitte angeben')]
|
||||
public ?Service $transportationServiceFro = null;
|
||||
|
||||
public ?Pickup $pickup = null;
|
||||
|
||||
#[Assert\Callback]
|
||||
@@ -78,6 +73,28 @@ class ParticipantData
|
||||
}
|
||||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function assertTransportationSelected(ExecutionContextInterface $context): void
|
||||
{
|
||||
if ('S' === $this->status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $this->transportationServiceTo) {
|
||||
$context->buildViolation('Bitte angeben')
|
||||
->atPath('transportationServiceTo')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
|
||||
if (null === $this->transportationServiceFro) {
|
||||
$context->buildViolation('Bitte angeben')
|
||||
->atPath('transportationServiceFro')
|
||||
->addViolation()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function assertPickupSelected(ExecutionContextInterface $context): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user