Add a float(4,2) field called 'time_spent' to the 'tickets' table.
In /include/staff/ticket-view.inc.php:
To display time spent when ticket is closed.
Find :
Close Date:
<?php echo Format:($ticket->getCloseDate()); ?>
replace with
Close Date:
<?php echo Format:($ticket->getCloseDate()); ?>
Time Spent:
<?php echo $ticket->getTimeSpent().''; // show the current time spent (if any) ?>
To input time:
find
if($dept && $dept->canAppendSignature()) { ?>
<?php echo ($info=='dept')?'checked="checked"':''; ?>>
Dept. Signature (<?php echo Format:($dept->getName()); ?>)
<?php
} ?>
And add the folowing after;
<?php /* Time Spent Start */
if($ticket->isOpen()) { ?>
Current Time Spent:
<?php echo $ticket->getTimeSpent().''; // show the current time spent (if any) ?>
Time Spent:
value="<?php if(isset($_POST)) echo $_POST;?>" />
(0.75 = 45 minutes)
<?php
/* time Spent End */ } ?>
in /include/class.ticket.php
find var $thread; //Thread obj.
insert var $timeSpent; // Time Spent Mod after
find $this->number = $this->ht;
insert $this->timeSpent = $this->ht; //Time spent mod after
find
function isOpen() {
return (strcasecmp($this->getStatus(),'Open')==0);
}
insert
function getTimeSpent(){
return $this->formatTime($this->timeSpent);
}
function formatTime($time){
if($time < 1){
$formatted = $time*60;
$formatted .= ' Minutes';
}else if ($time == 1){
$formatted = $time.' Hour';
}else{
$formatted = $time.' Hours';
}
return $formatted;
}
function timeSpent($time){
if(empty($time)){
$time = 0.00;
}else{
if(!is_numeric($time)){
$time = 0.25;
}else{
$time = round($time,2);
}
}
$sql = 'UPDATE '.TICKET_TABLE.' SET time_spent=time_spent+'.db_input($time).' WHERE ticket_id='.db_input($this->getId());
return (db_query($sql) && db_affected_rows())?true;
after.