Adding timespent in tickets 1 : modify database, in ost_ticket table add the field 'time_spent' after the field 'closed' , the type is 'float' value =4,2 default define as 0.00 in /scp/tickets.php modify near line 49 if($ticket && $ticket->getId()) { //More coffee please. $errors=array(); $lock=$ticket->getLock(); //Ticket lock if any $statusKeys=array('open'=>'Open','Reopen'=>'Open','Close'=>'Closed'); switch(strtolower($_POST['a'])): by if($ticket && $ticket->getId()) { //More coffee please. $errors=array(); $lock=$ticket->getLock(); //Ticket lock if any $ticket->timeSpent($_POST['time_spent']); // modification temps passé $statusKeys=array('open'=>'Open','Reopen'=>'Open','Close'=>'Closed'); switch(strtolower($_POST['a'])): in /include/staff/ticket-view.inc.php modify near line 562 after canAppendSignature()) { ?> add isOpen()) { ?>
getTimeSpent().'
'; // show the current time spent (if any) ?> (0.25 = 15 minutes, 0.50 =30 minutes, 0.75 = 45 minutes, 1 = one hour)
in include/staff/tickets.inc.php near line 204 add ticket.time_spent after ticket.created near line 429 after    add getTimeSpent(); ?>   in /include/class.ticket/php on line 53 after var $tlock; //TicketLock obj add var $timeSpent; //modif temps passé on line 90 after $this->number = $this->ht['number']; add $this->timeSpent = $this->ht['time_spent']; //modif temps passé near the line 296 after function getStatus() { return $this->ht['status']; } add // modification timespent function getRealTimeSpent() { return $this->formatTime($this->timeSpent); } 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:false; } //end of modification