OSTicket 1.9.2 edits for Time Spent Mod. ------------------- You have to alter your database table to hold the value: ALTER TABLE `ost_ticket` ADD COLUMN `time_spent` FLOAT(4,2) NOT NULL DEFAULT '0.00' AFTER `closed`; ------------------- class.ticket.php ------------------- now at line 56 we can add our var and functions var $timeSpent; function getTimeSpent(){ return $this->formatTime($this->timeSpent); } function getRealTimeSpent() { return $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; } now at line 104 also SELECT the field time_spent such as: .' ,count(distinct attach.attach_id) as attachments' .',time_spent' .' FROM '.TICKET_TABLE.' ticket ' now around line 122 set the ticket value for time spent such as: $this->id = $this->ht['ticket_id']; $this->number = $this->ht['number']; $this->timeSpent = $this->ht['time_spent']; // 20140707: Set time spent. ------------------- scp/tickets.php ------------------- now at line 50 process the posted amount: if($_POST['time_spent']) { $ticket->timeSpent($_POST['time_spent']); } ------------------- ticket-view.inc.php ------------------- now at line 306 after Last Response lets display in header: Time Spent: getTimeSpent(); // 20140707: ASIJB: Show Time Spent. ?> now at line 679 display again and have input box: isOpen()) { ?> getTimeSpent().' ('.$ticket->getRealTimeSpent().')
'; // show the current time spent (if any) ?> (0.75 = 45 minutes)