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

Lack of course category causes error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.1, 1.8
    • 1.8
    • Course
    • None
    • MOODLE_17_STABLE, MOODLE_18_STABLE
    • 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

            poltawski Dan Poltawski
            poltawski Dan Poltawski
            Nobody Nobody
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              31/Mar/07