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

invalid sql in calendar/lib.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.4, 2.2.1, 2.3
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Calendar
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      Log in as admin. Check that the site setting calendar_adminseesall is checked.

      Check that your site has debug messages set to developer and display debug messages checked.

      If it isnt already add a calendar block to your site's front page.

      Go into a course and create two course events within that single course. Make them in the near future. http://docs.moodle.org/20/en/Using_Calendar#Adding_an_event

      Return to your site's home page. The two events should appear in the calendar. No errors should be displayed.

      Show
      Log in as admin. Check that the site setting calendar_adminseesall is checked. Check that your site has debug messages set to developer and display debug messages checked. If it isnt already add a calendar block to your site's front page. Go into a course and create two course events within that single course. Make them in the near future. http://docs.moodle.org/20/en/Using_Calendar#Adding_an_event Return to your site's home page. The two events should appear in the calendar. No errors should be displayed.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      master_MDL-31086

      Description

      function calendar_get_default_courses() generates sql like this:

      SELECT c.* , ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM {course} c JOIN {event} e ON e.courseid = c.id LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = 50)

      Which throws multiple errors like this:

      Did you remember to make the first column something unique in your call to get_records? Duplicate value '4' found in column 'id'.
       
          line 705 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
          line 1359 of /calendar/lib.php: call to pgsql_native_moodle_database->get_records_sql()
          line 40 of /blocks/calendar_upcoming/block_calendar_upcoming.php: call to calendar_get_default_courses()
          line 280 of /blocks/moodleblock.class.php: call to block_calendar_upcoming->get_content()
          line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
          line 926 of /lib/blocklib.php: call to block_base->get_content_for_output()
          line 978 of /lib/blocklib.php: call to block_manager->create_block_contents()
          line 349 of /lib/blocklib.php: call to block_manager->ensure_content_created()
          line 4 of /theme/base/layout/frontpage.php: call to block_manager->region_has_content()
          line 685 of /lib/outputrenderers.php: call to include()
          line 637 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
          line ? of unknownfile: call to core_renderer->header()
          line 1363 of /lib/setuplib.php: call to call_user_func_array()
          line ? of unknownfile: call to bootstrap_renderer->__call()
          line 91 of /index.php: call to bootstrap_renderer->header()

      also reported here:
      http://moodle.org/mod/forum/discuss.php?d=186218
      http://moodle.org/mod/forum/discuss.php?d=182219

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Mar/12