Moodle
  1. Moodle
  2. MDL-20626

The function sync_metacourse doesn't sync the hidden field

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.6
    • Fix Version/s: 1.9.8
    • Component/s: Roles / Access
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31902

      Description

      Let's say we have three courses: A, B and C. Also, course A is a metacourse aggregating B and C.
      Then, i go to course B and enroll a user with any role, marking it as a hidden assign. If i go to course A, the assign o that user will not be hidden.

      I have tracked it down to the sync_metacourse() function, when this function gets the assignments of users in child courses, it doesn't get the hidden field from role_assignments and so, it is not passed as parameter to role_assign() afterwards.

      So, unless this should not be done for some reason, i am willing to do the patch to correct this.

      1. MDL-20626.patch
        1 kB
        Anthony Borrow
      2. MDL-20626v2.patch
        0.9 kB
        Daniel Neis

        Issue Links

          Activity

          Hide
          Anthony Borrow added a comment -

          Daniel - Here is a quick patch that I think may address your issue. It was true that the hidden field was not being considered when making the assignments. Hidden is not needed for unassignments so give this a test and see if it behaves the way that you need. Peace - Anthony

          Show
          Anthony Borrow added a comment - Daniel - Here is a quick patch that I think may address your issue. It was true that the hidden field was not being considered when making the assignments. Hidden is not needed for unassignments so give this a test and see if it behaves the way that you need. Peace - Anthony
          Hide
          Daniel Neis added a comment -

          Hello, Anthony

          thanks for your patch and quick answer. I have tested it here and, as i supposed when i read it, php doesn't allow parameters to be skipped, we have to pass null, or an empty string, or the default value.
          I corrected it and everything worked.
          The uploaded file (MDL-20626v2.patch) is your patch with the corrects.

          Best Regards,
          Daniel

          Show
          Daniel Neis added a comment - Hello, Anthony thanks for your patch and quick answer. I have tested it here and, as i supposed when i read it, php doesn't allow parameters to be skipped, we have to pass null, or an empty string, or the default value. I corrected it and everything worked. The uploaded file ( MDL-20626 v2.patch) is your patch with the corrects. Best Regards, Daniel
          Hide
          Anthony Borrow added a comment -

          Daniel - Thanks for cleaning up the patch. I am glad to hear that it worked. Hopefully we can get this reviewed and checked in. Peace - Anthony

          Show
          Anthony Borrow added a comment - Daniel - Thanks for cleaning up the patch. I am glad to hear that it worked. Hopefully we can get this reviewed and checked in. Peace - Anthony
          Hide
          Daniel Neis added a comment -

          Hello, Petr and Eloy

          another simple issue here, if you have time to take a look.

          Thanks.

          Show
          Daniel Neis added a comment - Hello, Petr and Eloy another simple issue here, if you have time to take a look. Thanks.
          Show
          Patrick Pollet added a comment - see http://moodle.org/mod/forum/discuss.php?d=142923#p624133
          Hide
          Dan Poltawski added a comment -

          Hi Daniel: thanks for the Patch It looks perfect.

          I'm going to apply it once testing day is over.

          Show
          Dan Poltawski added a comment - Hi Daniel: thanks for the Patch It looks perfect. I'm going to apply it once testing day is over.
          Hide
          Dan Poltawski added a comment -

          thanks for the patch! I've commited this to CVS

          Show
          Dan Poltawski added a comment - thanks for the patch! I've commited this to CVS
          Hide
          Daniel Neis added a comment -

          Thanks, Dan!

          Show
          Daniel Neis added a comment - Thanks, Dan!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Thanks Daniel, Anthony, Dan!

          Closing as verified... ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Thanks Daniel, Anthony, Dan! Closing as verified... ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: