diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 61238a08..681f3bf9 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -961,7 +961,7 @@ class ApiController extends OCSController { $optionIndex = array_search($answer, array_column($question['options'], 'id')); if ($optionIndex !== false) { $answerText = $question['options'][$optionIndex]['text']; - } elseif (!empty($question['extraSettings']->allowOtherAnswer) && strpos($answer, Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX) === 0) { + } elseif (!empty($question['extraSettings']['allowOtherAnswer']) && strpos($answer, Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX) === 0) { $answerText = str_replace(Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX, "", $answer); } } else { diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 04bc0875..5fbee91d 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -302,7 +302,7 @@ class SubmissionService { * @return boolean If the submission is valid */ public function validateSubmission(array $questions, array $answers): bool { - + // Check by questions foreach ($questions as $question) { $questionId = $question['id']; @@ -312,7 +312,7 @@ class SubmissionService { if ($question['isRequired'] && (!$questionAnswered || !array_filter($answers[$questionId], 'strlen') || - (!empty($question['extraSettings']->allowOtherAnswer) && !array_filter($answers[$questionId], fn ($value) => $value !== Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX))) + (!empty($question['extraSettings']['allowOtherAnswer']) && !array_filter($answers[$questionId], fn ($value) => $value !== Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX))) ) { return false; } @@ -334,7 +334,7 @@ class SubmissionService { } // Check if all answers are within the possible options - if (in_array($question['type'], Constants::ANSWER_TYPES_PREDEFINED) && empty($question['extraSettings']->allowOtherAnswer)) { + if (in_array($question['type'], Constants::ANSWER_TYPES_PREDEFINED) && empty($question['extraSettings']['allowOtherAnswer'])) { foreach ($answers[$questionId] as $answer) { // Search corresponding option, return false if non-existent if (array_search($answer, array_column($question['options'], 'id')) === false) { diff --git a/src/components/Questions/QuestionMultiple.vue b/src/components/Questions/QuestionMultiple.vue index 3ec4a9f1..33d4897b 100644 --- a/src/components/Questions/QuestionMultiple.vue +++ b/src/components/Questions/QuestionMultiple.vue @@ -48,7 +48,7 @@