Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

[MOD] Add #Post, SenderName, Time Duration in Each Message

Hi,

I've just done about 80% to improve in ViewTicket page for Staff-Side as shown in the picture below (20% only for Client-Side, just copy-paste):

image

1. Added # (post number) for each post in the left side.

2. Added the sender name of post

3. Added time-duration between one post and the previous post

4. Added total time-duration from the first until the last post in one current ticket.

Any other feedback before I post the whole code to this forum?
Thanks. ;)

Best regards,
Masino Sinaga

Comments

  • That looks really nice!! What about adding navigation buttons - to previous and/or next ticket, so you don't have to go back to the ticket list each time?

    Edit -
    Ahh, I just found the post with the mod that adds previous/next links in the ticket here: http://osticket.com/forums/showthread.php?t=578&highlight=previous+ticket
  • Here is the code...

    Hi there,

    This is the code for MOD in my first post above about "Add #Post, SenderName, Time Duration in Each Message". I also added duration until the date and time while the opened ticket being accessed, beside the total duration from the first post until the last post.

    Let's getting started now!


    First: Download attachment file, extract, and put it to sub directory \include\


    Second: Edit the code below:

    Open \scp\tickets.php, FIND:
    require_once(INCLUDE_DIR.'class.banlist.php');


    AFTER, ADD:
    require_once(INCLUDE_DIR.'class.duration.php');



    Open \include\staff\viewticket.inc.php, FIND:
    	    $msgres =db_query($sql);
    while ($msg_row = db_fetch_array($msgres)) {
    ?>


    REPLACE WITH:
          $msgres =db_query($sql);
    $i=1;
    while ($msg_row = db_fetch_array($msgres)) {
    if ($i!=1) {
    $dateend = $msg_row['created'];
    } else if ($i==1) {
    $datebegin = $msg_row['created'];
    $firstdate = $datebegin;
    $dateend = $msg_row['created'];
    }
    $lastdate = $dateend;
    $datediff = new Duration($datebegin,$dateend);
    $resultdiff=$datediff->Duration($datebegin,$dateend);
    $datebegin = $dateend;
    ?>




    FIND:
    		    <table align=\"center\" class=\"message\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>
    <tr><th><?=Format::db_daydatetime($msg_row['created'])?></th></tr>
    <?if($msg_row['attachments']>0){ ?>
    <tr class=\"header\"><td><?=$ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td></tr>
    <?}?>
    <tr><td><?=Format::display($msg_row['message'])?>&nbsp;</td></tr>
    </table>


    REPLACE WITH:
            <table align=\"center\" class=\"message\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>
    <tr><th><?php echo \"(#\".$i.\") \"; echo Format::db_daydatetime($msg_row['created']); echo \" - \".Format::htmlchars($ticket->getName()); ?></th>
    </tr>
    <?php if($msg_row['attachments']>0){ ?>
    <tr class=\"header\"><td><?php echo $ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td></tr>
    <?php }?>
    <tr><td>
    <?php echo Format::display($msg_row['message']); ?>
    </td></tr>
    <tr class=\"header\"><td align=\"right\"><?php echo \"Duration: \".$resultdiff.\"<br />\"; ?></td></tr>
    </table>



    FIND:
    		    $resp =db_query($sql);
    while ($resp_row = db_fetch_array($resp)) {
    $respID=$resp_row['response_id'];
    ?>
    <table align=\"center\" class=\"response\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>
    <tr><th><?=Format::db_daydatetime($resp_row['created'])?>&nbsp;-&nbsp;<?=$resp_row['staff_name']?></th></tr>
    <?if($resp_row['attachments']>0){ ?>
    <tr class=\"header\">
    <td><?=$ticket->getAttachmentStr($respID,'R')?></td></tr>
    <?}?>
    <tr><td> <?=Format::display($resp_row['response'])?></td></tr>
    </table>
    <?}
    $msgid =$msg_row['msg_id'];
    }?>
    </div>
    </div>


    REPLACE WITH:
            $resp =db_query($sql);
    $j=1;
    while ($resp_row = db_fetch_array($resp)) {
    $i++;
    $respID=$resp_row['response_id'];
    $dateend = $resp_row['created'];
    $lastdate = $dateend;
    $datediff = new Duration($datebegin,$dateend);
    $resultdiff=$datediff->Duration($datebegin,$dateend);
    ?>
    <table align=\"center\" class=\"response\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>
    <tr><th><?php echo \"(#\".$i.\") \"; echo Format::db_daydatetime($resp_row['created'])?>&nbsp;-&nbsp;<?php echo $resp_row['staff_name']?></th>
    </tr>
    <?php if($resp_row['attachments']>0){ ?>
    <tr class=\"header\">
    <td><?php echo $ticket->getAttachmentStr($respID,'R')?></td></tr>
    <?php }?>
    <tr><td><?php echo Format::display($resp_row['response']); ?></td></tr>
    <tr class=\"header\"><td align=\"right\"><?php echo \"Duration: \".$resultdiff.\"<br />\"; ?></td></tr>
    </table>
    <?php
    $datebegin = $dateend;
    $j++;
    }
    $msgid =$msg_row['msg_id'];
    $i++;
    }
    $datediff = new Duration($firstdate,$lastdate);
    $resultdiff=$datediff->Duration($firstdate,$lastdate);
    ?>
    </div>
    </div>
    <?php
    $totalpost = $i-1;
    if ($ticket->getStatus()=='open') {
    echo \"<div align='right'><br /><b>Total: \".$totalpost.\" post(s), Duration: \".$resultdiff.\"</b></div>\";
    $lastdate = date(\"Y-m-d H:i:s\"); //userdate(); //date(\"Y-m-d H:i:s\");
    $datediff = new Duration($firstdate,$lastdate);
    $resultdiff=$datediff->Duration($firstdate,$lastdate);
    echo \"<div align='right'><br /><b>Ticket still opened, Total Duration: \".$resultdiff.\"</b></div>\";
    } else {
    echo \"<div align='right'><br /><b>Total: \".$totalpost.\" post(s), Duration: \".$resultdiff.\"</b></div>\";
    }
    ?>


    That's all. Let me know your feedback about this MOD. Thanks.

    Best regards,
    Masino Sinaga
    class.duration.zip
    548B
  • Here is the last screenshot...

    Hi again,

    Here is the last screenshot until when the code uploaded.

    In the first screenshot below, you can see that now we have new information about total post, also total duration if the ticket status still opened.
    image

    In the second screenshot below, you can see that if we hide the Ticket Thread, the total duration information in the bottom of the thread will still appears.
    image

    Enjoy it, and let me know your feedback.
    Thanks.

    Best regards,
    Masino Sinaga
  • thanx

    Works very fine and very useful!
    thanx again.
  • Thanks,

    that was just what I was looking for, works perfectly! :)

    Russ
  • Thanks a bunch! Very useful! :)
  • So glad you like it!

    Thanks for your feedback, everyone. :)

    I am so glad you like it moreover it is useful for you. ;)

    Best regards,
    Masino Sinaga
  • Great MOD, one request.

    I just implemented this mod and it works great! Thank you so much for your hard work.

    One request, is there a way to integrate the internal notes into the ticket thread so it is one continuous thread?
  • Thanks for your feedback.

    Unfortunately, I still have no idea how to integrate the internal notes into the ticket thread so it is one continuous thread. Moreover, the internal notes is only for internal purpose, and not shown to client. That is why I am not too interested to integrate it.

    Perhaps anyone else can do this?

    Best regards,
    Masino Sinaga
  • hey,
    is it possible to show the duration of a ticket in the 'ticket summary'?

    Like this:

    Ticket Date Subject Dept. Priority DURATION?

    That would be really nice!

    Thanks,
    Torben
  • White on white?

    hey,

    this part of the code is white in my tickets:
    <?php 
    $totalpost = $i-1;
    if ($ticket->getStatus()=='open') {
    echo \"<div align='right'><br /><b>Total: \".$totalpost.\" post(s), Duration: \".$resultdiff.\"</b></div>\";
    $lastdate = date(\"Y-m-d H:i:s\"); //userdate(); //date(\"Y-m-d H:i:s\");
    $datediff = new Duration($firstdate,$lastdate);
    $resultdiff=$datediff->Duration($firstdate,$lastdate);
    echo \"<div align='right'><br /><b>Ticket still opened, Total Duration: \".$resultdiff.\"</b></div>\";
    } else {
    echo \"<div align='right'><br /><b>Total: \".$totalpost.\" post(s), Duration: \".$resultdiff.\"</b></div>\";
    }
    ?>


    It is "white on white" now and I can't see the text. Only if I'll mark it...
    Any solution?


    Edit: I got it! Don't know why, but I had to set a ",,
    " around this code. After that the text is readable...strange..;-)

    Thanks,
    Torben
  • Works great, thanks!
  • I've installed this MOD successfully.Only one question is that the calculate date is shown as "Total: 1 post(s), Duration: 14569 Day(s), 2 Hour(s), 49 Minute(s), 40 Second(s).

    Ticket still opened, Total Duration: 14569 Day(s), 2 Hour(s), 52 Minute(s), 8 Second(s)." .I think it might something wrong with my modification ? Have you met this situation like this ?
  • Screenshot
    s16pt;11441 said:
    I've installed this MOD successfully.Only one question is that the calculate date is shown as "Total: 1 post(s), Duration: 14569 Day(s), 2 Hour(s), 49 Minute(s), 40 Second(s).

    Ticket still opened, Total Duration: 14569 Day(s), 2 Hour(s), 52 Minute(s), 8 Second(s)." .I think it might something wrong with my modification ? Have you met this situation like this ?
    Could you please provide us the screenshot regarding your current ticket above, so that we will know what is the exactly caused your problem? Thanks.

    Sincerely,
    Masino Sinaga
  • Can I send the image by email ? I can't post the image
  • You can upload your images file by clicking on this, afterwards let us know the public link to your images/screenshots. Thanks.

    Sincerely,
    Masino Sinaga
  • Hi , Masino,
    please refer this image.
    I've use http://www.openscriptsolution.com/2009/11/08/add-auto-staff-time-sheet-feature-into-osticket-v1-6-rc5/ and http://www.osticket.com/forums/showthread.php?t=2069 these 2 MOD together.
    If needed , I could post my related files for your reference.
    Thanks a lot,
  • From the screenshot above, I saw that you did not implement the other MOD. Am I correct?
  • Or you could check this screenshot.http://imagefruity.com/images/vb3a0xi3cb0o7uaefkb.jpg I did implement the other MOD. Thanks,
  • Hey,

    I have just implemented those both MODs, and everything seemed okay.

    image

    It's weird to know you got the strange result whereas the other people worked fine. Does anybody get the same result as s16pt got? :confused:

    Sincerely,
    Masino Sinaga
  • Hi , Masino,
    Could you zip your MOD files so that I can test on my site ?
    It's very strange.
    Thanks in advance,
  • Duration and Time Spent MODs

    Sure. Attached the files.

    Please note that I implemented those MODs in the osTicket fresh installation. So only that MODs have been implemented so far.

    Hope it helps you.

    Sincerely,
    Masino Sinaga
    duration_timespent.zip
    24K
  • Hi. Masino,
    After I completed a fresh osticket and use your files , everything seems fine now.
    I think it might be some human error by my hand.
    Thank you very much,
    S16pt
  • You're welcome. Glad to know it works fine at yours.

    Sincerely,
    Masino Sinaga
  • Great MOD... :)

    Only two things "missing"... For the way I need it to work...

    1-Don't count the time between the ticket's submission by the customer and our first reply.

    If I take 1 hour to start working on the problem this hour will count on the total...


    2-Any chance to get it NOT TO COUNT time between CLOSED and RE-OPENED tickets?

    If I start support on a customer on a Friday and am not able to finish it before the weekend, he will be billed for the hours until I restart on Monday...

    Thanks in advance!
  • Great Jod Masino ... Keep going...
    Chandu!
  • edited November 2013
    I liked it, so I rewrote the class using 1.7, enjoy!

    Extract the class file into /includes/class.duration.php

    Class here: http://pastebin.com/raw.php?i=KzWmb7fW

    Open /includes/staff/ticket-view.inc.php

    Find:

    //Get the goodies.
    $dept = $ticket->getDept(); //Dept
    $staff = $ticket->getStaff(); //Assigned or closed by..
    $team = $ticket->getTeam(); //Assigned team.
    $sla = $ticket->getSLA();
    $lock = $ticket->getLock(); //Ticket lock obj
    $id = $ticket->getId(); //Ticket ID.


    Add after:
    //Load the duration MOD
    require_once(INCLUDE_DIR.'class.duration.php');
    $mod_duration = new MOD_Duration($ticket);


    Find:
    <th width=\"440\"><span><?php echo Format::htmlchars($entry['title']);?></span></th>

    Add immediately after:
    <th width=\"160\"><span><?php echo $mod_duration->addThreadEntry($entry); ?></span></th>

    You could put it wherever you like, I find putting it here is ok.

    Right at the bottom, find:
    <script type=\"text/javascript\" src=\"js/ticket.js\"></script>

    Add just before:
    <br /><b>Total: <?php echo $tcount; ?> post(s),  <?php $mod_duration->printThreadSummary(); ?></b>


    Test and enjoy!
Sign In or Register to comment.