Jump to content

Show time since ticket last answer


ST4R

Recommended Posts

Currently, when a client enter his account and go to his Tickets/Invoices/Services/etc lists such as (supportticketslist.tpl), the latest answer on the tickets will be sorted by full date, example:

 

Example 1: Latest update: 8th Nov 2013 (14:06)

 

But I want it to show the time since the last answer, example:

 

Example 2: Latest Answer: 0h 52m

 

How can I do it?

 

Thanks for your time.

Link to comment
Share on other sites

Yeah, but as WHMCS uses this function already in the admin area, then this code already exists, right?

and do not tell me that the function code exists in an encrypted file, because this isn't the answer!

it's an answer - it may not be the one you want to hear, but it's definitely an answer! :)

 

so if the code already exists in an encrypted file, you want me to share the code with you? seriously?? :roll:

if it's encrypted, it's because WHMCS don't want that code shared - it's not for me to decrypt it for you.

 

anyway, we're not even talking about some complex bit of PHP programming - i've already explained the process... you have one date (the last reply Smarty variable); you can easily get today's date in PHP; take one from the other and convert it to days, hours and minutes... then pass it back to Smarty or echo it -> job done.

 

if you're not a programmer and don't know how to do that (or use Google to find out!), then it's ok to admit that and ask for further help - but don't ask me to reveal code that I didn't write and is not mine to share! :mad:

 

 

ticketupdate.png

 

I take it that's all you want to do - convert the date to calculate the difference between the last reply and now? the above was done without reference to any WHMCS code, uses date_diff and is only ten lines long - simple! :idea:

 

http://php.net/manual/en/datetime.diff.php

Link to comment
Share on other sites

seeing as you asked... :lol:

 

                    <td class="text-center"><span  class="hidden">{$ticket.normalisedLastReply}</span>{php} 
                   $smartyvars = $template->getTemplateVars(); 
                   $lastreplydate = $smartyvars['ticket']['normalisedLastReply']; 
                   $datetime1 = date_create($lastreplydate); 
                   $datetime2 = date_create(); 
                   $interval = date_diff($datetime1, $datetime2); 
                   $result = ""; 
                   if ($interval->d) { $result .= $interval->format("%ad "); } 
                   if ($interval->h) { $result .= $interval->format("%hh "); } 
                   if ($interval->i) { $result .= $interval->format("%im "); } 
                   echo $result; 
                   {/php}</td>

as a rule, I prefer not to use {php} tags these days, but i'm not writing a hook for him - anyway, it works! :idea:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated