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(
88
88
Form |Section $ questions_container ,
89
89
array $ answers
90
90
): ValidationResult {
91
+ $ form = ($ questions_container instanceof Section) ? $ questions_container ->getItem () : $ questions_container ;
91
92
$ result = new ValidationResult ();
93
+ $ engine = new Engine ($ form , new EngineInput ($ answers ));
94
+ $ visibility = $ engine ->computeVisibility ();
92
95
93
- // Check if mandatory questions are answered
96
+ // Retrieve visible mandatory questions
94
97
$ mandatory_questions = array_filter (
95
98
$ questions_container ->getQuestions (),
96
- static fn ($ question ) => $ question ->fields ['is_mandatory ' ]
99
+ fn ($ question ) => $ question ->fields ['is_mandatory ' ]
100
+ && $ visibility ->isQuestionVisible ($ question ->getID ())
97
101
);
98
102
99
103
foreach ($ mandatory_questions as $ question ) {
You can’t perform that action at this time.
0 commit comments