Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…into MOODLE_20_STABLE
  • Loading branch information...
commit 36420f78c1c7658c8d6c5c71cd2f166130b6fb12 2 parents 9e5855c + 93e980d
Eloy Lafuente (stronk7) authored May 25, 2011
9  mod/data/lib.php
@@ -1420,9 +1420,14 @@ function data_rating_validate($params) {
1420 1420
     }
1421 1421
 
1422 1422
     //check that the submitted rating is valid for the scale
1423  
-    if ($params['rating'] < 0) {
  1423
+
  1424
+    // lower limit
  1425
+    if ($params['rating'] < 0  && $params['rating'] != RATING_UNSET_RATING) {
1424 1426
         throw new rating_exception('invalidnum');
1425  
-    } else if ($info->scale < 0) {
  1427
+    }
  1428
+
  1429
+    // upper limit
  1430
+    if ($info->scale < 0) {
1426 1431
         //its a custom scale
1427 1432
         $scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
1428 1433
         if ($scalerecord) {
9  mod/forum/lib.php
@@ -3513,9 +3513,14 @@ function forum_rating_validate($params) {
3513 3513
     }
3514 3514
 
3515 3515
     //check that the submitted rating is valid for the scale
3516  
-    if ($params['rating'] < 0) {
  3516
+
  3517
+    // lower limit
  3518
+    if ($params['rating'] < 0  && $params['rating'] != RATING_UNSET_RATING) {
3517 3519
         throw new rating_exception('invalidnum');
3518  
-    } else if ($info->scale < 0) {
  3520
+    }
  3521
+
  3522
+    // upper limit
  3523
+    if ($info->scale < 0) {
3519 3524
         //its a custom scale
3520 3525
         $scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
3521 3526
         if ($scalerecord) {
9  mod/glossary/lib.php
@@ -526,9 +526,14 @@ function glossary_rating_validate($params) {
526 526
     }
527 527
 
528 528
     //check that the submitted rating is valid for the scale
529  
-    if ($params['rating'] < 0) {
  529
+
  530
+    // lower limit
  531
+    if ($params['rating'] < 0  && $params['rating'] != RATING_UNSET_RATING) {
530 532
         throw new rating_exception('invalidnum');
531  
-    } else if ($info->scale < 0) {
  533
+    }
  534
+
  535
+    // upper limit
  536
+    if ($info->scale < 0) {
532 537
         //its a custom scale
533 538
         $scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
534 539
         if ($scalerecord) {

0 notes on commit 36420f7

Please sign in to comment.
Something went wrong with that request. Please try again.