Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Template Variables in Ticket Filter #5283

Merged
merged 2 commits into from Aug 6, 2020

Conversation

aydreeihn
Copy link
Contributor

This commit fixes an issue where you could not use template variables when using the 'Send an Email' filter action. All variables would just display as 'Array'.

We needed to pass the Ticket object to FA_SendEmail::apply, however, we were running the filters before the Ticket object was created. To fix this, we can add the Ticket object to vars and run the filterTicketData function again after the Ticket is created and only apply the send email filter action if the Ticket object is found.

@@ -3851,6 +3851,9 @@ static function create($vars, &$errors, $origin, $autorespond=true,
return null;

/* -------------------- POST CREATE ------------------------ */
$vars['ticket'] = $ticket;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use only certain filters with actions like Send Email, etc.

@aydreeihn
Copy link
Contributor Author

It seemed like the best way to control when we run certain filter actions (before or after ticket creation) was best handled with adding the postCreate variable to the apply functions. I passed it as its own variable rather than sending it through vars because later on in the process, we start using $this->vars instead of just $vars, and it wasn't working out at the end. I'm open to suggestions though if there is a better way to make this work with a function rather than a variable. Also, it didn't seem like there were any other actions we needed to happen postCreate. Can you guys think of any we'd need to wait to run?

This commit fixes an issue where you could not use template variables when using the 'Send an Email' filter action. All variables would just display as 'Array'.

We needed to pass the Ticket object to FA_SendEmail::apply however, we were running the filters before the Ticket object was created. To fix this, we can add the Ticket object to vars and run the filterTicketData function again after the Ticket is created and only apply the send email filter action if the Ticket object is found.
This commit controls when we run certain types of filters. If we are sending out an email, we want those filter actions to run after the ticket is created in case template variables are used. All other types of filter actions can run before the ticket is created.
@protich protich merged commit 131f4e4 into osTicket:develop Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants