course settings: MDL-18595: Fix regression caused by switching the course settings...
authortjhunt <tjhunt>
Thu, 19 Mar 2009 03:14:11 +0000 (03:14 +0000)
committertjhunt <tjhunt>
Thu, 19 Mar 2009 03:14:11 +0000 (03:14 +0000)
The bad commit was http://cvs.moodle.org/moodle/course/edit_form.php?r1=1.65&r2=1.66

Sorry everyone who was inconvenienced by this.

course/edit.php
course/edit_form.php

index 85e16d532b68afdc725756b31c543e19daa9dcbc..6961566f64931c60336a7ad38da3e6311a29a995 100644 (file)
                 } // it'll be greyed out but we want these by default anyway.
             }
             $course->allowedmods = $allowedmods;
-
-            if ($course->enrolstartdate){
-                $course->enrolstartdisabled = 0;
-            }
-
-            if ($course->enrolenddate) {
-                $course->enrolenddisabled = 0;
-            }
         }
     }
 
-
 /// first create the form
     $editform = new course_edit_form('edit.php', compact('course', 'category'));
     // now override defaults if course already exists
 /// process data if submitted
 
         //preprocess data
-        if ($data->enrolstartdisabled){
-            $data->enrolstartdate = 0;
-        }
-
-        if ($data->enrolenddisabled) {
-            $data->enrolenddate = 0;
-        }
-
         $data->timemodified = time();
 
         if (empty($course)) {
index 6b43c4b3a1e4b239529ba94b02bb0d7e762c7451..1cb7a83bbb5f38887a906ffabb08a371786a7cfc 100644 (file)
@@ -464,10 +464,9 @@ class course_edit_form extends moodleform {
             }
         }
 
-        if (empty($data['enrolenddisabled'])){
-            if ($data['enrolenddate'] <= $data['enrolstartdate']){
-                $errors['enroldateendgrp'] = get_string('enrolenddaterror');
-            }
+        if (!empty($data['enrolstartdate']) && !empty($data['enrolenddate']) &&
+                $data['enrolenddate'] <= $data['enrolstartdate']){
+            $errors['enrolenddate'] = get_string('enrolenddaterror');
         }
 
         if (!empty($CFG->enrol_manual_usepasswordpolicy) and isset($data['enrolpassword']) and $data['enrolpassword'] != '') {