@[deleted]its works fine before this step here. but after this it font show any ticket any more. This part here is breaks it for me. Ticket Status (Custom Mod)The ticket status mod is a little more in-depth to get the status to view on the queue. For this one, we need to add a bit of PHP to grab information that we have saved in the CONFIG table (the field that holds the status), then we need to update the $qselect and the $qfrom statements.
I recommend finding the statements that look like this:$qselect ='SELECT ticket.ticket_id,lock_id,`number`,ticket.dept_id,ticket.staff_id,ticket.team_id '
.' ,user.name'
.' ,email.address as email, dept_name '
.' ,ticket.status,ticket.source,isoverdue,isanswered,ticket.created ';
$qfrom=' FROM '.TICKET_TABLE.' ticket '.
' LEFT JOIN '.USER_TABLE.' user ON user.id = ticket.user_id'.
' LEFT JOIN '.USER_EMAIL_TABLE.' email ON user.id = email.user_id'.
' LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id ';
And replace them with these statements:
$qstatus = 'SELECT value FROM '.CONFIG_TABLE.' WHERE namespace="module" AND `key`="status_field"';
$res = db_query($qstatus);
list($val)=db_fetch_row($res);
$qselect ='SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,ticket.team_id '
.' ,user.name'
.' ,email.address as email, dept_name '
.' ,ticket.status,ticket.source,isoverdue,isanswered,ticket.created '
.' ,IFNULL(at.value, "No Status") as modstatus';
$qfrom= ' FROM '.TICKET_TABLE.' ticket'.
' LEFT JOIN '.USER_TABLE.' user ON user.id = ticket.user_id'.
' LEFT JOIN '.USER_EMAIL_TABLE.' email ON user.id = email.user_id'.
' LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.FORM_ENTRY_TABLE.' et ON et.object_id=ticket.ticket_id AND et.object_type="T"'.
' LEFT JOIN '.FORM_ANSWER_TABLE.' at ON at.entry_id=et.id AND at.field_id='.$val;
Notice, I did a couple of things here. First, I told the system to look and see if at.value (the status) was null, and if it was, instead save "No Status". This will display in your ticket view for any ticket created pre-implementation of this mod. Second, on the LEFT JOINs, I included the ENTRY_TABLE, but only for those rows with the object_type of T (those entries are the only ones that hold custom field data), and for the ANSWER_TABLE I told it to grab only those with fields that equal my stored value (which was grabbed by the first couple lines of this addition). This way, I grab the ticket status, but if one does not exist, I still display something.
Finally, we have to modify that <td></td> in the row data. In between this element, add the following code: <?php echo $row;?>
This should make it look like this:
<td><?php echo $row;?></td>here you can see what i have done in the filetickets.inc.php