]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8537 Added $CFG as the object to check for enrol method when the course is being...
authornicolasconnault <nicolasconnault>
Thu, 5 Apr 2007 07:58:15 +0000 (07:58 +0000)
committernicolasconnault <nicolasconnault>
Thu, 5 Apr 2007 07:58:15 +0000 (07:58 +0000)
course/edit_form.php

index 090c161143a8120fd0615da96e505ae194ac39f1..ee4d3ab4e58b10950f3e13ab51e925c0e1b4f30d 100644 (file)
@@ -289,8 +289,13 @@ class course_edit_form extends moodleform {
         $mform->addElement('select', 'guest', get_string('opentoguests'), $choices);
         $mform->setHelpButton('guest', array('guestaccess', get_string('opentoguests')), true);
         $mform->setDefault('guest', 0);
-
-        if (!empty($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') {
+        
+        // If we are creating a course, its enrol method isn't yet chosen, BUT the site has a default enrol method which we can use here
+        $enrol_object = $CFG;
+        if (!empty($course)) {
+            $enrol_oject = $course;
+        }
+        if (method_exists(enrolment_factory::factory($enrol_object->enrol), 'print_entry') && $enrol_object->enrol != 'manual'){
             $costgroup=array();
             $currencies = get_list_of_currencies();
             $costgroup[]= &MoodleQuickForm::createElement('text','cost', '', 'maxlength="6" size="6"');
@@ -400,4 +405,4 @@ class course_edit_form extends moodleform {
         }
     }
 }
-?>
\ No newline at end of file
+?>