Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29612

Bad use of CHAR_MAX_LENGTH in js function + prevent signed numbers & floats in editor

XMLWordPrintable

    • MOODLE_22_STABLE
    • MOODLE_22_STABLE
    • Hide

      1) Go to the XMLDB Editor, load any file, edit any table and edit any field.
      2) TEST: Change both the type and the sequence in the form. Other elements must be enabled/disabled/cleared based on the type and sequence picked. All they are obvious, like "int does not allow decimals", "sequence does not allow nulls"... really os only a matter of test the JS is working because previously it wasn't.
      3) TEST: Change one field to type "char", the "length" field tooltip must change to "1...1333"
      4) TEST: Change one field to type "number", the "unsigned" field is disabled and changed to "signed".
      5) Save changes and you will go back to the view table page
      6) TEST: The field changed in 4) is shown as "number xxxx signed"
      7) TEST: Click on the [XML] button on the right of the field changed in 4) and you should get it defined, among other specs, with UNSIGNED="false"
      8) Optionally, save the file and go to the install.xml file. It should show the same UNSIGNED="false" for the field changed in 4)

      Show
      1) Go to the XMLDB Editor, load any file, edit any table and edit any field. 2) TEST: Change both the type and the sequence in the form. Other elements must be enabled/disabled/cleared based on the type and sequence picked. All they are obvious, like "int does not allow decimals", "sequence does not allow nulls"... really os only a matter of test the JS is working because previously it wasn't. 3) TEST: Change one field to type "char", the "length" field tooltip must change to "1...1333" 4) TEST: Change one field to type "number", the "unsigned" field is disabled and changed to "signed". 5) Save changes and you will go back to the view table page 6) TEST: The field changed in 4) is shown as "number xxxx signed" 7) TEST: Click on the [XML] button on the right of the field changed in 4) and you should get it defined, among other specs, with UNSIGNED="false" 8) Optionally, save the file and go to the install.xml file. It should show the same UNSIGNED="false" for the field changed in 4)

      While playing a bit with the editor after MDL-29611, I've detected that the JS in the edit_field page was not running properly.

      Tracing the problem, it was caused by a bad use of xmldb_field::CHAR_MAX_LENGTH in the js script (caused by MDL-29313). So I'm going to change it by harcoded "1333" and done (note this is not expected to change for some years and the script does not need any other, more complex solution).

      At the same time, in the same JS, I'm going to disable the signed/unsigned field when numbers or floats are selected, aiming to reduce the number of "unsigned" db columns of those 2 types (not brave enough to do the change for integers yet, lol).

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Sam Hemelryk Sam Hemelryk
            Andrew Davis Andrew Davis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.