Moodle
  1. Moodle
  2. MDL-38701

IMS Enterprise file enrolment - Call to undefined function course_get_format

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 2.4.4
    • Component/s: Course, Enrolments
    • Labels:
    • Rank:
      48750

      Description

      I am having an issue running the IMS Enterprise through cron in 2.4.2 and 2.4.3 .../moodle/admin/cli/cron.php (via command line). When used that way, the course seems to be partly created the exits the cron process. This happens when I am trying to register a new course or users with IMSenterprise enrol feature?

      Here's the relevant part of the cron.php:

      IMS Enterprise enrol cron process launched at lundi 25 mars 2013, 10:35
      Found file /server_path_to_moodle/moodle/enrol/imsenterprise/uploads/imsenterprise-enrol.xml
      PHP Fatal error:  Call to undefined function course_get_format() in /server_path_to_moodle/moodle/lib/blocklib.php on line 2159
      
      __________________________________________________________________
      <?xml version="1.0" encoding="utf-8"?>
      <enterprise>
        <properties>
          <datasource>Datasource</datasource>
          <datetime>2013-03-25</datetime>
        </properties>
        <group recstatus="3">
          <sourcedid>
            <source>Datasource</source>
            <id>2013-2-AAA2222-GT</id>
          </sourcedid>
          <description>
            <short>2013-2-AAA2222-GT Subject Lorem ipsum dolor</short>
            <long>Subject Lorem ipsum dolor</long>
            <full>Objective:Lorem ipsum dolor sit amet, consectetur adipiscing elit.</full>
          </description>
          <org>
            <orgname>Some University</orgname>
            <orgunit>Some Department</orgunit>
          </org>
        </group>
      </enterprise>
      __________________________________________________________________
      

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          I've put that on the backlog.

          In the meantime, feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a "patch" label so we will spot it.

          Show
          Michael de Raadt added a comment - Thanks for reporting this. I've put that on the backlog. In the meantime, feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a "patch" label so we will spot it.
          Hide
          Martin Thibert added a comment -

          In order to see the actual error, you must first activate "debug" and "debugdisplay" in Moodle. If you don't, you might think everything is working properly because all cron.php script prints is something like this we no further stuff being done :
          ...
          IMS Enterprise enrol cron process launched at lundi 25 mars 2013, 10:35
          Found file /server_path_to_moodle/moodle/enrol/imsenterprise/uploads/imsenterprise-enrol.xml

          Show
          Martin Thibert added a comment - In order to see the actual error, you must first activate "debug" and "debugdisplay" in Moodle. If you don't, you might think everything is working properly because all cron.php script prints is something like this we no further stuff being done : ... IMS Enterprise enrol cron process launched at lundi 25 mars 2013, 10:35 Found file /server_path_to_moodle/moodle/enrol/imsenterprise/uploads/imsenterprise-enrol.xml
          Hide
          Petr Škoda added a comment -

          Hello, enrol_imsenterprise plugin is not maintained much and contains multiple serious bugs (such as incorrect account deleting, data loss on mnetted sites with duplicate user names, utf8 incompatibility, no unit tests, incorrect creation of users/courses/categories/groups, etc.), I would personally discourage anybody from using it in production environment, sorry.

          Show
          Petr Škoda added a comment - Hello, enrol_imsenterprise plugin is not maintained much and contains multiple serious bugs (such as incorrect account deleting, data loss on mnetted sites with duplicate user names, utf8 incompatibility, no unit tests, incorrect creation of users/courses/categories/groups, etc.), I would personally discourage anybody from using it in production environment, sorry.
          Hide
          Gilles-Philippe Leblanc added a comment -

          In this case Petr, what do you advise to replace IMS Enterprise?

          It should however consider that many still use IMS Enterprise production and a change is not made easily and quickly.

          Show
          Gilles-Philippe Leblanc added a comment - In this case Petr, what do you advise to replace IMS Enterprise? It should however consider that many still use IMS Enterprise production and a change is not made easily and quickly.
          Hide
          Petr Škoda added a comment -

          I do not know, I was just describing the current state of the plugin.

          Show
          Petr Škoda added a comment - I do not know, I was just describing the current state of the plugin.
          Hide
          Marina Glancy added a comment -

          Linking to MDL-37185 that hopefully will make course creation standard by calling create_course()

          Show
          Marina Glancy added a comment - Linking to MDL-37185 that hopefully will make course creation standard by calling create_course()
          Hide
          Marina Glancy added a comment -

          I'm submitting quick fix that includes the necessary file.
          But there is more general problem here that course is created not using function create_course(). This means format-specific attributes are not set, event is not triggered, new context is not marked as dirty, course caches are not cleared, etc. This will hopefully be resolved in the linked issue

          Show
          Marina Glancy added a comment - I'm submitting quick fix that includes the necessary file. But there is more general problem here that course is created not using function create_course(). This means format-specific attributes are not set, event is not triggered, new context is not marked as dirty, course caches are not cleared, etc. This will hopefully be resolved in the linked issue
          Hide
          Dan Poltawski added a comment -

          Integrated to master and 24 - thanks!

          Show
          Dan Poltawski added a comment - Integrated to master and 24 - thanks!
          Hide
          Adrian Greeve added a comment -

          Can we please have more detailed testing instructions next time please?
          Running through the instructions as they are, doesn't test the code.
          After doing some research and making up my own test I can confirm that this patch works.
          Test passed.

          Show
          Adrian Greeve added a comment - Can we please have more detailed testing instructions next time please? Running through the instructions as they are, doesn't test the code. After doing some research and making up my own test I can confirm that this patch works. Test passed.
          Hide
          Marina Glancy added a comment -

          Adrian, testing instructions were copied from issue description. This is where the reporter encountered an error. So test was to make sure that the same scenario does not end with fatal error. Another story is that we don't know how to use IMS Enterprise enrol plugin. Hopefully we'll hear back from Martin Thibert if this fix solved his problem.

          But again, as Petr said already - this plugin has serious bugs.

          Show
          Marina Glancy added a comment - Adrian, testing instructions were copied from issue description. This is where the reporter encountered an error. So test was to make sure that the same scenario does not end with fatal error. Another story is that we don't know how to use IMS Enterprise enrol plugin. Hopefully we'll hear back from Martin Thibert if this fix solved his problem. But again, as Petr said already - this plugin has serious bugs.
          Hide
          Adrian Greeve added a comment -

          It doesn't look like the testing instructions were copied from the issue description. And running through the testing instructions would not ensure that the same scenario didn't happen again. Some mention of running an xml file for enrolling students or creating a course should have been mentioned.

          Show
          Adrian Greeve added a comment - It doesn't look like the testing instructions were copied from the issue description. And running through the testing instructions would not ensure that the same scenario didn't happen again. Some mention of running an xml file for enrolling students or creating a course should have been mentioned.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Your awesome contributions are now part of Moodle, your fav LMS out there.

          Closing this as fixed.

          Many thanks for all the hard work, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Your awesome contributions are now part of Moodle, your fav LMS out there. Closing this as fixed. Many thanks for all the hard work, ciao
          Hide
          Martin Thibert added a comment -

          I am pleased to confirm that this patch fixed the issue we had. Thank you so much Mariana, great job! This fix should now allow us to move on to 2.4. Hopefully, IMS plugin support will be maintained and upgraded in the future because from what I can see, a lot of universities and college are using it.

          Thanks again!

          Show
          Martin Thibert added a comment - I am pleased to confirm that this patch fixed the issue we had. Thank you so much Mariana, great job! This fix should now allow us to move on to 2.4. Hopefully, IMS plugin support will be maintained and upgraded in the future because from what I can see, a lot of universities and college are using it. Thanks again!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: