Skip to content
Snippets Groups Projects
Commit f0dd0f83 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #72 from greezybacon/feature/ticket-event-annul

Add support for marking previous events as annulled

Reviewed By: Peter Rotich 04/23/12
parents 611f3f84 f13d62bd
No related branches found
No related tags found
No related merge requests found
......@@ -802,7 +802,7 @@ class Ticket{
//TODO: log reopen event here
$this->logEvent('reopened');
$this->logEvent('reopened', 'closed');
return (db_query($sql) && db_affected_rows());
}
......@@ -1463,13 +1463,21 @@ class Ticket{
}
// History log -- used for statistics generation (pretty reports)
function logEvent($state, $staff=null) {
function logEvent($state, $annul=null, $staff=null) {
global $thisstaff;
if ($staff === null) {
if ($thisstaff) $staff=$thisstaff->getUserName();
else $staff='SYSTEM'; # XXX: Security Violation ?
}
# Annul previous entries if requested (for instance, reopening a
# ticket will annul an 'closed' entry). This will be useful to
# easily prevent repeated statistics.
if ($annul) {
db_query('UPDATE '.TICKET_EVENT_TABLE.' SET annulled=1'
.' WHERE ticket_id='.db_input($this->getId())
.' AND state='.db_input($annul));
}
return db_query('INSERT INTO '.TICKET_EVENT_TABLE
.' SET ticket_id='.db_input($this->getId())
......
......@@ -55,7 +55,7 @@
#Current version && schema signature (Changes from version to version)
define('THIS_VERSION','1.7-DPR2'); //Shown on admin panel
define('SCHEMA_SIGNATURE','abe9c0cb845be52c10fcd7b3e626a589'); //MD5 signature of the db schema. (used to trigger upgrades)
define('SCHEMA_SIGNATURE','bbb021fbeb377ca66b6997b77e0167cc'); //MD5 signature of the db schema. (used to trigger upgrades)
#load config info
$configfile='';
......
/**
* Add an 'annulled' column to the %ticket_event table to assist in tracking
* real statistics for reopened and closed tickets -- the events should not
* count more than one time.
*
* @version 1.7-dpr3 ticket-event-annul
*/
ALTER TABLE `%TABLE_PREFIX%ticket_event`
ADD `annulled` tinyint(1) NOT NULL DEFAULT '0' AFTER `staff`;
-- Finished with patch
UPDATE `%TABLE_PREFIX%config`
SET `schema_signature`='bbb021fbeb377ca66b6997b77e0167cc';
......@@ -615,6 +615,7 @@ CREATE TABLE `%TABLE_PREFIX%ticket_event` (
`topic_id` int(11) unsigned NOT NULL,
`state` enum('created','closed','reopened','assigned','transferred','overdue') NOT NULL,
`staff` varchar(255) NOT NULL default 'SYSTEM',
`annulled` tinyint(1) unsigned NOT NULL defalt '0',
`timestamp` datetime NOT NULL,
KEY `ticket_state` (`ticket_id`, `state`, `timestamp`),
KEY `ticket_stats` (`timestamp`, `state`)
......
abe9c0cb845be52c10fcd7b3e626a589
bbb021fbeb377ca66b6997b77e0167cc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment