Commit 8c81c136 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1760742: Error when changing a group from standard to course



When there are no blogposts made

behatnotneeded

Change-Id: I7a3b2bed818c66fd4edef188ed7ba475e54c3a4c
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 087cb93d)
parent 1d0aef8d
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -706,9 +706,9 @@ function group_update($new, $create=false) {
    // to the group artefacts are updated
    if ($old->grouptype != $new->grouptype) {
        if ($new->grouptype == 'course') {
            $ids = get_records_select_array('artefact',
            if ($ids = get_records_select_array('artefact',
                      '"group" = ' . $new->id . ' AND artefacttype IN (\'blog\', \'blogpost\')',
                      null, '', 'id');
                      null, '', 'id')) {
                $access = ($old->editroles == 'all' || $old->editroles == 'notmember');
                db_begin();
                foreach ($ids as $i => $artefact) {
@@ -722,6 +722,7 @@ function group_update($new, $create=false) {
                }
                db_commit();
            }
        }
        else { //grouptype = standard
            $query = 'DELETE FROM {artefact_access_role}
                      WHERE role = \'tutor\'