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

Review if all the float form element transformations are correct

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.11.5, 4.0
    • Forms Library, Language
    • None
    • MOODLE_311_STABLE, MOODLE_400_STABLE

      This was detected while working on MDL-73824 and moving some forms (category_form.php, item_form.php) elements from RAW to the "float" type.

      When information arrives to the the validation() method of the form, we can find these values:

      1. If the field is disabled then the information arrives as string, with the raw value in the form (for example 50,00, given I'm using comma decimal separator).
      2. If the field is enabled, then it arrives as:
        1. unformatted float if it's correct (50.00)
        2. boolean false if it incorrect
        3. empty string if it's empty.
      3. If the field is frozen.... haven't tested!

      It makes a little bit tricky to perform extra validations in the method, because somehow the values are not consistent, specially between #1 and #2.1 , and that makes things non-predictable.

      So this issue is about to:

      1. See if it's possible to be more consistent (#1, #2.1, #3 specially) about the values processed, so they are always unformatted floats when possible.
      2. Cover all cases with some tests
      3. Review current 'float' uses in core, there aren't many, specially if the have some custom validation() or other functions that are not receiving the $data consistently. Specifically, but not only, review these two, because they were "fixed" in MDL-73824 and MDL-74516 to workaround the problem. They have a TODO comment pointing to this issue (search by 'MDL-73994' in core):
        • grade/edit/tree/category_form.php
        • grade/edit/tree/item_form.php
        • course/moodleform_mod.php
        • mod/workshop/mod_form.php

            Unassigned Unassigned
            stronk7 Eloy Lafuente (stronk7)
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

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