Moodle
  1. Moodle
  2. MDL-14797

Error when moving a course to an empty category on Postgres

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.6.7, 1.7.5, 1.8.6, 1.9.1
    • Component/s: Course
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      The code was

      if ($sortorder === false) {

      however, on Postgres (at lease)

      get_field_sql('SELECT MIN(sortorder)-1 AS min
      FROM ' . $CFG->prefix . 'course WHERE category=' . $categoryid);

      returns NULL, not false, if the category you are moving to is empty.

        Gliffy Diagrams

          Activity

          Hide
          Petr Skoda added a comment -

          thanks

          Show
          Petr Skoda added a comment - thanks

            People

            • Assignee:
              Tim Hunt
              Reporter:
              Tim Hunt
              Tester:
              Petr Skoda
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: