Skip to content
Snippets Groups Projects
Commit cf38f653 authored by Jared Hancock's avatar Jared Hancock
Browse files

(Re)Add tracking of ticket history

Add a %ticket_history table to track ticket states over time, correlated to
the user account changing the ticket. Then, tickets are tracked to the table
when (re)opened, closed, overdue, transferred and assigned.
parent bec8de7e
Branches
Tags
No related merge requests found
......@@ -723,6 +723,7 @@ class Ticket{
$sql.=' WHERE ticket_id='.db_input($this->getId());
$this->track('closed');
return (db_query($sql) && db_affected_rows());
}
......@@ -736,6 +737,7 @@ class Ticket{
//TODO: log reopen event here
$this->track('reopened');
return (db_query($sql) && db_affected_rows());
}
......@@ -1044,6 +1046,7 @@ class Ticket{
$this->onOverdue($whine);
$this->track('overdue');
return true;
}
......@@ -1109,6 +1112,7 @@ class Ticket{
}
}
$this->track('transferred');
return true;
}
......@@ -1122,6 +1126,7 @@ class Ticket{
$this->onAssign($note, $alert);
$this->track('assigned');
return true;
}
......@@ -1140,6 +1145,7 @@ class Ticket{
$this->onAssign($note, $alert);
$this->track('assigned');
return true;
}
......@@ -1343,6 +1349,22 @@ class Ticket{
return $this->postNote($title,$note,false,'system');
}
// History log -- used for statistics generation (pretty reports)
function track($state, $staff=null) {
global $thisstaff;
if ($staff === null) {
if ($thisstaff) $staff=$thisstaff->getUserName();
else $staff='SYSTEM'; # XXX: Security Violation ?
}
return db_query('INSERT INTO '.TICKET_HISTORY_TABLE
.' SET ticket_id='.db_input($this->getId())
.', timestamp=NOW(), state='.db_input($state)
.', staff='.db_input($staff))
&& db_affected_rows() == 1;
}
//Insert Internal Notes
function postNote($title,$note,$alert=true,$poster='') {
global $thisstaff,$cfg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment