diff --git a/app/controllers/course/statusgroups.php b/app/controllers/course/statusgroups.php index fa5438600e5442e1559ce0d62ef76e1108a0239d..4013c8c5f0cd22ffd1e40ce5b437ee204c2d9547 100644 --- a/app/controllers/course/statusgroups.php +++ b/app/controllers/course/statusgroups.php @@ -1112,11 +1112,17 @@ class Course_StatusgroupsController extends AuthenticatedController $groups = Statusgruppen::findMany(Request::getArray('groups')); foreach ($groups as $g) { - Statusgruppen::createOrUpdate($g->id, $g->name, - $g->position, $this->course_id, + Statusgruppen::createOrUpdate( + $g->id, + $g->name, + $g->position, + $this->course_id, Request::int('size', 0), - $g->selfassign, $g->selfassign_start, $g->selfassign_end, - false); + $g->selfassign, + $g->selfassign_start, + $g->selfassign_end, + false + ); } PageLayout::postSuccess(_('Die Einstellungen der ausgewählten Gruppen wurden gespeichert.')); $this->relocate('course/statusgroups'); diff --git a/lib/models/Statusgruppen.php b/lib/models/Statusgruppen.php index 03e57d2ab258e3b251c6039e6735c4ebe90bde0b..7520c975edd86906a5ec9ddecb570e39ce284431 100644 --- a/lib/models/Statusgruppen.php +++ b/lib/models/Statusgruppen.php @@ -109,15 +109,16 @@ class Statusgruppen extends SimpleORMap implements PrivacyObject /** * Creates or updates a statusgroup. * - * @param string $id ID of an existing group or empty if new group - * @param string $name group name - * @param int $position position or null if automatic position after other groups - * @param string $range_id ID of the object this group belongs to - * @param int $size max number of members or 0 if unlimited - * @param int $selfassign may users join this group by themselves? - * @param int $selfassign_start group joining is possible starting at ... - * @param int $makefolder create a document folder assigned to this group? - * @param array $dates dates assigned to this group + * @param string $id ID of an existing group or empty if new group + * @param string $name group name + * @param int $position position or null if automatic position after other groups + * @param string $range_id ID of the object this group belongs to + * @param int $size max number of members or 0 if unlimited + * @param int $selfassign may users join this group by themselves? + * @param int $selfassign_start group joining is possible starting at ... + * @param int $makefolder create a document folder assigned to this group? + * @param array|null $dates dates assigned to this group. Defaults to null which means already assigned + * dates are not changed. * @return Statusgruppen The saved statusgroup. * @throws Exception */ @@ -131,7 +132,7 @@ class Statusgruppen extends SimpleORMap implements PrivacyObject $selfassign_start, $selfassign_end, $makefolder, - $dates = [] + $dates = null ) { $group = new Statusgruppen($id); @@ -145,10 +146,8 @@ class Statusgruppen extends SimpleORMap implements PrivacyObject $group->selfassign_end = $selfassign ? $selfassign_end : 0; // Set assigned dates. - if ($dates) { + if (isset($dates)) { $group->dates = CourseDate::findMany($dates); - } else { - $group->dates = []; } $group->store();