mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Make sure the number is stored as a proper number
This commit is contained in:
parent
59f3b71781
commit
ec536d7a48
@ -30,6 +30,20 @@ class data_field_number extends data_field_base {
|
||||
parent::data_field_base($field, $data);
|
||||
}
|
||||
|
||||
function update_content($recordid, $value, $name='') {
|
||||
$content = new object;
|
||||
$content->fieldid = $this->field->id;
|
||||
$content->recordid = $recordid;
|
||||
$content->content = (float)$value;
|
||||
|
||||
if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) {
|
||||
$content->id = $oldcontent->id;
|
||||
return update_record('data_content', $content);
|
||||
} else {
|
||||
return insert_record('data_content', $content);
|
||||
}
|
||||
}
|
||||
|
||||
function get_sort_sql($fieldname) {
|
||||
global $CFG;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user