MDL-38713 course: correctly set visibleold on mod creation

Remove uncessary set of visibleold in the form
This commit is contained in:
Dan Poltawski 2013-03-26 16:27:38 +08:00
parent 373a8e052c
commit 7c69ab5dc7

View File

@ -61,6 +61,7 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) {
$newcm->module = $moduleinfo->module; $newcm->module = $moduleinfo->module;
$newcm->instance = 0; // Not known yet, will be updated later (this is similar to restore code). $newcm->instance = 0; // Not known yet, will be updated later (this is similar to restore code).
$newcm->visible = $moduleinfo->visible; $newcm->visible = $moduleinfo->visible;
$newcm->visibleold = $moduleinfo->visible;
$newcm->groupmode = $moduleinfo->groupmode; $newcm->groupmode = $moduleinfo->groupmode;
$newcm->groupingid = $moduleinfo->groupingid; $newcm->groupingid = $moduleinfo->groupingid;
$newcm->groupmembersonly = $moduleinfo->groupmembersonly; $newcm->groupmembersonly = $moduleinfo->groupmembersonly;
@ -128,7 +129,6 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) {
// Make sure visibility is set correctly (in particular in calendar). // Make sure visibility is set correctly (in particular in calendar).
// Note: allow them to set it even without moodle/course:activityvisibility. // Note: allow them to set it even without moodle/course:activityvisibility.
set_coursemodule_visible($moduleinfo->coursemodule, $moduleinfo->visible); set_coursemodule_visible($moduleinfo->coursemodule, $moduleinfo->visible);
$DB->set_field('course_modules', 'visibleold', 1, array('id' => $moduleinfo->coursemodule));
if (isset($moduleinfo->cmidnumber)) { // Label. if (isset($moduleinfo->cmidnumber)) { // Label.
// Set cm idnumber - uniqueness is already verified by form validation. // Set cm idnumber - uniqueness is already verified by form validation.