From a12fbc0125b4981e9ea5215ce1dcf7e3d1d62c5c Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 12 May 2009 08:32:16 +0000 Subject: [PATCH] MDL-18547 xmldb floats - recommend to switch to number fields when possible --- admin/xmldb/actions/edit_field/edit_field.class.php | 10 +++++++++- lang/en_utf8/xmldb.php | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/admin/xmldb/actions/edit_field/edit_field.class.php b/admin/xmldb/actions/edit_field/edit_field.class.php index 8c9d6d3522..24791b0d86 100644 --- a/admin/xmldb/actions/edit_field/edit_field.class.php +++ b/admin/xmldb/actions/edit_field/edit_field.class.php @@ -39,6 +39,7 @@ class edit_field extends XMLDBAction { /// Get needed strings $this->loadStrings(array( 'change' => 'xmldb', + 'float2numbernote' => 'xmldb', 'vieworiginal' => 'xmldb', 'viewedited' => 'xmldb', 'yes' => '', @@ -97,8 +98,15 @@ class edit_field extends XMLDBAction { $dbdir =& $XMLDB->dbdirs[$dirpath]; $origstructure =& $dbdir->xml_file->getStructure(); + $o = ''; /// Output starts + + /// If field is XMLDB_TYPE_FLOAT, comment about to migrate it to XMLDB_TYPE_NUMBER + if ($field->getType() == XMLDB_TYPE_FLOAT) { + $o .= '

' . $this->str['float2numbernote'] . '

'; + } + /// Add the main form - $o = '
'; + $o.= ''; $o.= '
'; $o.= ' '; $o.= ' '; diff --git a/lang/en_utf8/xmldb.php b/lang/en_utf8/xmldb.php index 78124e866c..406118ca1c 100644 --- a/lang/en_utf8/xmldb.php +++ b/lang/en_utf8/xmldb.php @@ -74,6 +74,7 @@ $string['fields'] = 'Fields'; $string['fieldsusedinkey'] = 'This field is used as key.'; $string['filenotwriteable'] = 'File not writeable'; $string['fkviolationdetails'] = 'Foreign key $a->keyname on table $a->tablename is violated by $a->numviolations out of $a->numrows rows.'; +$string['float2numbernote'] = 'Notice: Although \"float\" fields are 100% supported by XMLDB, it\'s recommended to migrate to \"number\" fields instead.'; $string['floatincorrectdecimals'] = 'Incorrect number of decimals for float field'; $string['floatincorrectlength'] = 'Incorrect length for float field'; $string['generate_documentation']='Documentation'; -- 2.39.5