Time spent on a ticket

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Brice
Posts: 1
Joined: Thu Jan 07, 2010 1:11 pm

Time spent on a ticket

Post by Brice »

Hello,

I am looking for an add-on for the staff that indicates time spent on a ticket. Then we could add up all the time spent on the tickets of a person.

Thanks !
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

I'm not aware of any such mods at the moment, but this should be added in the future.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
conepr09
Posts: 8
Joined: Wed Nov 25, 2009 1:09 pm

Post by conepr09 »

I'm working on a mod to the admin_ticket.php page to add a field (Total Hours) so the technician can input the time spent on the ticket. Once I get this working and if you are interested I will post the code here.
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Cool, yes please :)
masterzonk
Posts: 2
Joined: Wed Apr 28, 2010 3:53 pm

Post by masterzonk »

Anything?
morsedesign
Posts: 15
Joined: Thu Jan 07, 2010 8:50 pm

Post by morsedesign »

Has anyone gotten far enough to post something? I am looking to do a mod like this soon!
Shawn Morse | Morse Associates, LLC
Lead Designer/Programmer
dr.sah
Posts: 15
Joined: Mon Mar 29, 2010 11:59 am

Post by dr.sah »

any news about this? It would be great to see time spend.
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Not yet, maybe in 2.3...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
cebicit
Posts: 1
Joined: Thu Jul 15, 2010 4:36 pm

I need one too

Post by cebicit »

Has anyone here perhaps made their own mod that doesn't come native w/ hesk. Or, maybe someone can help me w/ mine. I am to the point now where I have a field in the response section for minutes spent. It is saved into the MySQL database. Now all I need is some code to retrieve those entries from the database, add them up, and display them. Your help would be greatly appreciated!

All I did to add the time field to the database and modded the submission form and the processor page to add it upon submission.
rmiddleton
Posts: 3
Joined: Tue Feb 22, 2011 3:51 pm

Re: Time spent on a ticket

Post by rmiddleton »

As a work around, until someone writes this, I just setup a Checkbox field with these parameters.
Less than 15 minutes
15 minutes
30 minutes
45 minutes
1 hour
1.5 hours
2 hours
2.5 hours
3 hours
over 3 hours
seanieboy02
Posts: 5
Joined: Fri Jul 22, 2011 7:30 pm

Re: Time spent on a ticket

Post by seanieboy02 »

I've done a little mod that should give you time spent on each ticket, also allowing for the creation of custom reports on time per category, customer, member of staff, company etc.

Depending on your setup the code position might need to be altered but I've put in the line numbers from a blank hesk.

Add a new field into the DB, notes table called 'timeSpent'. int(3) default value of 0.
Add another field into the tickets table called 'totalTimeSpent'. int(3) default value of 0.

Add the following into admin_ticket.php

Inside the add notes block for the following 2 code blocks.
Line 188

Code: Select all

$msgTS = hesk_input($_POST['timeSpent']);
Replace 196 with the following

Code: Select all

'".hesk_dbEscape($msg)."',
'".hesk_dbEscape($msgTS)."')";
Add the following to just after the 'Add Note Action' (around line 204).

Code: Select all

//Time Spent Calculation and Diplay 
	$sqltime = 'SELECT sum(timeSpent) FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'notes` AS t1 WHERE `ticket`='.hesk_dbEscape($ticket['id']).' ORDER BY t1.`id` ASC';
	$restime = hesk_dbQuery($sqltime);
	$note = hesk_dbFetchAssoc($restime);
	$timeTotal = $note['sum(timeSpent)'];	
	?>
    <tr>
    	<td>Total time spent on ticket: </td>
        <td><?php echo $timeTotal;?> minutes</td>
     </tr>
Add the following to the three statuses in the case blocks around line 301. Just after the s=3 $GET variables

Code: Select all

tS='.$timeTotal.'
Replace the DIV block for the notesform around line 465 with

Code: Select all

<div id="notesform" style="display:none">
	    <form method="post" action="admin_ticket.php" style="margin:0px; padding:0px;">
        <p>
            <span>Action / Detail</span><br />
            <textarea name="notemsg" rows="6" cols="60"></textarea>
        </p>
        <p>
            <span>Time Spent (in minutes)</span><br />
            <input type="text" name="timeSpent" size="5" maxlength="3" value="0" />
        </p>
	    <input type="submit" value="<?php echo $hesklang['s']; ?>" class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" /><input type="hidden" name="track" value="<?php echo $trackingID; ?>" />
        <i><?php echo $hesklang['nhid']; ?></i>
        <input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" />
        </form>
	    </div>
Replace the Table Row which displays the notes (in the while loop) 493

Code: Select all

<tr>
	    <td class="notes"><i><?php echo $hesklang['noteby']; ?> <b><?php echo ($note['name'] ? $note['name'] : $hesklang['e_udel']); ?></b></i> - <?php echo hesk_date($note['dt']); ?> - <b>Time Spent: </b><?php echo $note['timeSpent']; ?> minutes<br /><img src="../img/blank.gif" border="0" width="5" height="5" alt="" /><br />
	    <?php echo $note['message']; ?></td>
</tr>
Finally, in the change_status.php file:

Add the following to around line 56 (with the rest of the $GET variables)

Code: Select all

$totalTime = hesk_isNumber($_GET['tS'],"$hesklang[int_error]: $hesklang[status_not_valid].");
Add this to the SQL block around line 79

Code: Select all

`totalTimeSpent`='".hesk_dbEscape($totalTime)."',
scheckc
Posts: 15
Joined: Mon Aug 15, 2011 8:59 pm

Re: Time spent on a ticket

Post by scheckc »

Now I wish I hadn't upgraded to beta.. :(

Seems that the strucuture of the php files has changed too drastically, I can't follow your directions because the lines are not accurate at all.

really sucks too cuz this was a feature that I was waiting on. :(

Do you have a version of the instructions that are 2.3 compatible yet? Or possibly link the two modified files for download? Just a thought. Aside from time tracking HESK IS IT!!!

Thanks for the support all.
seanieboy02
Posts: 5
Joined: Fri Jul 22, 2011 7:30 pm

Re: Time spent on a ticket

Post by seanieboy02 »

I've just upgraded to 2.3 - about to re-create the add-on again.
If anyone has any advice on how to package it properly I'm open to suggestions!

:D
scheckc
Posts: 15
Joined: Mon Aug 15, 2011 8:59 pm

Re: Time spent on a ticket

Post by scheckc »

Anyword on the 2.3 repack of this feature? I would really like to utilize it.

Thanks so much for any update, in advance.
bert blaas
Posts: 12
Joined: Fri Jan 06, 2012 3:15 pm

Re: Time spent on a ticket

Post by bert blaas »

Today I combined the code made by seanieboy02 » Fri Jul 22, 2011 10:13 pm into the 2.3 version and have it working as wanted.

Please advice me how to share this code now here, as I cannot seem to be able to upload files.
Do I need to copy & paste code like seanieboy02 did?
Post Reply