}
list($values['customPost_grouptitle'], $values['customPost']) = self::getProfileNameAndFields($postID, $userID, $params['custom_post_id']);
}
+ // Assign honoree values for the receipt. But first, stop any leaks from
+ // previously assigned values.
+ $template->assign('honoreeProfile', []);
+ $template->assign('honorName', NULL);
if (isset($values['honor'])) {
$honorValues = $values['honor'];
$template->_values = ['honoree_profile_id' => $values['honoree_profile_id']];
// use either the contribution or membership receipt, based on whether it’s a membership-related contrib or not
$sendTemplateParams = [
- 'groupName' => !empty($values['isMembership']) ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
- 'valueName' => !empty($values['isMembership']) ? 'membership_online_receipt' : 'contribution_online_receipt',
+ 'workflow' => !empty($values['isMembership']) ? 'membership_online_receipt' : 'contribution_online_receipt',
'contactId' => $contactID,
'tplParams' => $tplParams,
+ 'tokenContext' => $tplParams['contributionID'] ? ['contributionId' => (int) $tplParams['contributionID'], 'contactId' => $contactID] : ['contactId' => $contactID],
'isTest' => $isTest,
'PDFFilename' => 'receipt.pdf',
];
// Special logic for fields whose options depend on context or properties
switch ($fieldName) {
case 'financial_type_id':
- // @fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
- // @fixme - https://lab.civicrm.org/dev/core/issues/547 if CiviContribute not enabled this causes an invalid query
- // because $relationTypeId is not set in CRM_Financial_BAO_FinancialType::getIncomeFinancialType()
- if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
- return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
+ // https://lab.civicrm.org/dev/core/issues/547 if CiviContribute not enabled this causes an invalid query
+ // @todo - the component is enabled check should be done within getIncomeFinancialType
+ // It looks to me like test cover was NOT added to cover the change
+ // that added this so we need to assume there is no test cover
+ if (CRM_Core_Component::isEnabled('CiviContribute')) {
+ // if check_permission has been passed in (not Null) then restrict.
+ return CRM_Financial_BAO_FinancialType::getIncomeFinancialType($props['check_permissions'] ?? TRUE);
}
return [];
}