Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-36668 - mod/data: Removed duplicate data_content join in simple s…

…earches.

Thanks to Patrick Pollet (patrick.pollet@insa-lyon.fr) for his patch
  • Loading branch information...
commit 92aa8fe491939360e448d031ec30169b701dc4c2 1 parent 6548ce0
@abgreeve abgreeve authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 mod/data/view.php
View
10 mod/data/view.php
@@ -518,7 +518,7 @@
$what = ' DISTINCT r.id, r.approved, r.timecreated, r.timemodified, r.userid, u.firstname, u.lastname';
$count = ' COUNT(DISTINCT c.recordid) ';
- $tables = '{data_content} c,{data_records} r, {data_content} cs, {user} u ';
+ $tables = '{data_content} c,{data_records} r, {user} u ';
$where = 'WHERE c.recordid = r.id
AND r.dataid = :dataid
AND r.userid = u.id ';
@@ -549,8 +549,7 @@
$advparams = array_merge($advparams, $val->params);
}
} else if ($search) {
- $where .= ' AND cs.recordid = r.id ';
- $searchselect = " AND (".$DB->sql_like('cs.content', ':search1', false)." OR ".$DB->sql_like('u.firstname', ':search2', false)." OR ".$DB->sql_like('u.lastname', ':search3', false)." ) ";
+ $searchselect = " AND (".$DB->sql_like('c.content', ':search1', false)." OR ".$DB->sql_like('u.firstname', ':search2', false)." OR ".$DB->sql_like('u.lastname', ':search3', false)." ) ";
$params['search1'] = "%$search%";
$params['search2'] = "%$search%";
$params['search3'] = "%$search%";
@@ -565,7 +564,7 @@
$what = ' DISTINCT r.id, r.approved, r.timecreated, r.timemodified, r.userid, u.firstname, u.lastname, ' . $sortcontentfull . ' AS sortorder ';
$count = ' COUNT(DISTINCT c.recordid) ';
- $tables = '{data_content} c, {data_records} r, {data_content} cs, {user} u ';
+ $tables = '{data_content} c, {data_records} r, {user} u ';
$where = 'WHERE c.recordid = r.id
AND r.dataid = :dataid
AND r.userid = u.id ';
@@ -599,8 +598,7 @@
$advparams = array_merge($advparams, $val->params);
}
} else if ($search) {
- $where .= ' AND cs.recordid = r.id ';
- $searchselect = " AND (".$DB->sql_like('cs.content', ':search1', false)." OR ".$DB->sql_like('u.firstname', ':search2', false)." OR ".$DB->sql_like('u.lastname', ':search3', false)." ) ";
+ $searchselect = " AND (".$DB->sql_like('c.content', ':search1', false)." OR ".$DB->sql_like('u.firstname', ':search2', false)." OR ".$DB->sql_like('u.lastname', ':search3', false)." ) ";
$params['search1'] = "%$search%";
$params['search2'] = "%$search%";
$params['search3'] = "%$search%";
Please sign in to comment.
Something went wrong with that request. Please try again.