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

"Course Module ID Incorrect" on "view assignment submission" page.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: None
    • Component/s: Assignment (2.2)
    • Environment:
      moodle 1.9.8 (build 20100325)
      CentOS 5.4
      php 5.3.3
      mysql 5.1.54
    • Database:
      MySQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      This bug is from a mixup between (course module) id and instance id.

      This is related with these bugs, perhaps:

      MDL-12555 Course Module ID Incorrect on Advanced Search ...
      MDL-6701 "Course Module ID incorrect" error on any ...

      [STEPS]
      From a teacher's profile, go to:

      Activity Reports > All Logs

      On this creen, click any "View Assignment Submissions".
      It opens a popup window, but will say "Course Module ID was incorrect." (See screenshot.)
      https://[server]/mod/assignment/submissions.php?id=9999

      There is a "continue" button, but it brings the user to the course home screen, in the popup window.

      [OBSERVATION]
      The cause is because "id" passed to the page is that of a "course module instance id", but the page treats it as a "course module id".

      This is the captured sql statement run on the page, which returns nothing (therefore causing the message).

      SELECT cm.*, m.name, md.name as modname FROM mdl_course_modules cm,
      mdl_modules md, mdl_assignment m WHERE cm.id = 9999 AND cm.instance =
      m.id AND md.id = cm.module ;

      The sql should be changed to this:

      SELECT cm.*, m.name, md.name as modname FROM mdl_course_modules
      cm, mdl_modules md, mdl_assignment m WHERE m.id = 9999 AND cm.instance =
      m.id AND md.id = cm.module ;

      But, the problem is that the sql is from
      get_coursemodule_from_id
      which is defined in
      lib/datalib.php

      =============
      return get_record_sql("SELECT cm.*, m.name, md.name as modname
      FROM {$CFG->prefix}course_modules cm,
      {$CFG->prefix}modules md,
      {$CFG->prefix}$modulename m
      WHERE $courseselect
      cm.id = ".intval($cmid)." AND
      cm.instance = m.id AND
      md.name = '$modulename' AND
      md.id = cm.module");

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              poltawski Dan Poltawski
              Reporter:
              bkimcoe bkimcoe
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: