Ask not what osTicket community can do for you - ask what you can do for osTicket community

Go Back   osTicket Forums > osTicket 1.6.x > Mods and Customizations

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-31-2010, 08:36 AM
sternen sternen is offline
Member
 
Join Date: Feb 2010
Location: Memphis, TN
Posts: 43
Default Sound on New Ticket

This incredibly simple mod will play a sound when the ticket list refreshes and there is a new ticket waiting for you.

I had already added the Age of Tickets mod and this mod piggybacks on the work that Scottro did in this thread:
http://osticket.com/forums/showthread.php?t=2619

In tickets.include.php find:
PHP Code:
<!--<td align="center" nowrap><?=Format::db_date($row['created'])?></td>-->
        <td class="nohover" align="center" >
                <?
                $diff 
=$row['timeopen'];
                
$min "min";
                
$mins "mins";
                
$hours "hours";
                
$hour "hour";
                
$day "day";
                
$days "days";
                if ( 
$diff <= ){
                   print (
$diff " " $min);
                }elseif ( 
$diff >  && $diff <= 59 ){
                   print (
$diff " " $mins);
                }elseif ( 
$diff >= 60 && $diff <= 119 ){
                   
$diff round($diff 60);
                   print (
" " $hour);
                }elseif ( 
$diff >= 120 && $diff <= 1439 ){
                   
$diff round($diff 60);
                   print (
$diff " " $hours);
                }elseif ( 
$diff >= 1440 && $diff <= 2879 ){
                   print (
" " $day);
                }elseif ( 
$diff >= 2880 ){
                   
$diff round($diff 1440);
                   print (
$diff " " $days);
                }else {};
                
?>
                </td>
now add this before the final <td> tag

PHP Code:
<? if ( $diff ){ ?> <embed src="beep.wav" width="0" height="0" autoplay="true"></embed> <?}?>
Make sure you change "beep.wav" to the url of the sound you want to use. For me, I just dropped my wav file into the SCP folder.

Basically, what this does is looks to see if a ticket has an age of zero minutes when the age of the ticket is calculated. If it does, it will play the sound. Keep in mind that if more than one ticket has an age of zero after the page refreshes multiple sounds will play. This is fine for my situation, but may not work for you if you have a high volume of tickets.

Here is a link to the sound I use, which is only 1K. (found via google)
http://buggerluggs.tripod.com/wavs/blip1.wav
Reply With Quote
  #2  
Old 08-02-2010, 05:36 PM
CobbCarl CobbCarl is offline
Member
 
Join Date: Jul 2010
Location: Atlanta, GA
Posts: 40
Default Excellent!!!

Now if I could just get the other mod to work while keeping my "Date" field on my tickets.php.
Reply With Quote
  #3  
Old 08-02-2010, 06:09 PM
sternen sternen is offline
Member
 
Join Date: Feb 2010
Location: Memphis, TN
Posts: 43
Default

There's no reason you cant have the date field in there. I know the mod takes it out, but you should be able to add it back in without too much trouble.
Reply With Quote
  #4  
Old 08-03-2010, 06:42 AM
CobbCarl CobbCarl is offline
Member
 
Join Date: Jul 2010
Location: Atlanta, GA
Posts: 40
Default

I tried for a while yesterday....and it kept moving my fields all around and screwing everything up..... I'm by no means a PHP expert....I've built sites with it before....but never modified someone elses code to make things work the right way....the way other people write code baffles me sometimes! :T
Reply With Quote
  #5  
Old 08-03-2010, 08:04 AM
sternen sternen is offline
Member
 
Join Date: Feb 2010
Location: Memphis, TN
Posts: 43
Default

To add the back in, you 1st have to be more concerned with the HTML that lays out the table. You are dealing with 2 different rows and have to add a set of TD tags in the same position on each row. Once you have the TD tags in the right place it is just a matter of figuring out the data lookup php, which you can probably cut and paste from the base install files.

I will take a look at it later tonight and see if I can figure out a more detailed guide to adding that date field back in.

Pete

Last edited by sternen; 08-03-2010 at 08:11 AM.
Reply With Quote
  #6  
Old 08-03-2010, 11:44 PM
sternen sternen is offline
Member
 
Join Date: Feb 2010
Location: Memphis, TN
Posts: 43
Wink

As promised, I dug back through my code to figure out how to add the opened date back into the mix. Hopefully you will find what I found. I am not sure what the instructions in the original MOD that Scottro did that adds ticket age were (or if it was his MOD that removed the date column), but my date columns were simply commented out. I took the comment tags out and the date column reappeared. The sorting function is still intact and still works.

Just in case, I will paste the snippets of code that I have in hopes that you will be able to find the corresponding code in yours to work with. I apologize that I can't give line numbers as my system has been heavily modded and line numbers would probably confuse the issue more.

This is all in includes/staff/tickets.inc.php

For the header row, here is the date in between the ticket number and Age columns.

