Is there any way to show the attachments in the New Ticket Alert? Either to show the actual path, or just to show whether there is one or not. Since the email shows the message, it can be easy to forget to log in and see if there is an attachment to view, so it would be nice to have a way to know whether you need to do that or not.

I tried adding %attachment to the template, but that didn't work.

6 days later

If you added %attachment in email template, then you have to modify its related script in class.ticket.php file. Have you done this before?

Best regards,

Masino Sinaga

No, I wouldn't know how to do that. I just took a chance that maybe it was already set up, since all the other fields are. No such luck! :)

Try this reference...

Please check this out:

http://www.osticket.com/forums/showthread.php?t=1895(http://www.osticket.com/forums/showthread.php?t=1895)

Hope this is helpful.

Best regards,

Masino Sinaga

Thank you, I will check that out!

11 days later

%attachment added to message

Please check this out:

http://www.osticket.com/forums/showthread.php?t=1895(http://www.osticket.com/forums/showthread.php?t=1895)

Hope this is helpful.

Best regards,

Masino Sinaga

I've modified the code to add the %attachment to my template, but when an "new ticket alert" is sent, the %attachment is blank. I'm pointing it to receive the file name in the ticket attachment table. I would like the new ticket alert to display the attachment file name.

If anyone has a fix, it would be appreciated.

Please make sure first that you have succeeded getting attachment from ticket_attachment table. After that, then replace body variable with your attachment variable.

For example:

$attachment = blablablabla; // <-- make sure you get the attachment

// then replace attachment param with attachment var at body var

$body = str_replace("%attachment", $attachment, $body);

Best regards,

Masino Sinaga

11 days later

I've added this to the send notice to assignee and it works. I just can't get it to work on a New Ticket Alert or New Message Alert.

if(db_num_rows($resp) && list($subj,$body)=db_fetch_row($resp)){

$subj = str_replace("%ticket", $this->getExtId(),$subj);

$body = str_replace("%priority", $this->priority,$body);

$body = str_replace("%assignment", $this->subject,$body);

$body = str_replace("%additional", $this->additional,$body);

$body = str_replace("%attachmentname", $this->attachmentname,$body); //added to see attachment file_name

$body = str_replace("%ticket", $this->getExtId(),$body);

$body = str_replace("%assignee", $staff->getName(),$body);

$body = str_replace("%assigner", $thisuser->getName(),$body);

$body = str_replace("%message", $message,$body);

$body = str_replace("%url", $cfg->getBaseUrl(),$body);

Misc:($staff->getEmail(),$subj,$body,$cfg->getAlertEmail());

Blablabla worked, next step please.

Please make sure first that you have succeeded getting attachment from ticket_attachment table. After that, then replace body variable with your attachment variable.

For example:

$attachment = blablablabla; // <-- make sure you get the attachment

// then replace attachment param with attachment var at body var

$body = str_replace("%attachment", $attachment, $body);

Best regards,

Masino Sinaga

When I add the code above, the new ticket alert returns the value of blablabla within the email when I add %attachment to the email. Now I just need to figure out how to grab the attachment name as in the send alert to assignee email.

Here is the hint...

To grab the attachment name, you can see its technique from these two files below:

- \include\client\viewticket.inc.php

- \include\staff\viewticket.inc.php

then FIND this code:

echo $ticket->getAttachmentStr($msg_row,'M')

also this:

$ticket->getAttachmentStr($respID,'R')

You can see that this getAttachmentStr function (see in \include\class.ticket.php file) has two parameters.

The first parameter is refid which could be msg_id belongs to the ticket_message table which the second parameter is 'M' (see the first code above), or could be response_id belongs to the ticket_response table which the second parameter is 'R' (see the second code above).

Hope this is helpful. Good luck. ;)

Best regards,

Masino Sinaga

Hi Masino,

I found the code within the two code boxes above and tried implementing the code within my email, but when a new ticket is created the %attachment is replaced, but nothing shows in the email.

This is what I've added.

if($resp && list($subj,$body)=db_fetch_row($resp)){

$body = str_replace("%ticket", $ticket->getExtId(),$body);

$body = str_replace("%name", $ticket->getName(),$body);

$body = str_replace("%email", $ticket->getEmail(),$body);

$body = str_replace("%priority", $ticket->getPriority(),$body);

$body = str_replace("%subject", $ticket->getSubject(),$body);

$body = str_replace("%dept", $dept?$dept->getName():'',$body);

$body = str_replace("%topic", $ticket->getTopicName(),$body);

//$body = str_replace("%attachmentname", $ticket->getAttachmentname(),$body);

$attachment = $ticket->getAttachmentStr($msg_row,'M');

$body = str_replace("%attachment", $attachment, $body);

$body = str_replace("%message",$var,$body);

$body_message = $var;

if($body_message == "Ticket created by staff") $body_message = $var;

$body = str_replace("%message",$body_message,$body);

$body = str_replace("%url", $cfg->getBaseUrl(),$body);

$sentlist=array();

Please do search in all php scripts regarding how to display attachment name in email. I have ever seen it before, but I forgot in which file. That is why, now it is your turn to search it. Good luck and Cheers.

Best regards,

Masino Sinaga

15 years later
Write a Reply...