Page 1 of 1

Add Show Ticket Variables [Solved]

Posted: Fri May 04, 2012 9:25 pm
by steve
Hi,

I am trying to add a field to show_search_form_inc.

In the show ticket form, I want to check a box and click show tickets. I want it to show all tickets where custom10 =1.

Im note sure the code necessary to accomplish this. I want it similar to the code below, when I select this I will see only tickets with status 5.

Code: Select all

<td width="33%"><label><input type="checkbox" name="s5" value="1" <?php if (isset($status[5])) {echo 'checked="checked"';} ?>  /> <span class="onhold"><?php echo $hesklang['on_hold']; ?></span></td>

Re: Help with show_search_form_inc

Posted: Sat May 05, 2012 6:05 am
by Klemen
Sorry, but this is another "out of my scope of support" question.

You would have to modify several files in several places (ticket_list.inc.php, print_tickets.inc.php,...)

Re: Help with show_search_form_inc

Posted: Sat May 05, 2012 7:01 am
by steve
Fair enough. Thanks!

Re: Help with show_search_form_inc

Posted: Sat Jun 02, 2012 6:19 pm
by steve
I am stumped, can you give me a hint?

Are the only files that need modification ticket_list.inc.php, print_tickets.inc.php and show_search_form.inc.php?

Re: Help with show_search_form_inc

Posted: Mon Jun 04, 2012 5:37 pm
by Klemen
See how the "Show only tagged tickets" switch works - yours would probably be very similar.

For starters, try you can try changing

Code: Select all

`archive`=\'1\'
to

Code: Select all

`custom10`=\'1\'
in print_tickets.inc.php and see if selecting "Show tagged only" lists tickets with custom10 set to 1, then work from there.

Re: Help with show_search_form_inc

Posted: Mon Jun 04, 2012 7:03 pm
by steve
Thank you so much. That is exactly what I needed.

On the show tickets portion of the main page, there is a ""Billable" heading with a check box that says "Display only Billable Tickets" When this checkbox is selected, only tickets with the custom10 field value of "Yes" will be shown.

For thoes that are interested this is exactly what I modified.

In Show_search_form.inc.php I added

Code: Select all

<tr>
<td class="borderTop"><b>Billable</b>: &nbsp;</td>
<td class="borderTop"><label><input type="checkbox" name="billable" value="1" <?php if ($billable[1]) echo 'checked="checked"'; ?> /> Display Billable Tickets Only</label></td>
<td width="33%">&nbsp;</td>
</tr>
Under

Code: Select all

<td width="33%">&nbsp;</td>
</tr>
<tr>
<td width="34%"><label><input type="radio" name="g" value="category" <?php if ($group == 'category') {echo 'checked="checked"';} ?> /> <?php echo $hesklang['category']; ?></label></td>
<td width="33%">&nbsp;</td>
</tr>
</table>
</td>
In Print_tickets.inc.php

I changed

Code: Select all

/* Archived */
if (!empty($_GET['archive']))
{
    $archive[1]=1;
    $sql .= '`archive`=\'1\' AND ';
}
To

Code: Select all

/* Billable */
if (!empty($_GET['billable']))
{
    $billable[1]=1;
    $sql .= '`custom10`=\'Yes\' AND ';
}