Moodle
  1. Moodle
  2. MDL-27755

Course search does not include idnumber or shortname

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1, 2.2
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Libraries
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      1. login as admin
      2. from side block, site admin > courses > add/edit courses
      3. select course categories
      4. list of courses will be display and search courses input box should be display under re-sort and add new course button.

      search a course by name, id or shortname.

      Note: search text must contains at least 2 characters.

      Show
      1. login as admin 2. from side block, site admin > courses > add/edit courses 3. select course categories 4. list of courses will be display and search courses input box should be display under re-sort and add new course button. search a course by name, id or shortname. Note: search text must contains at least 2 characters.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      17412

      Description

      The latest get_courses_search() does not search the idnumber or shortname.

      Around line 720 in /lib/datalib.php

      Replace

          $concat = $DB->sql_concat('c.summary', "' '", 'c.fullname');
      

      With

          $concat = $DB->sql_concat('c.summary', "' '", 'c.fullname', "' '",'c.idnumber', "' '", 'c.shortname');
      

      Similar issue reported and fixed for 1.9: MDL-19078

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          I've put it on our backlog and we'll try to get to it as soon as we can.

          In the meantime adding more information, such as replication instructions and/or fix test instructions, will help us and other users.

          Show
          Michael de Raadt added a comment - Thanks for reporting this. I've put it on our backlog and we'll try to get to it as soon as we can. In the meantime adding more information, such as replication instructions and/or fix test instructions, will help us and other users.
          Hide
          Rajesh Taneja added a comment -

          Works as expected.
          Great work

          Show
          Rajesh Taneja added a comment - Works as expected. Great work
          Hide
          Rossiani Wijaya added a comment -

          Thanks Raj for reviewing.

          Submitting for integration.

          Show
          Rossiani Wijaya added a comment - Thanks Raj for reviewing. Submitting for integration.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Sam Hemelryk added a comment -

          Congratulations - this fix has just been released in the weeklies.

          Show
          Sam Hemelryk added a comment - Congratulations - this fix has just been released in the weeklies.
          Hide
          Iñigo Zendegi added a comment -

          Hello everyone,

          I´ve seen that on Moodle 2.1.2+ (Build 20111019) this line has been changed,

          In 2.1.2 it was like this:

          $concat = $DB->sql_concat('c.summary', "' '", 'c.fullname', "' '",'c.idnumber', "' '", 'c.shortname');

          and in 2.1.2+ (Build 20111019) it is like that:

          $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');

          This change makes our Moodle fail because summary column datatype is clob and (at least in Oracle) coalesce parameters must be the same datatype. Anyway, that coalesce makes no sense for me as far as it makes no improvements.

          I don´t know how this works, if I have to add a new issue for this been solved please tell me.

          Thanks.

          Show
          Iñigo Zendegi added a comment - Hello everyone, I´ve seen that on Moodle 2.1.2+ (Build 20111019) this line has been changed, In 2.1.2 it was like this: $concat = $DB->sql_concat('c.summary', "' '", 'c.fullname', "' '",'c.idnumber', "' '", 'c.shortname'); and in 2.1.2+ (Build 20111019) it is like that: $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname'); This change makes our Moodle fail because summary column datatype is clob and (at least in Oracle) coalesce parameters must be the same datatype. Anyway, that coalesce makes no sense for me as far as it makes no improvements. I don´t know how this works, if I have to add a new issue for this been solved please tell me. Thanks.
          Hide
          Iñigo Zendegi added a comment -

          Sorry for posting here, I´ve seen later that this issue is because MDL-29496

          http://tracker.moodle.org/browse/MDL-29496

          Show
          Iñigo Zendegi added a comment - Sorry for posting here, I´ve seen later that this issue is because MDL-29496 http://tracker.moodle.org/browse/MDL-29496

            People

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

              Dates

              • Created:
                Updated:
                Resolved: