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 08-03-2009, 06:08 PM
Girl Girl is offline
Junior Member
 
Join Date: Jul 2009
Posts: 7
Default notification close ticket

hi everybody...
i need ur help cuz i dont know about php...
i want receive an email when someone closes a ticket...
it would be perfect if the email contains all the historic with the client...

thank you very much <3
Reply With Quote
  #2  
Old 08-03-2009, 11:44 PM
michael.therrien michael.therrien is offline
Member
 
Join Date: Jun 2009
Location: Vermont, United States
Posts: 65
Send a message via AIM to michael.therrien
Default

It's do-able. Someone actually already asked for this:
http://osticket.com/forums/showthread.php?t=1810

I'll see what I can whip up! Bug me if I don't get to it soon.
Reply With Quote
  #3  
Old 08-04-2009, 02:01 PM
Girl Girl is offline
Junior Member
 
Join Date: Jul 2009
Posts: 7
Default close notification

Quote:
Originally Posted by michael.therrien View Post
It's do-able. Someone actually already asked for this:
http://osticket.com/forums/showthread.php?t=1810

I'll see what I can whip up! Bug me if I don't get to it soon.

thank you very much... its urgent...pls pls ty
Reply With Quote
  #4  
Old 08-06-2009, 06:19 PM
michael.therrien michael.therrien is offline
Member
 
Join Date: Jun 2009
Location: Vermont, United States
Posts: 65
Send a message via AIM to michael.therrien
Default

Like I said, don't have much time recently, but this should do the basic part of what you are looking for:
In /include/class.ticket.php
MODIFY:
PHP Code:
    //Close the ticket
    
function close(){
        
        
$sql'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
              
' WHERE ticket_id='.db_input($this->getId());
        return (
db_query($sql) && db_affected_rows())?true:false;
    } 
To be this:
PHP Code:
    //Close the ticket
    
function close(){
        
        
$sql'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
              
' WHERE ticket_id='.db_input($this->getId());
        return (
db_query($sql) && db_affected_rows())?true:false;
        
$subj"Ticket #" .$this->getId(). " has been closed.";
        
$body"This is a notification that Ticket #" .$this->getId(). " has been closed.";
        
$email->send($ticket->getEmail(),$subj,$body);
    } 
Reply With Quote
  #5  
Old 08-07-2009, 06:05 AM
Girl Girl is offline
Junior Member
 
Join Date: Jul 2009
Posts: 7
Default close notification

i understand and im sorry...
it doesnt work >.<
ty anyway
Reply With Quote
  #6  
Old 08-13-2009, 02:37 PM
ByteRot ByteRot is offline
Junior Member
 
Join Date: Mar 2009
Posts: 15
Default

I have not tried the mod but looking at the code, the return statement should be moved to the bottom. It will never execute the email code.

Code:
    //Close the ticket
    function close(){
        
        $sql= 'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
              ' WHERE ticket_id='.db_input($this->getId());
        $subj= "Ticket #" .$this->getId(). " has been closed.";
        $body= "This is a notification that Ticket #" .$this->getId(). " has been closed.";
        $email->send($ticket->getEmail(),$subj,$body);

        return (db_query($sql) && db_affected_rows())?true:false;
    }
Reply With Quote
  #7  
Old 08-14-2009, 11:38 AM
ozkr ozkr is offline
Member
 
Join Date: Feb 2009
Location: Lima-Perú
Posts: 151
Default

does this mod works?
Reply With Quote
  #8  
Old 08-21-2009, 01:52 PM
djbooya djbooya is offline
Junior Member
 
Join Date: Aug 2009
Location: UnderGround
Posts: 3
Default

Quote:
Originally Posted by ozkr View Post
does this mod works?
Here's my version of this:

PHP Code:
    // ALL CHANGES IN class.ticket.php
    
