Normal ticket workflow need more statuses than we have now:
1. Reporter creates new ticket, with status "Open".
2. Developer start working on ticked and change its status to "Processing"
3. Work complete - at this moment developer change ticket status to "Fixed".
4. Reporter check "fixed" ticket and change its status either to "Close" (when problem is solved) or to "Open" (in other case).
So we obviously need additional ticket status - "fixed", placed just between "Processing" and "Close".
How to:
=====
Simple patch, involves three files from directory "/modules/ticketsmith"
1. /modules/ticketsmith/config.inc.php
------------------------------------------
Add two definitions to end of file
$CONFIG["types"] = array("My","Open","Processing","Fixed","Closed","Deleted","All");
$CONFIG["type_names"] = array(
"Open" =>$AppUI->_("Open")
, "Processing" => $AppUI->_("Processing")
, "Fixed" => $AppUI->_("Fixed")
, "Closed" => $AppUI->_("Closed")
, "Deleted" => $AppUI->_("Deleted")
);
2. /modules/ticketsmith/common.inc.php
---------------------------------------------
Two patches:
Replace operator
$output = create_selectbox("type_toggle", array("Open" =>$AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
by this:
$output = create_selectbox(
"type_toggle"
, $CONFIG["type_names"]
, $value
);
Replace operator
$output = chooseSelectedValue("type_toggle", array("Open" =>$AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
by this:
$output = chooseSelectedValue(
"type_toggle"
, $CONFIG["type_names"]
, $value
);
3. /modules/ticketsmith/index.php
--------------------------------------
Some visual improvements, many changes. I place entire index.php into next message. Replace original index.php.
<?php /* TICKETSMITH $Id: index.php,v 1.23.10.3 2007/04/12 21:27:26 caseydk Exp $ */
if (!defined('DP_BASE_DIR')){
die('You should not access this file directly.');
}
if (!$canAccess) {
$AppUI->redirect( "m=public&a=access_denied" );
}
// setup the title block
$titleBlock = new CTitleBlock( 'Trouble Ticket Management', 'gconf-app-icon.png', $m, "$m.$a" );
if ($canEdit) {
$titleBlock->addCell(
'<input type="submit" class="button" value="'.$AppUI->_('new ticket').'">', '',
'<form name="ticketform" action="?m=ticketsmith&a=post_ticket" method="post">', '</form>'
);
}
$titleBlock->show();
require(DP_BASE_DIR.'/modules/ticketsmith/config.inc.php');
require(DP_BASE_DIR.'/modules/ticketsmith/common.inc.php');
$column = $CONFIG["order_by"];
$direction = $CONFIG["message_order"];
$offset = 0;
$limit = $CONFIG["view_rows"];
$type = dPgetParam( $_GET, 'type', '' );
$column = dPgetParam( $_GET, 'column', $column);
$direction = dPgetParam( $_GET, 'direction', $direction);
$offset = dPgetParam( $_GET, 'offset', $offset);
$action = dPgetParam( $_REQUEST, 'action', null );
if($type == ''){
if($AppUI->getState("ticket_type")){
$type = $AppUI->getState("ticket_type");
} else {
$type = "Open";
}
} else {
$AppUI->setState("ticket_type", $_GET["type"]);
}
/* expunge deleted tickets */
if (@$action == "expunge") {
$deleted_parents = column2array("SELECT ticket FROM tickets WHERE type = 'Deleted'");
for ($loop = 0; $loop < count($deleted_parents); $loop++) {
do_query("DELETE FROM tickets WHERE ticket = '$deleted_parents[$loop]'");
do_query("DELETE FROM tickets WHERE parent = '$deleted_parents[$loop]'");
}
}
/* setup table & database field stuff */
if ($dPconfig['link_tickets_kludge']) {
$fields = array("headings" => array("View", "Author", "Subject", "Date",
"Followup", "Status", "Priority", "Owner", "Link"),
"columns" => array("ticket", "author", "subject", "timestamp",
"activity", "type", "priority", "assignment", "ticket"),
"types" => array("view", "email", "normal", "open_date",
"activity_date", "normal", "priority_view", "user", "attach"),
"aligns" => array("center", "left", "left", "left", "left",
"center", "center", "center", "center"));
} else {
$fields = array("headings" => array("View", "Author", "Subject", "Date",
"Followup", "Status", "Priority", "Owner"),
"columns" => array("ticket", "author", "subject", "timestamp",
"activity", "type", "priority", "assignment"),
"types" => array("view", "email", "normal", "open_date",
"activity_date", "normal", "priority_view", "user"),
"aligns" => array("center", "left", "left", "left", "left",
"center", "center", "center"));
}
/* set up defaults for viewing */
if($type == "my"){
$title = "My Tickets";
}
else{
$title = "$type Tickets";
}
/* count tickets */
$query = "SELECT COUNT(*) FROM tickets WHERE parent = '0'";
if ($type != 'All') {
$query .= " AND type = '$type'";
}
$ticket_count = query2result($query);
/* paging controls */
if (($offset + $limit) < $ticket_count) {
$page_string = ($offset + 1) . " to " . ($offset + $limit) . " of $ticket_count";
}
else {
$page_string = ($offset + 1) . " to $ticket_count of $ticket_count";
}
/* form query */
$select_fields= join(", ", $fields["columns"]);
$query = "SELECT $select_fields FROM tickets WHERE ";
if ($type == "My") {
$query .= "type = 'Open' AND (assignment = '$AppUI->user_id' OR assignment = '0') AND ";
}
elseif ($type != "All") {
$query .= "type = '$type' AND ";
}
$query .= "parent = '0' ORDER BY " . urlencode($column) . " $direction LIMIT $offset, $limit";
/* do query */
$result = do_query($query);
$parent_count = number_rows($result);
/* start table */
?>
<table class="tbl" width="100%">
<?php show_filter_bar(); ?>
<tr>
<td colspan="<?php echo count( $fields["headings"] );?>" align="center">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="33%"></td>
<td width="34%" align="center"><strong><?php echo $AppUI->_($title);?></strong></td>
<td width="33%" align="right" valign="middle">
<?php
if ($ticket_count > $limit) {
if ($offset - $limit >= 0) {
print("<a href=index.php?m=ticketsmith&type=$type&column=$column&direction=$direction&offset=" . ($offset - $limit) . "><img src=images/navleft.gif border=0></a> | \n");
}
print($AppUI->_("$page_string")."\n");
if ($offset + $limit < $ticket_count) {
print(" | <a href=index.php?m=ticketsmith&type=$type&column=$column&direction=$direction&offset=" . ($offset + $limit) . "><img src=images/navright.gif border=0></a>\n");
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
<?php
/* output tickets */
if ($parent_count) {
print("<tr>\n");
for ($loop = 0; $loop < count($fields["headings"]); $loop++) {
print("<th align=" . $fields["aligns"][$loop] . ">");
print("<a href=index.php?m=ticketsmith&type=$type");
print("&column=" . $fields["columns"][$loop]);
if ($column != $fields["columns"][$loop]) {
$new_direction = "ASC";
}
else {
if ($direction == "ASC") {
$new_direction = "DESC";
}
else {
$new_direction == "ASC";
}
}
print("&direction=$new_direction");
print(' class="hdr">' . $AppUI->_($fields["headings"][$loop]) . "</a></th>\n");
}
print("</tr>\n");
while ($row = result2hash($result)) {
print("<tr height=25>\n");
for ($loop = 0; $loop < count($fields["headings"]); $loop++) {
print("<td bgcolor=white align=" . $fields["aligns"][$loop] . ">\n");
//translate some information, some not
if ($fields["headings"][$loop] == "Status"){
print($AppUI->_(format_field($row[$fields["columns"][$loop]], $fields["types"][$loop], $row[$fields["columns"][0]])) . "\n");
}
else {
print(format_field($row[$fields["columns"][$loop]], $fields["types"][$loop], $row[$fields["columns"][0]]) . "\n");
}
print("</td>\n");
}
print("</tr>\n");
}
}
else {
print("<tr height=25>\n");
print("<td align=center colspan=" . count($fields["headings"]) . ">\n");
print($AppUI->_('There are no')." ");
print($type == "All" ? "" : strtolower($AppUI->_($type)) . " ");
print($AppUI->_('tickets').".\n");
print("</td>\n");
print("</tr>\n");
}
show_filter_bar();
/* end table */
print("</table>\n");
/* output action links */
function show_filter_bar() {
global $CONFIG;
global $AppUI;
global $fields;
global $parent_count;
global $type;
$colspan = count($fields["headings"]) - 1;
foreach( $CONFIG["types"] as $t ) {
$toggles[] = "<a href=index.php?m=ticketsmith&type=$t>{$AppUI->_($t)}</a>";
}
$menuline = join(" | ", $toggles);
$menuline .= " ".$AppUI->_('Tickets');
$expunge =
($type == "Deleted" && $parent_count)
? "<a href=index.php?m=ticketsmith&type=Deleted&action=expunge>{$AppUI->_('Expunge Deleted')}</a>"
: ""
;
echo <<<XXX
<tr><td><br /></td><td colspan = "$colspan" align = "right">
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr height=25><td align=left>$menuline</td><td align=center>$expunge</td>
<td align=right>
<a href='index.php?m=ticketsmith&a=pdf&type=$type&suppressHeaders=1'>{$AppUI->_('Report as PDF')}</a>
| <a href=index.php?m=ticketsmith&a=search>{$AppUI->_('Search')}</a>
</td>
</tr>
</table>
</td></tr>
XXX;
} // function show_filter_bar()
?>
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.