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

Lack of course category causes error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.1, 1.8
    • Fix Version/s: 1.8
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      If course categories haven't been setup print_courses causes a slightly unslightly error message as count(false) =1 in php

      To fix in 1.8:

      — lib.php.old 2007-02-07 13:04:31.000000000 +0000
      +++ lib.php 2007-02-07 13:05:11.000000000 +0000
      @@ -1627,7 +1627,7 @@

      if (empty($category)) {
      $categories = get_categories(0); // Parent = 0 ie top-level categories only

      • if (count($categories) == 1) {
        + if ($categories != null and count($categories) == 1) { $category = array_shift($categories); $courses = get_courses($category->id, 'c.sortorder ASC', 'c.id,c.category,c.sortorder,c.visible,c.fullname,c.shortna me,c.password,c.summary,c.teacher,c.cost,c.currency,c.enrol,c.guest'); }

        else {

        Attachments

          Activity

            People

            Assignee:
            poltawski Dan Poltawski
            Reporter:
            poltawski Dan Poltawski
            Tester:
            Nobody
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              31/Mar/07