Moodle
  1. Moodle
  2. MDL-34220

Backup/Restore of custom user field conditions doesn't work on different sites.

    Details

    • Testing Instructions:
      Hide
      1. Log in as an admin
      2. Create a user profile field with the following details:
        • Type = menu
        • Name = colour
        • Values = Red, Green, Blue, Yellow, Orange, Pink, Purple, Magenta, Cyan, Turquoise, Brown
      3. Restore the backup attached to this issue as a new course.
      4. Check that the forum in there has a condition on the colour profile field (not equal to Undecided I think)
      5. Check that there is no condition for a profile field called gender.
      Show
      Log in as an admin Create a user profile field with the following details: Type = menu Name = colour Values = Red, Green, Blue, Yellow, Orange, Pink, Purple, Magenta, Cyan, Turquoise, Brown Restore the backup attached to this issue as a new course. Check that the forum in there has a condition on the colour profile field (not equal to Undecided I think) Check that there is no condition for a profile field called gender.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-34220-m24
    • Rank:
      42561

      Description

      There is a bug within the backup and restore of user field conditions for modules and sections.
      Presently when backing up a user field condition if its a custom field the id of the field is recorded and then upon restore we check that a custom field with the same id is checked for existence.
      The problem is that id doesn't identify the custom field, theres nothing to say that custom field 5 is the same on sites a and b.
      Really we should be recording something more meaningfull, like name, and then searching for and mapping that upon restore.

        Issue Links

          Activity

          Hide
          Sam Hemelryk added a comment -

          Assigning to Mark, the author of the user field conditions code (who I've already talked to about this issue)

          Show
          Sam Hemelryk added a comment - Assigning to Mark, the author of the user field conditions code (who I've already talked to about this issue)
          Hide
          Sam Hemelryk added a comment -

          Linking issue where this code was implemented.

          Just noting as well Mark we really need this sorted before the release of 2.4

          Show
          Sam Hemelryk added a comment - Linking issue where this code was implemented. Just noting as well Mark we really need this sorted before the release of 2.4
          Hide
          Sam Hemelryk added a comment -

          OK I've got a solution for this that compares the user profile fields shortname and type to that of the condition specified in the backup.
          If both shortname and type match then the condition is resorted to point at the matching custom field.
          Otherwise it is ignored (as presently happens).

          Please note its not backwards compatible for existing backups with user profile conditions, I didn't bother with that as the user condition code landed last Thursday.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - OK I've got a solution for this that compares the user profile fields shortname and type to that of the condition specified in the backup. If both shortname and type match then the condition is resorted to point at the matching custom field. Otherwise it is ignored (as presently happens). Please note its not backwards compatible for existing backups with user profile conditions, I didn't bother with that as the user condition code landed last Thursday. Cheers Sam
          Hide
          Sam Hemelryk added a comment -

          Sumbitting this for integration, it doesn't support changes to backup/restore of user profile field conditions from master last week.
          If it lands this week I think that is fine, otherwise I will add support.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Sumbitting this for integration, it doesn't support changes to backup/restore of user profile field conditions from master last week. If it lands this week I think that is fine, otherwise I will add support. Cheers Sam
          Hide
          Dan Poltawski added a comment -

          Thanks Sam - congratulations for getting an xor into moodle

          Show
          Dan Poltawski added a comment - Thanks Sam - congratulations for getting an xor into moodle
          Hide
          Rossiani Wijaya added a comment -

          This looks good.

          However, while testing this I noticed 'cohort' enrollment error. Which is reported through MDL-31067.

          I'm passing this test because the bug is irrelevant with the issue.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This looks good. However, while testing this I noticed 'cohort' enrollment error. Which is reported through MDL-31067 . I'm passing this test because the bug is irrelevant with the issue. Test passed.
          Hide
          Dan Poltawski added a comment -

          *Notice*: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26

          Congratulations

          {tracker.user.name}

          !

          You've made into Moodle

          {tracker.fixversion-1}

          +

          I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world.

          cheers!

          {tracker.friendlyintegrator}
          Show
          Dan Poltawski added a comment - * Notice *: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26 Congratulations {tracker.user.name} ! You've made into Moodle {tracker.fixversion-1} + I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world. cheers! {tracker.friendlyintegrator}

            People

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

              Dates

              • Created:
                Updated:
                Resolved: