Skip to content
Browse files

Merge branch 'MDL-34658-23' of git://github.com/grabs/moodle into MOO…

…DLE_23_STABLE
  • Loading branch information...
2 parents 5f152b5 + 4d8138c commit 98aa996a006b3d36b99475aa84edc464de1dd129 Sam Hemelryk committed Aug 6, 2012
Showing with 11 additions and 3 deletions.
  1. +6 −1 mod/feedback/item/numeric/lib.php
  2. +5 −2 mod/feedback/lib.php
View
7 mod/feedback/item/numeric/lib.php
@@ -540,8 +540,13 @@ public function value_type() {
}
public function clean_input_value($value) {
+ $value = str_replace($this->sep_dec, FEEDBACK_DECIMAL, $value);
if (!is_numeric($value)) {
- return null;
+ if ($value == '') {
+ return null; //an empty string should be null
+ } else {
+ return clean_param($value, PARAM_TEXT); //we have to know the value if it is wrong
+ }
}
return clean_param($value, $this->value_type());
}
View
7 mod/feedback/lib.php
@@ -2203,10 +2203,13 @@ function feedback_check_values($firstitem, $lastitem) {
$formvalname = $item->typ . '_' . $item->id;
if ($itemobj->value_is_array()) {
- $value = optional_param_array($formvalname, null, $itemobj->value_type());
+ //get the raw value here. It is cleaned after that by the object itself
+ $value = optional_param_array($formvalname, null, PARAM_RAW);
} else {
- $value = optional_param($formvalname, null, $itemobj->value_type());
+ //get the raw value here. It is cleaned after that by the object itself
+ $value = optional_param($formvalname, null, PARAM_RAW);
}
+ $value = $itemobj->clean_input_value($value);
//check if the value is set
if (is_null($value) AND $item->required == 1) {

0 comments on commit 98aa996

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