fix: don't require transportation services for canceled participants
This commit is contained in:
@@ -28,25 +28,22 @@ class BookingData
|
|||||||
$participantData = ParticipantData::fromPersonalData($participant);
|
$participantData = ParticipantData::fromPersonalData($participant);
|
||||||
$participantData->index = $index;
|
$participantData->index = $index;
|
||||||
|
|
||||||
// update services only for active participants
|
$participantData->courses = $booking
|
||||||
if ('S' !== $participantData->status) {
|
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_COURSES);
|
||||||
$participantData->courses = $booking
|
$participantData->skiPass = $booking
|
||||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_COURSES);
|
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_SKI_PASS);
|
||||||
$participantData->skiPass = $booking
|
$participantData->additionalServices = $booking
|
||||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_SKI_PASS);
|
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_ADDITIONAL);
|
||||||
$participantData->additionalServices = $booking
|
$participantData->board = $booking
|
||||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_ADDITIONAL);
|
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_BOARD);
|
||||||
$participantData->board = $booking
|
$participantData->rentals = $booking
|
||||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_BOARD);
|
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_RENTALS);
|
||||||
$participantData->rentals = $booking
|
// Different keys for direction used in booking data (H <=> HIN, R <=> RUECK)!
|
||||||
->getAdditionalServicesForParticipantByGroup($index, Service::TOKEN_RENTALS);
|
$participantData->transportationServiceTo = $booking
|
||||||
// Different keys for direction used in booking data (H <=> HIN, R <=> RUECK)!
|
->getTransportationServiceForParticipantAndDirection($index, 'H');
|
||||||
$participantData->transportationServiceTo = $booking
|
$participantData->transportationServiceFro = $booking
|
||||||
->getTransportationServiceForParticipantAndDirection($index, 'H');
|
->getTransportationServiceForParticipantAndDirection($index, 'R');
|
||||||
$participantData->transportationServiceFro = $booking
|
$participantData->pickup = $booking->getPickupForParticipant($index);
|
||||||
->getTransportationServiceForParticipantAndDirection($index, 'R');
|
|
||||||
$participantData->pickup = $booking->getPickupForParticipant($index);
|
|
||||||
}
|
|
||||||
|
|
||||||
$instance->participants[$index] = $participantData;
|
$instance->participants[$index] = $participantData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,8 @@ class ParticipantData
|
|||||||
public array $skiPass = [];
|
public array $skiPass = [];
|
||||||
public array $board = [];
|
public array $board = [];
|
||||||
public array $rentals = [];
|
public array $rentals = [];
|
||||||
|
|
||||||
#[Assert\NotNull(message: 'Bitte angeben')]
|
|
||||||
public ?Service $transportationServiceTo = null;
|
public ?Service $transportationServiceTo = null;
|
||||||
|
|
||||||
#[Assert\NotNull(message: 'Bitte angeben')]
|
|
||||||
public ?Service $transportationServiceFro = null;
|
public ?Service $transportationServiceFro = null;
|
||||||
|
|
||||||
public ?Pickup $pickup = null;
|
public ?Pickup $pickup = null;
|
||||||
|
|
||||||
#[Assert\Callback]
|
#[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]
|
#[Assert\Callback]
|
||||||
public function assertPickupSelected(ExecutionContextInterface $context): void
|
public function assertPickupSelected(ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user