While this MOD did most of what I wanted it did not auto assign for client web based tickets. After looking at the code and trial and error I have auto assign working for client web based tickets.
Here is everything I did.
Modified the rules.php and add_rule.php to use help topics in the system.
Modified the code in class.ticket.php to look for web based tickets.
Modifying the rules.php file.
Original MOD code
<td align="center"><strong>Category</strong></td>
<td align="center"><strong>Contains</strong></td>
<td align="center"><strong>Assign To</strong></td>
My change
<td align="center"><strong>Category</strong></td>
<td align="center"><strong>Help Topic</strong></td>
<td align="center"><strong>Assign To</strong></td>
Original MOD Code
<select name="Category"><option value="subject" <? if($rows == "subject"){print "SELECTED";}?>>Subject</option><option value="email" <? if($rows == "email"){print "SELECTED";}?>>Email</option></select>
My Change
<select name="Category"><option value="web" <? if($rows == "web"){print "SELECTED";}?>>Web</option><option value="subject" <? if($rows == "subject"){print "SELECTED";}?>>Subject</option><option value="email" <? if($rows == "email"){print "SELECTED";}?>>Email</option></select>
Changes to the add_rule.php file.
Original MOD code
<td align="center"><strong>Category</strong></td>
<td align="center"><strong>Contains</strong></td>
<td align="center"><strong>Assign To</strong></td>
My change
<td align="center"><strong>Category</strong></td>
<td align="center"><strong>Help Topic</strong></td>
<td align="center"><strong>Assign To</strong></td>
Original MOD code
<input name="Criteria" type="text" id="Criteria">
My Change
<select name="Criteria">
<option value=0> </option>
<?
$topics= db_query('SELECT topic_id,topic FROM '.TOPIC_TABLE.'');
while (list($topicId,$topicName) = db_fetch_row($topics)){?>
<option value="<?=$topicName?>" ><?=$topicName?></option>
<?}?>
</select>
The changes above renamed my cell titles and populated my criteria with help topics.
Changes to the /include/class.ticket.php file.
Orignal MOD code
$subject=(Format:($var));
$email=($var);
$qry = sprintf("SELECT * FROM ost_ticket_rules;");
My Changes
$subject=(Format:($var));
$email=($var);
// add web selection
$web=(Format:($topicDesc));
// End
$qry = sprintf("SELECT * FROM ost_ticket_rules;");
Original MOD code
if( "$isenabled" == "on" )
{
if( "$Category" == "subject" )
{
if (preg_match("/$Criteria/i", $subject))
{
if( "$Action" == "deptId" )
{
$deptId=$Department;
}
elseif( "$Action" == "staffId" )
{
$staffId=$Staff;
$staffId=preg_replace( '/\n/', '', trim($staffId) );
$qry = sprintf("SELECT dept_id FROM `ost_staff` WHERE staff_id=$Staff;");
$result=mysql_query($qry);
while ( $row = mysql_fetch_assoc($result)){
$deptId=$row;
}
}
}
}
My Changes
if( "$isenabled" == "on" )
{
// Add web check
if( "$Category" == "web" )
{
if (preg_match("/$Criteria/i", $web))
{
if( "$Action" == "deptId" )
{
$deptId=$Department;
}
elseif( "$Action" == "staffId" )
{
$staffId=$Staff;
$staffId=preg_replace( '/\n/', '', trim($staffId) );
$qry = sprintf("SELECT dept_id FROM `ost_staff` WHERE staff_id=$Staff;");
$result=mysql_query($qry);
while ( $row = mysql_fetch_assoc($result)){
$deptId=$row;
}
}
}
}
// End
elseif( "$Category" == "subject" ) //orignal start of the "if" statment.
I also had to change this line because I am running version 1.6ST
// Pre 1.6ST ',topic='.db_input(Format:($topicDesc)).
',helptopic='.db_input(Format:($topicDesc)).
Now all client web tickets auto assign. now I have only one more thing to add and that is a priority for each rule. Help topic X get a priority of high while help topic Y gets a priority of normal and so on. I know it can be done, but how.
I don't think I missed any of my changes. I am sure someone will post if I did. :)
This is a great MOD!
ZeroEffect