diff --git a/mod/data/field/number/field.class.php b/mod/data/field/number/field.class.php index 0192060c765..072a4156459 100755 --- a/mod/data/field/number/field.class.php +++ b/mod/data/field/number/field.class.php @@ -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;