From 5939e44447a917bf2546afd1eca909c08607357f Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 7 Jul 2009 01:57:45 +0000 Subject: [PATCH] MDL-19429 Validating 0 values for grademin, grademax and gradepass for the edit category form. Also checking for grademax < grademin case. Merged from MOODLE_19_STABLE --- grade/edit/tree/category.php | 20 ++++++++++++++++---- grade/edit/tree/category_form.php | 9 ++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/grade/edit/tree/category.php b/grade/edit/tree/category.php index c8e7ec6582..96c84c5f86 100644 --- a/grade/edit/tree/category.php +++ b/grade/edit/tree/category.php @@ -126,6 +126,18 @@ if ($mform->is_cancelled()) { if (!isset($itemdata->aggregationcoef)) { $itemdata->aggregationcoef = 0; } + + if (!isset($itemdata->gradepass) || $itemdata->gradepass == '') { + $itemdata->gradepass = 0; + } + + if (!isset($itemdata->grademax) || $itemdata->grademax == '') { + $itemdata->grademax = 0; + } + + if (!isset($itemdata->grademin) || $itemdata->grademin == '') { + $itemdata->grademin = 0; + } $hidden = empty($itemdata->hidden) ? 0: $itemdata->hidden; $hiddenuntil = empty($itemdata->hiddenuntil) ? 0: $itemdata->hiddenuntil; @@ -154,16 +166,16 @@ if ($mform->is_cancelled()) { if (empty($grade_item->id)) { $grade_item->id = $grade_item_copy->id; } - if (empty($grade_item->grademax)) { + if (empty($grade_item->grademax) && $grade_item->grademax != '0') { $grade_item->grademax = $grade_item_copy->grademax; } - if (empty($grade_item->grademin)) { + if (empty($grade_item->grademin) && $grade_item->grademin != '0') { $grade_item->grademin = $grade_item_copy->grademin; } - if (empty($grade_item->gradepass)) { + if (empty($grade_item->gradepass) && $grade_item->gradepass != '0') { $grade_item->gradepass = $grade_item_copy->gradepass; } - if (empty($grade_item->aggregationcoef)) { + if (empty($grade_item->aggregationcoef) && $grade_item->aggregationcoef != '0') { $grade_item->aggregationcoef = $grade_item_copy->aggregationcoef; } diff --git a/grade/edit/tree/category_form.php b/grade/edit/tree/category_form.php index cddd2e5009..f84346e4b7 100644 --- a/grade/edit/tree/category_form.php +++ b/grade/edit/tree/category_form.php @@ -1,4 +1,3 @@ -<<<<<<< category_form.php