CRM-20420 - PDFLetterCommon::createActivities() - Simplify. Address comment.
authorTim Otten <totten@civicrm.org>
Wed, 12 Apr 2017 05:42:22 +0000 (22:42 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 12 Apr 2017 21:07:47 +0000 (14:07 -0700)
The comment asks why the code appears to use of `$contactIds` and
`$form->contactIds` interchangeably.  If you grep for calls to
`createActivities()`, all 3-ish callpaths do set `$contactIds` based on
`$form->contactIds` -- so they are the same.

```
// Look for calls to createActivities()
$ grep -r ::createActivities CRM/ Civi/ api/
CRM/Contact/Form/Task/PDFLetterCommon.php:      self::createActivities($form, $html_message, $form->_contactIds);
CRM/Member/Form/Task/PDFLetterCommon.php:    self::createActivities($form, $html_message, $contactIDs);
CRM/Contribute/Form/Task/PDFLetterCommon.php:    self::createActivities($form, $html_message, $form->_contactIds);

// Look for calls to createActivities via CRM/Member/Form/Task/PDFLetterCommon

$ rgrep -r postProcessMembers\( CRM/ Civi/ api/
CRM/Member/Form/Task/PDFLetter.php:    CRM_Member_Form_Task_PDFLetterCommon::postProcessMembers(
CRM/Member/Form/Task/PDFLetterCommon.php:  public static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs) {
```

CRM/Contact/Form/Task/PDFLetterCommon.php

index ae4a758fb0094146483fc7ee70ee57f6655341e9..d2869f3d2b7dc71b3e0ceee7c2766178b2fb9389 100644 (file)
@@ -461,8 +461,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
 
-    //@todo why are we using $form->_contactIds here & contactIds above - need comment
-    foreach ($form->_contactIds as $contactId) {
+    foreach ($contactIds as $contactId) {
       $activityTargetParams = array(
         'activity_id' => empty($activity->id) ? $activityIds[$contactId] : $activity->id,
         'contact_id' => $contactId,