Skip to content

Commit

Permalink
Merge branch 'MDL-34658-22' of git://github.com/grabs/moodle into MOO…
Browse files Browse the repository at this point in the history
…DLE_22_STABLE
  • Loading branch information
Sam Hemelryk committed Aug 5, 2012
2 parents 1dd8dd8 + 8821ce4 commit 297e891
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion mod/feedback/item/numeric/lib.php
Expand Up @@ -540,8 +540,13 @@ public function value_type() {
} }


public function clean_input_value($value) { public function clean_input_value($value) {
$value = str_replace($this->sep_dec, FEEDBACK_DECIMAL, $value);
if (!is_numeric($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()); return clean_param($value, $this->value_type());
} }
Expand Down
7 changes: 5 additions & 2 deletions mod/feedback/lib.php
Expand Up @@ -2209,10 +2209,13 @@ function feedback_check_values($firstitem, $lastitem) {
$formvalname = $item->typ . '_' . $item->id; $formvalname = $item->typ . '_' . $item->id;


if ($itemobj->value_is_array()) { 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 { } 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 //check if the value is set
if (is_null($value) AND $item->required == 1) { if (is_null($value) AND $item->required == 1) {
Expand Down

0 comments on commit 297e891

Please sign in to comment.