From: Tim Otten Date: Wed, 12 Apr 2017 05:42:22 +0000 (-0700) Subject: CRM-20420 - PDFLetterCommon::createActivities() - Simplify. Address comment. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c2c77efd1f5bceb0b6a3aba8c1d4987502111245;p=civicrm-core.git CRM-20420 - PDFLetterCommon::createActivities() - Simplify. Address comment. 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) { ``` --- diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index ae4a758fb0..d2869f3d2b 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -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,