From ec536d7a4806bdf08427a0233d26c65aea0778c0 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 20 Apr 2006 04:07:50 +0000 Subject: [PATCH] Make sure the number is stored as a proper number --- mod/data/field/number/field.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mod/data/field/number/field.class.php b/mod/data/field/number/field.class.php index 0192060c76..072a415645 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; -- 2.39.5