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

CRM-20577 - When creating an activity per-contact when sending letters, store the version with rendered tokens #10348

Merged
merged 3 commits into from
Jul 28, 2017

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented May 13, 2017

In addition to the unit test there is a minor change to not do the early return before assigning variables
if smarty is not set. This doesn't really have any performance advantage, as they are already calculated,
blocks the unit test and also blocks using these variables from outside extensions


@@ -335,9 +335,6 @@ public static function combineContributions($existing, $contribution, $separator
* @param int $groupByID
*/
public static function assignCombinedContributionValues($contact, $contributions, $groupBy, $groupByID) {
if (!defined('CIVICRM_MAIL_SMARTY') || !CIVICRM_MAIL_SMARTY) {
return;
}
CRM_Core_Smarty::singleton()->assign('contact_aggregate', $contact['contact_aggregate']);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This early return actually adds no value. No performance benefit and it makes it harder for extensions & unit tests to interact

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@eileenmcnaughton eileenmcnaughton changed the title [nfc] Add Unit test for group by in pdf letters. CRM-20577 - When creating an activity per-contact when sending letters, store the version with rendered tokens May 15, 2017
// This seems silly, but the old behavior was to first check `_cid`
// and then use the provided `$contactIds`. Probably not even necessary,
// but difficult to audit.
$contactIds = $form->_cid ? array($form->_cid) : $form->_contactIds;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved this weirdness out of the shared function to each form so we can work to remove it - impossible to ever get rid of it, per comments, if hidden in a shared function

In addition to the unit test there is a minor change to not do the early return before assigning variables
if smarty is not set. This doesn't really have any performance advantage, as they are already calculated,
blocks the unit test and also blocks using these variables from outside extensions
(At least, this covers contributions at this stage).

I have also tried to move towards clearer inputs & outpus on createActivities, with the
weirdness around contactIds being moved up to the forms themselves and
not being passed in. Would prefer not to see form passed in either but, next time.

Unit tests cover emails & activity create (for the first time)
@monishdeb
Copy link
Member

Tested, working fine. The changes made in createActivities(...) are handled properly on all other places. The fix doesn't cause any unintended regressions.

@monishdeb monishdeb merged commit f3742f7 into civicrm:master Jul 28, 2017
@eileenmcnaughton eileenmcnaughton deleted the token branch July 29, 2017 02:54
@eileenmcnaughton
Copy link
Contributor Author

Thanks @monishdeb

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.

4 participants