Revision: 1384
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1384&view=rev
Author:   cimorrison
Date:     2010-07-25 18:20:58 +0000 (Sun, 25 Jul 2010)

Log Message:
-----------
Added support for custom fields to Search

Modified Paths:
--------------
    mrbs/branches/custom_entry_fields/web/search.php

Modified: mrbs/branches/custom_entry_fields/web/search.php
===================================================================
--- mrbs/branches/custom_entry_fields/web/search.php    2010-07-25 17:45:11 UTC 
(rev 1383)
+++ mrbs/branches/custom_entry_fields/web/search.php    2010-07-25 18:20:58 UTC 
(rev 1384)
@@ -66,11 +66,25 @@
     
 $sql_pred = "( " . sql_syntax_caseless_contains("E.create_by", $search_str)
   . " OR " . sql_syntax_caseless_contains("E.name", $search_str)
-  . " OR " . sql_syntax_caseless_contains("E.description", $search_str)
-  . ") AND E.end_time > $now";
+  . " OR " . sql_syntax_caseless_contains("E.description", $search_str);
 
+// Also need to search custom fields (but only those with character data)
+$fields = sql_field_info($tbl_entry);
+foreach ($fields as $field)
+{
+  if (!in_array($field['name'], $standard_fields['entry']))
+  {
+    if ($field['nature'] == 'character')
+    {
+      $sql_pred .= " OR " . sql_syntax_caseless_contains("E." . 
$field['name'], $search_str);
+    }
+  }
+}
+
+$sql_pred .= ") AND E.end_time > $now";
 $sql_pred .= " AND E.room_id = R.id AND R.area_id = A.id";
 
+
 // If we're not an admin (they are allowed to see everything), then we need
 // to make sure we respect the privacy settings.  (We rely on the privacy 
fields
 // in the area table being not NULL.   If they are by some chance NULL, then no


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to