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

Fix Mailing_Event_BAO_Reply to use token processor #24446

Closed
wants to merge 1 commit into from

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 2, 2022

Overview

Fix Mailing_Event_BAO_Reply to use token processor

Before

Uses legacy domain token replacement

After

Uses token processor

Technical Details

See #24235

Comments

We really should add an api for this stuff - there is the sendTemplate function but it is really hard to understand how to use it & I think there is another 'light weight' version but we just need an api with sensible params not a bunch of internal functions

I think there was some sort of blocker around permissions - but we actually have a permission we use for the v3 api ....

@civibot civibot bot added the master label Sep 2, 2022
@civibot
Copy link

civibot bot commented Sep 2, 2022

(Standard links)

Verified

This commit was signed with the committer’s verified signature.
nikukyugamer Osamu Takiya
@eileenmcnaughton
Copy link
Contributor Author

test this please


CRM_Mailing_BAO_Mailing::addMessageIdHeader($params, 'a', $eq->job_id, $queue_id, $eq->hash);
if (CRM_Core_BAO_MailSettings::includeMessageId()) {
$params['messageId'] = $params['Message-ID'];
}
CRM_Utils_Mail::send($params);
\CRM_Core_BAO_MessageTemplate::sendTemplate([
'envelope' => $params,
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton I'm not seeing how envelope key is being used I would have thought that this should be

\CRM_Core_BAO_MessageTemplate::sentTemplate(array_merge($params, [
   'tokenContext => ...
 ]));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah - that function is horrible - really confusing. We really need a sane api wrapper for it

Copy link
Contributor

Choose a reason for hiding this comment

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

Well writing the unit test helped me prove that thing works so yeh bloody confusing that is for sure

$eq = CRM_Core_DAO::executeQuery(
'SELECT civicrm_email.email as email,
civicrm_mailing_event_queue.job_id as job_id,
civicrm_mailing_event_queuee.hash as hash
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton missing a comma at the end of this one and also a typo in the table name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks - will try to get to back to this before the rc is cut - otherwise will revert #24235 or do a temp patch on that

@seamuslee001
Copy link
Contributor

Jenkins re test this please (this should fail given the mysql issues I commented above about)

@eileenmcnaughton
Copy link
Contributor Author

I'm gonna close this & come back to it - should be easy now @seamuslee001 has written a test but I'm not really hapy with that awful BAO function & would like to discuss getting working api for it. In the meantime I'll revert the regressive part of #24235

@eileenmcnaughton
Copy link
Contributor Author

actually I think those others are OK / non-regressive. So putting this on the back burner for now - but it will be great when we finally do get rid of those old domain token calls & the test is there now...

@eileenmcnaughton eileenmcnaughton deleted the dom_tokens branch December 28, 2023 06:48
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

2 participants