Custom Fields searching
Posted: Sat Jun 21, 2008 1:37 pm
/*************************************
Title: Custom Fields searching
Version: 0941
Author: Me
Demo: n/a
Download: n/a
Website: n/a
Short description: How to search on custom fields
*************************************/
The following shows how to search on a custom field, I wanted to search for custom1 which in my setup I have labeled as Domain.
1. Add the search field to the search form:
In the file \inc\show_search_form.inc.php replace the following (line 138):
with
2. In the file \find_tickets.php replace the following (line 74):
with
That's it. If you want you can also change the code that prints the results to include the custom search field as well.
Title: Custom Fields searching
Version: 0941
Author: Me
Demo: n/a
Download: n/a
Website: n/a
Short description: How to search on custom fields
*************************************/
The following shows how to search on a custom field, I wanted to search for custom1 which in my setup I have labeled as Domain.
1. Add the search field to the search form:
In the file \inc\show_search_form.inc.php replace the following (line 138):
Code: Select all
<tr>
<td class="white"><label><input type="radio" name="what" value="subject"> <b><?php echo $hesklang['subject']; ?></b></label>: </td>
<td class="white"><input type="text" name="subject" size="30" onFocus="Javascript:document.findby.what[3].checked=true;"></td>
</tr>
Code: Select all
<tr>
<td class="white"><label><input type="radio" name="what" value="subject"> <b><?php echo $hesklang['subject']; ?></b></label>: </td>
<td class="white"><input type="text" name="subject" size="30" onFocus="Javascript:document.findby.what[3].checked=true;"></td>
</tr>
<tr>
<td><label><input type="radio" name="what" value="custom1"> <b>Domain</b></label>: </td>
<td class="white"><input type="text" name="custom1" size="30" onFocus="Javascript:document.findby.what[4].checked=true;"></td>
</tr>
Code: Select all
case "subject":
$extra=hesk_input($_GET['subject'],$hesklang['enter_subject']);
$sql .= "`subject` LIKE '%$extra%' ";
break;
Code: Select all
case "subject":
$extra=hesk_input($_GET['subject'],$hesklang['enter_subject']);
$sql .= "`subject` LIKE '%$extra%' ";
break;
case "custom1":
$extra=hesk_input($_GET['custom1'],Domain);
$sql .= "`custom1` LIKE '%$extra%' ";
break;