Permalink
Browse files

MDL-35517 course: Handle non-existing $course->maxbytes on course cre…

…ation.
  • Loading branch information...
1 parent f9a8571 commit 909c277796ca3d730a80ac3e42c20e30bc0a7f28 @stronk7 stronk7 committed Sep 19, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 course/edit_form.php
@@ -150,7 +150,11 @@ function definition() {
$mform->addHelpButton('showreports', 'showreports');
$mform->setDefault('showreports', $courseconfig->showreports);
- $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $course->maxbytes);
+ // Handle non-existing $course->maxbytes on course creation.
+ $coursemaxbytes = !isset($course->maxbytes) ? null : $course->maxbytes;
+
+ // Let's prepare the maxbytes popup.
+ $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $coursemaxbytes);
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
$mform->addHelpButton('maxbytes', 'maximumupload');
$mform->setDefault('maxbytes', $courseconfig->maxbytes);

0 comments on commit 909c277

Please sign in to comment.