From 5c3b5143dc3d2cd2f22d8d6abecd5fb3b9eab020 Mon Sep 17 00:00:00 2001 From: Martin Mastny Date: Thu, 16 Apr 2015 14:21:35 +0800 Subject: [PATCH] MDL-49281 grades: Calculation settings upgraded --- grade/edit/tree/lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php index dcafa70812d..a2bc4f44567 100644 --- a/grade/edit/tree/lib.php +++ b/grade/edit/tree/lib.php @@ -136,8 +136,11 @@ class grade_edit_tree { if (!$is_category_item && ($icon = $this->gtree->get_edit_icon($element, $this->gpr, true))) { $actionsmenu->add($icon); } - - if ($this->show_calculations && ($icon = $this->gtree->get_calculation_icon($element, $this->gpr, true))) { + // MDL-49281 if grade_item already has calculation, it should be editable even if global setting is off. + $type = $element['type']; + $iscalculated = ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') && $object->is_calculated(); + $icon = $this->gtree->get_calculation_icon($element, $this->gpr, true); + if ($iscalculated || ($this->show_calculations && $icon)) { $actionsmenu->add($icon); }