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

Custom fields unique status doesn't work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.4, 2.0
    • Component/s: Administration, Usability
    • Labels:
      None
    • Environment:
      Any
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      When i was using custom fields, the Unique option didn't work. After searching some files, I got to /user/profile/lib.php , which defines custom fields class.
      There is a function

      function is_unique()
      {
      return (boolean)$tihs->field->forceunique;
      }

      which is supposed to return that field from the database.

      I thought correcting the mispelling of $this would fix the error. But i found something even stranger.
      There isn't any file using this function.

      Is the unique code done? Or left TODO?

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            tsala Helen Foster added a comment -

            Assigning to Shane. Hope you can help with this issue. Please feel free to reassign to Eloy if not.

            Show
            tsala Helen Foster added a comment - Assigning to Shane. Hope you can help with this issue. Please feel free to reassign to Eloy if not.
            Hide
            ikawhero Shane Elliott added a comment -

            The typo is my fault - easy enough to fix.

            Will look into the uniqueness checks.

            Show
            ikawhero Shane Elliott added a comment - The typo is my fault - easy enough to fix. Will look into the uniqueness checks.
            Hide
            ikawhero Shane Elliott added a comment -

            Typo fixed in CVS. Code added to base class to check for uniqueness of data. Not sure why this was never added, but it's in there now. We've tested here but be good if further testing is done.

            Thanks for raising this issue.

            As an aside, thinking while I type here, may need to add a flag for the field plugins to say whether uniqueness applies. For types like the checkbox it doesn't make sense, so it shouldn't be an option for admins to turn on.

            Show
            ikawhero Shane Elliott added a comment - Typo fixed in CVS. Code added to base class to check for uniqueness of data. Not sure why this was never added, but it's in there now. We've tested here but be good if further testing is done. Thanks for raising this issue. As an aside, thinking while I type here, may need to add a flag for the field plugins to say whether uniqueness applies. For types like the checkbox it doesn't make sense, so it shouldn't be an option for admins to turn on.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Fixed DB 2.0 syntax in HEAD. Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Fixed DB 2.0 syntax in HEAD. Ciao
            Hide
            jerome Jérôme Mouneyrac added a comment -

            Tested on 1.9, it works now. Thanks everybody.

            Show
            jerome Jérôme Mouneyrac added a comment - Tested on 1.9, it works now. Thanks everybody.
            Hide
            jerome Jérôme Mouneyrac added a comment -

            tested on HEAD too, it also works.

            Show
            jerome Jérôme Mouneyrac added a comment - tested on HEAD too, it also works.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Jan/09