|
From: Ken T. <ke...@us...> - 2003-07-23 01:22:19
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv23265
Modified Files:
CHANGELOG query.php
Log Message:
Added additional-comments searching support.
Fixes RFE 722667 and many many more!
- ken
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/phpbt/phpbt/CHANGELOG,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- CHANGELOG 9 Apr 2003 12:41:30 -0000 1.66
+++ CHANGELOG 23 Jul 2003 01:22:12 -0000 1.67
@@ -11,6 +11,7 @@
: Added ability to disable all email sent from the system.
: Fixed a bug with not being able to change the name of the 'Developer' group.
: Added tracking of changes in priority to the bug history.
+: You can now search on "additional comments" and "description".
-- 0.9.1 -- 4 Jan 2003
: Fixed bugs with PostgreSQL
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- query.php 13 Jul 2003 14:22:42 -0000 1.97
+++ query.php 23 Jul 2003 01:22:12 -0000 1.98
@@ -123,8 +123,14 @@
$query[] = '('.@join(' and ',$equery).')';
}
+ // Search for additional comments with 'description'
+ $bugs_with_comment = array();
+ foreach ($db->getAll('SELECT bug_id FROM '.TBL_COMMENT.' WHERE comment_text LIKE \'%'.$description.'%\'') as $row) {
+ $bugs_with_comment[] = $row['bug_id'];
+ }
+
// Text search field(s)
- foreach(array('title','description','url') as $searchfield) {
+ foreach(array('title','url') as $searchfield) {
if (!empty($$searchfield)) {
switch (${$searchfield."_type"}) {
case 'like' : $cond = "like '%".$$searchfield."%'"; break;
@@ -133,6 +139,14 @@
}
$fields[] = "$searchfield $cond";
}
+ }
+ if (!empty($description)) {
+ switch($description_type) {
+ case 'like' : $cond = 'like \'%'.$description.'%\''; break;
+ case 'rlike' : $cond = 'rlike \''.$description.'\''; break;
+ case 'not rlike' : $cond = 'not rlike \''.$description.'\'';
+ }
+ $fields[] = '(description '.$cond.(count($bugs_with_comment) ? ' OR bug_id = '.join(' OR bug_id = ', $bugs_with_comment):'').')';
}
if (!empty($fields)) $query[] = '('.@join(' and ',$fields).')';
|