PDA

View Full Version : When one assigns and closes the ticket, I need that sends mail


rechague
09-05-2008, 01:22 PM
I need that when the ticket is assigned to the staff an e-mail is sent informing the user owner of the requirement, the same thing when the ticket should be closed, only sends a mail with the added information and does not say that it was closed, thank you.

jpowers40828
09-05-2008, 11:51 PM
The system should notify the staff member when they get assigned a ticket.

If you want to be able to include %status in the email templates so the reply will show whether it has been closed or not, use this.

REPLACE scp/tickets.php ~ line 86

//If no error...do the do.
if(!$errors && ($respId=$ticket->postResponse($_POST['msg_id'],$_POST['response'],$_POST['signature'],$_FILES['attachment'],$_POST['ticket_status']))){

ADD include/class.ticket.php ~ line 593 AFTER


//Send Response to client...based on the template...
//TODO: check department level templates...if set.
$sql='SELECT ticket_reply_subj,ticket_reply_body FROM '.EMAIL_TEMPLATE_TABLE.
' WHERE cfg_id='.db_input($cfg->getId()).' AND tpl_id='.db_input($cfg->getDefaultTemplateId());
$resp=db_query($sql);
if(db_num_rows($resp) && list($subj,$body)=db_fetch_row($resp)){

ADD this
if(strtolower($ticket_status)=="close"||strtolower($ticket_status)=="closed") {
$ticket_status = "Closed"; }
else { $ticket_status = "Open"; }
$subj = str_replace("%ticket", $this->getExtId(),$subj);
$subj = str_replace("%name", $this->getName(),$subj);
$subj = str_replace("%email", $this->getEmail(),$subj);
$subj = str_replace("%subject", $this->getSubject(),$subj);
$subj = str_replace("%dept", $dept?$dept->getName():'',$subj);
$subj = str_replace("%status", $_POST['ticket_status'], $subj);

$seperate_names = explode(" ",$this->getName(),2);
$subj = str_replace("%firstname", $seperate_names[0], $subj);
$body = str_replace("%firstname", $seperate_names[0], $body);
$subj = str_replace("%lastname", $seperate_names[1], $subj);
$body = str_replace("%lastname", $seperate_names[1], $body);

$body = str_replace("%ticket", $this->getExtId(),$body);
$body = str_replace("%name", $this->getName(),$body);
$body = str_replace("%email", $this->getEmail(),$body);
$body = str_replace("%subject", $this->getSubject(),$body);
$body = str_replace("%dept", $dept?$dept->getName():'',$body);
$body = str_replace("%status", $_POST['ticket_status'],, $body);

And because we changed the function we need to change in scp/tickets.php ~ line 336

$ticket->postResponse($msgId,$_POST['issue'],'none',null,false);

to be

$ticket->postResponse($msgId,$_POST['issue'],'none',null,null,false);

rechague
09-08-2008, 09:00 PM
Thanks, I will try and I tell you the result.

Regards.

rechague
09-09-2008, 03:32 PM
I was doing the modifications, but I do not find:

scp/tickets.php ~ line 336


PHP Code:
$ticket->postResponse($msgId,$_POST['issue'],'none',null,false);

to be


PHP Code:
$ticket->postResponse($msgId,$_POST['issue'],'none',null,false);

My line 336 says:

$ticket->reload(); //Reload ...possibly assigned!

But I found this and do not be if it is

if(($respId=$ticket->postResponse($msgId,$_POST['issue'],'none',null,null,false))) {


please, help me, thanks

jpowers40828
09-09-2008, 06:41 PM
The one you found is the correct one, I have done a lot of mods, so line numbers don't line up anymore.

if(($respId=$ticket->postResponse($msgId,$_POST['issue'],'none',null,false))) {

should be

if(($respId=$ticket->postResponse($msgId,$_POST['issue'],'none',null,null,false))) {