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 /scp/tickets.php near line 49 Remplace this code: 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 this code: if($ticket && $ticket->getId()) { //More coffee please. $errors=array(); $lock=$ticket->getLock(); //Ticket lock if any $ticket->timeSpent($_POST['time_spent']); // Mode Time Spent $statusKeys=array('open'=>'Open','Reopen'=>'Open','Close'=>'Closed'); switch(strtolower($_POST['a'])): /include/staff/ticket-view.inc.php Near line 302 after this code: Last Response: getLastRespDate()); ?> add this code: Time Spent getTimeSpent(); ?>       near line 589 after this code: canAppendSignature()) { ?> add this code: isOpen()) { ?>
getTimeSpent().' ('.$ticket->getRealTimeSpent().')
'; // show the current time spent (if any) ?> 0.25 = 15 minutes, 0.50 =30 minutes, 0.75 = 45 minutes, 1 = one hour)
/include/staff/tickets.inc.php near line 204 Remplace this code: .' ,ticket.status,ticket.source,ticket.isoverdue,ticket.isanswered,ticket.created '; by this ode: .' ,ticket.status,ticket.source,ticket.isoverdue,ticket.isanswered,ticket.created,ticket.time_spent '; near line 331 rempleace this code: href="tickets.php?sort=name&order=" title="Sort By Name ">From with this code: href="tickets.php?sort=name&order=" title="Sort By Name ">From Time Spent near line 428 after this code:    add this code: getTimeSpent(); ?>   /include/class.ticket.php near line 51 after this code: var $topic; //Topic obj add var $timeSpent; //modif temps passé Near the line 88 after this code: $this->number = $this->ht['number']; add this code: $this->timeSpent = $this->ht['time_spent']; //Mod Time Spent near the line 295 after this code: function getStatus() { return $this->ht['status']; } add this code: // Mod Time Spent function getRealTimeSpent() { return $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 Mod