function close(){

        
$sql'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
              
' WHERE ticket_id='.db_input($this->getId());
// NEW MOD CODE STARTS HERE
// get dept object
$dept = new Dept($this->getDeptId());
// get email object for current  
$email = new Email($this->getEmail()); 
// see if the department ticket is configured for is setup for auto response on
// new tickets.  I have some departments I don't want notification on close
// A new attribute could be used, but I piggy backed on an existing as it
// suited my needs fine for now.
if ($dept->autoRespONNewTicket()) {
  
// small debug message that prints at the top of ticket screen so I know
  // an email was sent
  
print "<b>Email Sent</b>";
  
// subject for email -- totally configurable.  code in previous post was 
  // showing the internal ID, not the external ID a user would need
  
$subj"Helpdesk Request #" .$this->getExtId(). " has been closed.";
  
// I added a link in the body to the ticket for the user if they wanted
  // to view it just after I closed it.
  
$body"This is a notification that Request#" .$this->getExtId(). " has been closed.  You can see request information here: http://" $_SERVER["SERVER_NAME"] . "/view.php?e=" $this->getEmail() . "&t=" $this->getExtId() . ".";
  
// this sends out the email ensuring the "From" address is whatever
  // is configured for the department
  
$dept->getEmail()->send($this->getEmail(),$subj,$body);
}
// NEW MOD CODE ENDS HERE
        
return (db_query($sql) && db_affected_rows())?true:false;
    } 
I am using this with osticket_1.6rc5 right now. Just installed it last night and added this mod as it was important for my installation. I modified it from the above code to suit my needs a little better. And to answer your question, it's a minimal addition to see if it works in your installation. Just throw the code in and test, if it doesn't do what you want either remove the code or just restore from your backup. Quick and painless with this mod since it's confined to just 1 function in 1 class.

Enjoy my updates!
--DJBooya
Reply With Quote
  #9  
Old 08-26-2009, 01:04 PM
Girl Girl is offline
Junior Member
 
Join Date: Jul 2009
Posts: 7
Default close

Quote:
Originally Posted by djbooya View Post
Here's my version of this:

PHP Code:
    // ALL CHANGES IN class.ticket.php
    
function close(){

        
$sql'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
              
' WHERE ticket_id='.db_input($this->getId());
// NEW MOD CODE STARTS HERE
// get dept object
$dept = new Dept($this->getDeptId());
// get email object for current  
$email = new Email($this->getEmail()); 
// see if the department ticket is configured for is setup for auto response on
// new tickets.  I have some departments I don't want notification on close
// A new attribute could be used, but I piggy backed on an existing as it
// suited my needs fine for now.
if ($dept->autoRespONNewTicket()) {
  
// small debug message that prints at the top of ticket screen so I know
  // an email was sent
  
print "<b>Email Sent</b>";
  
// subject for email -- totally configurable.  code in previous post was 
  // showing the internal ID, not the external ID a user would need
  
$subj"Helpdesk Request #" .$this->getExtId(). " has been closed.";
  
// I added a link in the body to the ticket for the user if they wanted
  // to view it just after I closed it.
  
$body"This is a notification that Request#" .$this->getExtId(). " has been closed.  You can see request information here: http://" $_SERVER["SERVER_NAME"] . "/view.php?e=" $this->getEmail() . "&t=" $this->getExtId() . ".";
  
// this sends out the email ensuring the "From" address is whatever
  // is configured for the department
  
$dept->getEmail()->send($this->getEmail(),$subj,$body);
}
// NEW MOD CODE ENDS HERE
        
return (db_query($sql) && db_affected_rows())?true:false;
    } 
I am using this with osticket_1.6rc5 right now. Just installed it last night and added this mod as it was important for my installation. I modified it from the above code to suit my needs a little better. And to answer your question, it's a minimal addition to see if it works in your installation. Just throw the code in and test, if it doesn't do what you want either remove the code or just restore from your backup. Quick and painless with this mod since it's confined to just 1 function in 1 class.

Enjoy my updates!
--DJBooya

hi guys..

did it work with you?
not with me...

thank you
Reply With Quote
  #10  
Old 08-26-2009, 04:33 PM
seth260 seth260 is offline
Junior Member
 
Join Date: Jul 2009
Posts: 1
Default

Works Perfectly for me!

I would like to know how to make the notification goto the department admin as well though. I can't seem to add another to address to the function.

Can anyone help?
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 07:04 PM.