From e814af9c5111f1da26e4ba5e16cca80c5ba5a022 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Thu, 3 Nov 2022 10:19:07 +0000
Subject: [PATCH] prevent warning, fixes #1741

Closes #1741

Merge request studip/studip!1134
---
 .../coursewizardsteps/LVGroupsWizardStep.php       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
index 3a9ba545c6f..4dc7b715a79 100644
--- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
+++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
@@ -396,12 +396,14 @@ class LVGroupsWizardStep implements CourseWizardStep
         $category = SeminarCategories::GetByTypeId($coursetype);
 
         if ($category->bereiche) {
-            if (isset($values['StudyAreasLVGroupsCombinedWizardStep'])
-                    && !count($values['StudyAreasLVGroupsCombinedWizardStep']['studyareas'])
-                    && !count($values[__CLASS__]['lvgruppe_selection']['areas'])
-                    && $values[__CLASS__]['step'] > $values['StudyAreasLVGroupsCombinedWizardStep']['step']) {
-                    $ok = false;
-                    $errors[] = _('Die Veranstaltung muss mindestens einem Studienbereich oder einer LV-Gruppe zugeordnet sein.');
+            if (
+                isset($values['StudyAreasLVGroupsCombinedWizardStep'])
+                && empty($values['StudyAreasLVGroupsCombinedWizardStep']['studyareas'])
+                && empty($values[__CLASS__]['lvgruppe_selection']['areas'])
+                && $values[__CLASS__]['step'] > $values['StudyAreasLVGroupsCombinedWizardStep']['step']
+            ) {
+                $ok = false;
+                $errors[] = _('Die Veranstaltung muss mindestens einem Studienbereich oder einer LV-Gruppe zugeordnet sein.');
             }
         } else {
             // optional step if study areas step is activated and at least one area is assigned
-- 
GitLab