Skip to content

Commit

Permalink
Merge pull request #19259 from eileenmcnaughton/confirm
Browse files Browse the repository at this point in the history
Convert contributionSoft to an array
  • Loading branch information
seamuslee001 authored Dec 23, 2020
2 parents d942ded + 26f7677 commit 5974706
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CRM/Contribute/BAO/ContributionSoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ protected static function processPCP($pcp, $contribution) {
$contributionSoft = self::add($softParams);
//Send notification to owner for PCP
if ($contributionSoft->pcp_id && empty($pcpId)) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, (array) $contributionSoft);
}
}
//Delete PCP against this contribution and create new on submitted PCP information
Expand Down
27 changes: 15 additions & 12 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1227,21 +1227,24 @@ public static function processOnBehalfOrganization(&$behalfOrganization, &$conta
* This is used by contribution and also event PCPs.
*
* @param object $contribution
* @param object $contributionSoft
* @param array $contributionSoft
* Contribution object.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public static function pcpNotifyOwner($contribution, $contributionSoft) {
$params = ['id' => $contributionSoft->pcp_id];
public static function pcpNotifyOwner($contribution, array $contributionSoft) {
$params = ['id' => $contributionSoft['pcp_id']];
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $params, $pcpInfo);
$ownerNotifyID = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCPBlock', $pcpInfo['pcp_block_id'], 'owner_notify_id');
$ownerNotifyOption = CRM_Core_PseudoConstant::getName('CRM_PCP_DAO_PCPBlock', 'owner_notify_id', $ownerNotifyID);

if ($ownerNotifyOption != 'no_notifications' &&
(($ownerNotifyOption == 'owner_chooses' &&
CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $contributionSoft->pcp_id, 'is_notify')) ||
CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $contributionSoft['pcp_id'], 'is_notify')) ||
$ownerNotifyOption == 'all_owners')) {
$pcpInfoURL = CRM_Utils_System::url('civicrm/pcp/info',
"reset=1&id={$contributionSoft->pcp_id}",
"reset=1&id={$contributionSoft['pcp_id']}",
TRUE, NULL, FALSE, TRUE
);
// set email in the template here
Expand All @@ -1254,22 +1257,22 @@ public static function pcpNotifyOwner($contribution, $contributionSoft) {
if (!$email) {
[$donorName, $email] = CRM_Contact_BAO_Contact_Location::getEmailDetails($contribution->contact_id);
}
[$ownerName, $ownerEmail] = CRM_Contact_BAO_Contact_Location::getEmailDetails($contributionSoft->contact_id);
[$ownerName, $ownerEmail] = CRM_Contact_BAO_Contact_Location::getEmailDetails($contributionSoft['contact_id']);
$tplParams = [
'page_title' => $pcpInfo['title'],
'receive_date' => $contribution->receive_date,
'total_amount' => $contributionSoft->amount,
'total_amount' => $contributionSoft['amount'],
'donors_display_name' => $donorName,
'donors_email' => $email,
'pcpInfoURL' => $pcpInfoURL,
'is_honor_roll_enabled' => $contributionSoft->pcp_display_in_roll,
'currency' => $contributionSoft->currency,
'is_honor_roll_enabled' => $contributionSoft['pcp_display_in_roll'],
'currency' => $contributionSoft['currency'],
];
$domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
$sendTemplateParams = [
'groupName' => 'msg_tpl_workflow_contribution',
'valueName' => 'pcp_owner_notify',
'contactId' => $contributionSoft->contact_id,
'contactId' => $contributionSoft['contact_id'],
'toEmail' => $ownerEmail,
'toName' => $ownerName,
'from' => "$domainValues[0] <$domainValues[1]>",
Expand All @@ -1291,7 +1294,7 @@ public static function pcpNotifyOwner($contribution, $contributionSoft) {
*
* @return array
*/
public static function processPcp(&$page, $params) {
public static function processPcp(&$page, $params): array {
$params['pcp_made_through_id'] = $page->_pcpId;
$page->assign('pcpBlock', TRUE);
if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) {
Expand Down Expand Up @@ -1327,7 +1330,7 @@ public static function processPcp(&$page, $params) {
* Line items specifically relating to memberships.
*/
protected function processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams,
$membershipLineItems) {
$membershipLineItems): void {

$membershipTypeIDs = (array) $membershipParams['selectMembership'];
$membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs);
Expand Down

0 comments on commit 5974706

Please sign in to comment.