Fixed validation rules on order extra questions

Change-Id: I49479afce6ede5ac9cb192ee9f8d6e14d6cb0fdd
Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
smarcet
2021-05-25 14:08:46 -03:00
parent d771021ad7
commit 91d90d3dea

View File

@@ -111,13 +111,12 @@ final class SummitAttendeeFactory
$extra_questions = $payload['extra_questions'] ?? [];
$mandatory_questions = $summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage);
if (count($extra_questions) < $mandatory_questions->count()) {
throw new ValidationException("You neglected to fill in all mandatory questions for the attendee.");
}
if (count($extra_questions)) {
// only check if question are populated
$mandatory_questions = $summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage);
if (count($extra_questions) < $mandatory_questions->count()) {
throw new ValidationException("You neglected to fill in all mandatory questions for the attendee.");
}
$questions = $summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage);
if ($questions->count() > 0) {
$attendee->clearExtraQuestionAnswers();