File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/Glpi/Form/AnswersHandler Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -88,12 +88,16 @@ public function validateAnswers(
8888 Form |Section $ questions_container ,
8989 array $ answers
9090 ): ValidationResult {
91+ $ form = ($ questions_container instanceof Section) ? $ questions_container ->getItem () : $ questions_container ;
9192 $ result = new ValidationResult ();
93+ $ engine = new Engine ($ form , new EngineInput ($ answers ));
94+ $ visibility = $ engine ->computeVisibility ();
9295
93- // Check if mandatory questions are answered
96+ // Retrieve visible mandatory questions
9497 $ mandatory_questions = array_filter (
9598 $ questions_container ->getQuestions (),
96- static fn ($ question ) => $ question ->fields ['is_mandatory ' ]
99+ fn ($ question ) => $ question ->fields ['is_mandatory ' ]
100+ && $ visibility ->isQuestionVisible ($ question ->getID ())
97101 );
98102
99103 foreach ($ mandatory_questions as $ question ) {
You can’t perform that action at this time.
0 commit comments