I have tried to use the patch file. Is anyone out there who could please translate the patch file into a add this and remove that tutorial? I would gladly put some money into a paypal account for this.
And please add all the updates and further modifications.
THANKS
Here is the tutorial, with the updates I added.
In File: ajax.tickets.php
After:
} elseif($ticket->getEstDueDate()) {
echo sprintf('
<tr>
<th>Due Date:</th>
<td>%s</td>
</tr>',
Format:($ticket->getEstDueDate()));
}
Add:
echo sprintf('
<tr>
<th width="100">Time Spent:</th>
<td>%s</td>
</tr>',
Format:($ticket->formatTime($ticket->getTimeSpent()))
);
In File: class.pdf.php
After:
$this->SetFont('Arial', 'B', 11);
$this->Cell($l, 7, 'Last Message', 1, 0, 'L', true);
$this->SetFont('');
$this->Cell($c, 7, Format:($ticket->getLastMsgDate()), 1, 1, 'L', true);
Remove:
$this->Ln(5);
Add:
if ($ticket->getTimeSpent() != 0){
$this->SetFont('Arial', 'B', 11);
$this->Cell($l, 7, 'Time Spent', 1, 0, 'L', true);
$this->SetFont('');
$this->Cell($c, 7, Format:($ticket->formatTime($ticket->getTimeSpent())), 1, 0, 'L', true);
$this->Ln(10);
} else {
$this->Ln(5);
}
After:
$text.="\nFiles Attached: \n";
}
$this->WriteText($w*2, $text, 1);
Add:
if($entry != 0){
$this->SetFillColor(221,221,221);
$this->SetFont('Arial', '', 9);
$this->Cell($w, 5, "Time Spent: " . $ticket->formatTime($entry), 'LBR', 1, 'L', true);
}
In File: class.ticket.php
After:
return $this->ht;
}
Add:
function getTimeSpent() {
return $this->ht;
}
After:
function getLock(){
if(!$this->tlock && $this->getLockId())
$this->tlock= TicketLock:($this->getLockId(),$this->getId());
return $this->tlock;
}
Add:
function formatTime($time) {
if ($time < 0){
$negative_convert = 1;
$time = $time * -1;
}
$hours = floor($time);
$minutes = round(($time-$hours) * 60);
if ($hours > 0) {
$formatted_time .= $hours.($hours == 1 ? ' hour' : ' hours');
if ($minutes > 0) {
$formatted_time .= ' '.$minutes.($minutes == 1 ? ' minute' : ' minutes');
}
}
else {
$formatted_time .= $minutes.($minutes == 1 ? ' minute' : ' minutes');
}
if ($negative_convert == 1){
$formatted_time = "- " . $formatted_time;
}
return $formatted_time;
}
After:
$this->logEvent('reopened', 'closed');
return (db_query($sql) && db_affected_rows());
}
Add:
function timeSpent($time) {
if (empty($time) || !is_numeric($time)) {
$time = 0.00;
} 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());
}
function timeSpentDel($time) {
if (empty($time) || !is_numeric($time)) {
$time = 0.00;
} 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());
}
function timeSpentEntry($id, $time) {
if (empty($time) || !is_numeric($time)) {
$time = 0.00;
} else {
$time = round($time, 2);
}
$sql='UPDATE '.TICKET_THREAD_TABLE.' SET time_spent='.db_input($time)
.' WHERE id='.db_input($id);
$this->timeSpent($time);
return (db_query($sql) && db_affected_rows());
}
function timeSpentEntryDel($id) {
$sql='SELECT time_spent FROM '.TICKET_THREAD_TABLE
.' WHERE id='.db_input($id);
$result = db_query($sql);
$row = db_fetch_array($result);
$time = $row;
$this->timeSpentDel($time);
}
!!More in the next post!!