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

admin: admin_setting_configduration should only use the internal validation if no validatefunction was provided

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-72205-311
    • MDL-72205-master
    • Hide
      1. Log in as Admin.
      2. Go to: Site administration > Plugins > Enrolments > Manual enrolments.
      3. Make sure Default enrolment duration work as normal.
        • Ex: Input 1.5 and unit is Minutes, it will change to 90 with the unit is Seconds.
      4. Input -1 to the Default enrolment duration.
      5. Press Save changes.
      6. Verify that you will see an error: Could not save the setting.
      7. Remember to reset the value back to your default value.

       

      Show
      Log in as Admin. Go to: Site administration > Plugins > Enrolments > Manual enrolments. Make sure  Default enrolment duration work as normal. Ex: Input 1.5 and unit is Minutes, it will change to 90 with the unit is Seconds. Input -1 to the Default enrolment duration. Press Save changes. Verify that you will see an error: Could not save the setting. Remember to reset the value back to your default value.  
    • 0
    • HQ Team International Sprint 6, HQ Team International Sprint 7, HQ Team International Sprint 8, HQ Team International Sprint 9

    Description

      Currently, admin_setting_configduration is always checking the value is greater to zero or not and return the general error message called: "errorsetting" before calling the validate_setting function. So the user cannot use the custom validation logic and custom error message on their site.

      For example: For accessibility, if the user input "-1", some clients want to show "You must enter a number that is greater than zero" instead of "Could not save setting". Because with "Could not save setting", the user cannot know the rule of the validation.

      We should move the internal validation to the validate_setting and do the check as below:

      If validatefunction was provided -> Do the validation with the callable function -> Return the error if any,

      If validatefunction was not provided -> Do the internal validation -> Return the error if any.

       

       

      Attachments

        Issue Links

          Activity

            People

              huongn@moodle.com Huong Nguyen
              huongn@moodle.com Huong Nguyen
              Dongsheng Cai Dongsheng Cai
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Gladys Basiana Gladys Basiana
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8/Nov/21

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 35 minutes
                  4h 35m