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

availability_profile does not work with checkbox field types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • 4.1.6, 4.2.3, 4.3
    • Restrict access
    • None
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE

      Steps to reproduce:

      1. Create a user profile field of type 'checkbox' and name Test field.
      2. In a course create an activity, with restriction related to that profile field. E.g. that Test field is equal to 1 (or not, or 0 instead of 1).

      Expected result: it works.

      Actual result: it does not.

      The problem is around here: https://github.com/moodle/moodle/blob/master/availability/condition/profile/classes/condition.php#L297

      It is using ===. However, while the value of the profile field for the user is a string (See cast above the switch) the test value in the JSON for this rule is an int, so this is always false.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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