PHP Code:
<th width=60" >&nbsp;&nbsp;&nbsp;&nbsp;<a href="tickets.php?sort=ID&order=<?=$negorder?><?=$qstr?>" title="Sort By Ticket ID <?=$negorder?>">Ticket</a></th>

<th width="70"> &nbsp;&nbsp;&nbsp;&nbsp;<a href="tickets.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Date</a></th>

<th width="55">&nbsp;&nbsp;&nbsp;&nbsp;<a href="tickets.php?sort=timeopen&order=<?=$negorder?><?=$qstr?>" title="Sort By Age <?=$negorder?>">Age</a></th>
And here is the data rows, also with the Date in between the Tickets and Age columns. (My MOD to add sound on refresh if the is a new ticket is at the bottom.)

PHP Code:
<td align="center" title="<?=$row['email']?>" nowrap><a class="Icon <?=strtolower($row['source'])?>Ticket" title="<?=$row['source']?> Ticket: <?=$row['email']?>
href="tickets.php?id=<?=$row['ticket_id']?>"><?=$tid?></a></td>

<td align="center" nowrap><?=Format::db_date($row['created'])?></td>  
      
<td class="nohover" align="center" >
                <?
                $diff 
=$row['timeopen'];
                
$min "min";
                
$mins "mins";
                
$hours "hours";
                
$hour "hour";
                
$day "day";
                
$days "days";
                if ( 
$diff <= ){
                   print (
$diff " " $min);
                }elseif ( 
$diff >  && $diff <= 59 ){
                   print (
$diff " " $mins);
                }elseif ( 
$diff >= 60 && $diff <= 119 ){
                   
$diff round($diff 60);
                   print (
" " $hour);
                }elseif ( 
$diff >= 120 && $diff <= 1439 ){
                   
$diff round($diff 60);
                   print (
$diff " " $hours);
                }elseif ( 
$diff >= 1440 && $diff <= 2879 ){
                   print (
" " $day);
                }elseif ( 
$diff >= 2880 ){
                   
$diff round($diff 1440);
                   print (
$diff " " $days);
                }else {};
                
?>
                <!-- Begin MOD Beep On New Ticket -->
                    <? if ( $diff ){ ?> <embed src="blip1.wav" width="0" height="0" autoplay="true"></embed> <?}?>
                <!-- End MOD Beep On New Ticket -->                

                </td>
Once you have the new comlumns (back) in place, you may have to edit the "width" tag of each TH header to account for the added column.

I hope this all makes sense and it helps you get the date column back into your ticket system like you wanted! Now that I have it back in, I think I am going to keep it.
Reply With Quote
  #7  
Old 05-02-2012, 09:40 AM
yogiman.uk yogiman.uk is offline
Junior Member
 
Join Date: Apr 2009
Posts: 16
Default Missing File

Hi

Hope I am just being thick here. I was hoping to include this mod. But fell at the first hurdle as it says:

In tickets.include.php find:

However I don't have a file called tickets.include.php

Have I just missed something here?

any help appreciated.

Thanks

Yogiman!
Reply With Quote
  #8  
Old 08-14-2012, 11:01 AM
yanayun yanayun is offline
Junior Member
 
Join Date: Dec 2009
Posts: 2
Default reply ticket sound

how to play sound for new reply ticket
Reply With Quote
  #9  
Old 09-05-2012, 09:00 AM
kremori kremori is offline
Junior Member
 
Join Date: Jul 2011
Posts: 6
Default

Hi there,

I have implemented this MOD and set it if the ticket is younger than 5 min to play a wav file, however if i go to my closed tickets and there i have some tickets usually that have been closed within five minutes and since they are closed the minutes don't change there, it happens that everytime i enter closed tickets i hear multiple wav sounds informing for new ticket at the already closed tickets.
please anyone advice if its possible to exclude the wav play from closed tickets section.

Thank you

***DISREGARD the message*** found the solution just changed the code to "( $diff < 5 && $status=='open')

Last edited by kremori; 09-06-2012 at 05:15 AM. Reason: Found solution
Reply With Quote
  #10  
Old 09-06-2012, 09:48 AM
Rich_C Rich_C is offline
Member
 
Join Date: Mar 2012
Posts: 113
Default

Quote:
Originally Posted by kremori View Post
Hi there,

I have implemented this MOD and set it if the ticket is younger than 5 min to play a wav file, however if i go to my closed tickets and there i have some tickets usually that have been closed within five minutes and since they are closed the minutes don't change there, it happens that everytime i enter closed tickets i hear multiple wav sounds informing for new ticket at the already closed tickets.
please anyone advice if its possible to exclude the wav play from closed tickets section.

Thank you

***DISREGARD the message*** found the solution just changed the code to "( $diff < 5 && $status=='open')

Thanks I appreciate you pointing this out. I might not of caught it prior to looking at implementing it.
Reply With Quote


Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:09 AM.