MDL-57994 course: Fix newsitems setting for course formats without news
authorJun Pataleta <jun@moodle.com>
Wed, 22 Mar 2017 01:26:13 +0000 (09:26 +0800)
committerJun Pataleta <jun@moodle.com>
Wed, 22 Mar 2017 01:26:13 +0000 (09:26 +0800)
course/lib.php

index 49223f3..980173f 100644 (file)
@@ -2491,7 +2491,7 @@ function update_course($data, $editoroptions = NULL) {
     // Set newsitems to 0 if format does not support announcements.
     if (isset($data->format)) {
         $newcourseformat = course_get_format((object)['format' => $data->format]);
-        if (!empty($data->newsitems) && !$newcourseformat->supports_news()) {
+        if (!$newcourseformat->supports_news()) {
             $data->newsitems = 0;
         }
     }