enrol-users MDL-24618 Enrol users search now concats firstname and lastname as reques...
authorSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 01:49:58 +0000 (01:49 +0000)
committerSam Hemelryk <sam@moodle.com>
Thu, 11 Nov 2010 01:49:58 +0000 (01:49 +0000)
enrol/ajax.php
enrol/locallib.php

index 81c0ede..44db515 100644 (file)
@@ -126,7 +126,7 @@ switch ($action) {
         $enrolid = required_param('enrolid', PARAM_INT);
         $search  = optional_param('search', '', PARAM_RAW);
         $page = optional_param('page', 0, PARAM_INT);
-        $outcome->response = $manager->get_potential_users($enrolid, $search, false, $page);
+        $outcome->response = $manager->get_potential_users($enrolid, $search, true, $page);
         foreach ($outcome->response['users'] as &$user) {
             $user->picture = $OUTPUT->user_picture($user);
             $user->fullname = fullname($user);
index 54c6b6e..4f1669c 100644 (file)
@@ -263,7 +263,10 @@ class course_enrolment_manager {
         $tests = array("id <> :guestid", 'u.deleted = 0', 'u.confirmed = 1');
         $params = array('guestid' => $CFG->siteguest);
         if (!empty($search)) {
-            $conditions = array('u.firstname','u.lastname');
+            $conditions = array(
+                $DB->sql_concat('u.firstname', "' '", 'u.lastname'),
+                'u.email'
+            );
             if ($searchanywhere) {
                 $searchparam = '%' . $search . '%';
             } else {