Permalink
Browse files

Merge branch 'MDL-27625_20stable' of git://github.com/stronk7/moodle …

…into MOODLE_20_STABLE
  • Loading branch information...
2 parents 9e5855c + 93e980d commit 36420f78c1c7658c8d6c5c71cd2f166130b6fb12 @stronk7 stronk7 committed May 25, 2011
Showing with 21 additions and 6 deletions.
  1. +7 −2 mod/data/lib.php
  2. +7 −2 mod/forum/lib.php
  3. +7 −2 mod/glossary/lib.php
View
@@ -1420,9 +1420,14 @@ function data_rating_validate($params) {
}
//check that the submitted rating is valid for the scale
- if ($params['rating'] < 0) {
+
+ // lower limit
+ if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
throw new rating_exception('invalidnum');
- } else if ($info->scale < 0) {
+ }
+
+ // upper limit
+ if ($info->scale < 0) {
//its a custom scale
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
if ($scalerecord) {
View
@@ -3513,9 +3513,14 @@ function forum_rating_validate($params) {
}
//check that the submitted rating is valid for the scale
- if ($params['rating'] < 0) {
+
+ // lower limit
+ if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
throw new rating_exception('invalidnum');
- } else if ($info->scale < 0) {
+ }
+
+ // upper limit
+ if ($info->scale < 0) {
//its a custom scale
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
if ($scalerecord) {
@@ -526,9 +526,14 @@ function glossary_rating_validate($params) {
}
//check that the submitted rating is valid for the scale
- if ($params['rating'] < 0) {
+
+ // lower limit
+ if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
throw new rating_exception('invalidnum');
- } else if ($info->scale < 0) {
+ }
+
+ // upper limit
+ if ($info->scale < 0) {
//its a custom scale
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
if ($scalerecord) {

0 comments on commit 36420f7

Please sign in to comment.