mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-20852: Condition system - problems if you delete a module that another one had a condition on
This commit is contained in:
parent
e1b9ac3ef8
commit
bfeaa89501
@ -298,6 +298,9 @@ WHERE
|
||||
if (!$modinfo) {
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
}
|
||||
if (empty($modinfo->cms[$cmid])) {
|
||||
continue;
|
||||
}
|
||||
$information .= get_string(
|
||||
'requires_completion_'.$expectedcompletion,
|
||||
'condition', $modinfo->cms[$cmid]->name).' ';
|
||||
@ -384,6 +387,19 @@ WHERE
|
||||
|
||||
$completion = new completion_info($course);
|
||||
foreach ($this->cm->conditionscompletion as $cmid=>$expectedcompletion) {
|
||||
// If this depends on a deleted module, handle that situation
|
||||
// gracefully.
|
||||
if (!$modinfo) {
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
}
|
||||
if (empty($modinfo->cms[$cmid])) {
|
||||
global $PAGE;
|
||||
if (isset($PAGE) && strpos($PAGE->pagetype, 'course-view-')===0) {
|
||||
debugging("Warning: activity {$this->cm->id} '{$this->cm->name}' has condition on deleted activity $cmid (to get rid of this message, edit the named activity)");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// The completion system caches its own data
|
||||
$completiondata = $completion->get_data((object)array('id'=>$cmid),
|
||||
$grabthelot, $userid, $modinfo);
|
||||
@ -407,9 +423,6 @@ WHERE
|
||||
}
|
||||
if (!$thisisok) {
|
||||
$available = false;
|
||||
if (!$modinfo) {
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
}
|
||||
$information .= get_string(
|
||||
'requires_completion_'.$expectedcompletion,
|
||||
'condition',$modinfo->cms[$cmid]->name).' ';
|
||||
|
Loading…
x
Reference in New Issue
Block a user