Moodle
  1. Moodle
  2. MDL-14770

Global search: Error if I search as teacher of a course

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.8.6, 1.9.1, 2.0
    • Component/s: Global search
    • Labels:
      None
    • Environment:
      linux server
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      30924

      Description

      If I search as teacher the following error messages appear in front of the search results. If I search as student or as admin no error messages.
      -------------------------------------------------------------------------------------

      Notice: Undefined variable: course in /usr/local/httpd/www.moodle.alte-kanti-aarau.ch/maksa/search/querylib.php on line 398

      Notice: Trying to get property of non-object in /usr/local/httpd/www.moodle.alte-kanti-aarau.ch/maksa/search/querylib.php on line 398
      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND c.id !=1 LIMIT 1' at line 5

      SELECT ctx.path, ctx.depth FROM mdl_context ctx JOIN mdl_course c ON (c.category=ctx.instanceid AND ctx.contextlevel=40) WHERE c.id= AND c.id !=1

      • line 686 of lib/dmllib.php: call to debugging()
      • line 481 of lib/dmllib.php: call to get_recordset_sql()
      • line 2028 of lib/accesslib.php: call to get_record_sql()
      • line 2395 of lib/accesslib.php: call to create_context()
      • line 398 of search/querylib.php: call to get_context_instance()
      • line 263 of search/querylib.php: call to SearchQuery->can_display()
      • line 302 of search/querylib.php: call to SearchQuery->process_results()
      • line 200 of search/querylib.php: call to SearchQuery->get_results()
      • line 179 of search/querylib.php: call to SearchQuery->set_query()
      • line 137 of search/query.php: call to SearchQuery->__construct()

      Error: could not insert new context level "50", instance "".

      • line 2119 of lib/accesslib.php: call to debugging()
      • line 2395 of lib/accesslib.php: call to create_context()
      • line 398 of search/querylib.php: call to get_context_instance()
      • line 263 of search/querylib.php: call to SearchQuery->can_display()
      • line 302 of search/querylib.php: call to SearchQuery->process_results()
      • line 200 of search/querylib.php: call to SearchQuery->get_results()
      • line 179 of search/querylib.php: call to SearchQuery->set_query()
      • line 137 of search/query.php: call to SearchQuery->__construct()

      Incorrect context specified

      • line 350 of lib/accesslib.php: call to debugging()
      • line 398 of search/querylib.php: call to has_capability()
      • line 263 of search/querylib.php: call to SearchQuery->can_display()
      • line 302 of search/querylib.php: call to SearchQuery->process_results()
      • line 200 of search/querylib.php: call to SearchQuery->get_results()
      • line 179 of search/querylib.php: call to SearchQuery->set_query()
      • line 137 of search/query.php: call to SearchQuery->__construct()

      Moodle

      *
      (Unterlagen Betriebswirtschaft)

      Sie sind hier

      • Moodle LMS AKSA
      • / ? Suchen
      • / ? Tragen Sie Ihre Suchanfrage ein

      Tragen Sie Ihre Suchanfrage ein
      Erweiterte Suche | Statistiken

      Suche in ...1549 Dokumente.

      5 Ergebnisse für 'Wirtschaft'.

      2. Portale mit Links von Cyrill
      http://www.moodle.alte-kanti-aarau.ch/maksa/mod/resource/view.php?id=6...
      Typ: resource, Punkte: 0.48
      4. Brand Rivella hat ein gutes Image
      http://www.moodle.alte-kanti-aarau.ch/maksa/mod/resource/view.php?id=7...
      Typ: resource, Punkte: 0.336
      5. Folien zur Verschuldung
      http://www.moodle.alte-kanti-aarau.ch/maksa/mod/resource/view.php?id=2...
      Typ: resource, Punkte: 0.192
      7. Neuerungen 05/06 im Gesellschaftsrecht
      http://www.moodle.alte-kanti-aarau.ch/maksa/mod/resource/view.php?id=1...
      Typ: resource, Punkte: 0.052
      8. Lehrheft Recht und Wirtschaft V04 Schatzverlag
      http://www.moodle.alte-kanti-aarau.ch/maksa/mod/resource/view.php?id=1...
      Typ: resource, Punkte: 0.021

        Activity

        Hide
        Valery Fremaux added a comment -

        Thanks Juerg, very easy to fix :

        go to line §398 and change $course->id into $course_id

        I fix it in all versions.

        Show
        Valery Fremaux added a comment - Thanks Juerg, very easy to fix : go to line §398 and change $course->id into $course_id I fix it in all versions.
        Hide
        Valery Fremaux added a comment -

        Change $course->id to $course_id

        Show
        Valery Fremaux added a comment - Change $course->id to $course_id
        Hide
        Juerg Hoerner added a comment - - edited

        Thanks. merci beaucoup.

        Show
        Juerg Hoerner added a comment - - edited Thanks. merci beaucoup.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: