X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FBAO%2FContribution.php;h=3f6fc427cad0aec507425ce8901f9329ae14c851;hb=5f686a2809832bf030c5230415f9e529efdb5450;hp=2937689fd2be5948bafc8c6632a459fda75c798c;hpb=1bd308df2f6ae7d16191554634b10f1e6f5ebb66;p=civicrm-core.git diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 2937689fd2..3f6fc427ca 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2148,7 +2148,8 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ //CRM-18805 -- Contribution page not recorded on recurring transactions, Recurring contribution payments //do not create CC or BCC emails or profile notifications. //The if is just to be safe. Not sure if we can ever arrive with this unset - if (isset($contribution->contribution_page_id)) { + // but per CRM-19478 it seems it can be 'null' + if (isset($contribution->contribution_page_id) && is_numeric($contribution->contribution_page_id)) { $contributionParams['contribution_page_id'] = $contribution->contribution_page_id; } @@ -2801,6 +2802,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $template->assign('first_name', $this->_relatedObjects['contact']->first_name); $template->assign('last_name', $this->_relatedObjects['contact']->last_name); $template->assign('displayName', $this->_relatedObjects['contact']->display_name); + + // For some unit tests contribution cannot contain paymentProcessor information + $billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode']; + $template->assign('contributeMode', CRM_Utils_Array::value($billingMode, CRM_Core_SelectValues::contributeMode())); + if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) { $values['useForMember'] = TRUE; } @@ -2884,7 +2890,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac CRM_Utils_Date::processDate($this->receive_date) ); $values['receipt_date'] = (empty($this->receipt_date) ? NULL : $this->receipt_date); - $template->assign('contributeMode', 'notify'); $template->assign('action', $this->is_test ? 1024 : 1); $template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', @@ -4876,7 +4881,7 @@ LIMIT 1;"; if (!empty($contribution->source)) { return $contribution->source; } - elseif (!empty($contribution->contribution_page_id)) { + elseif (!empty($contribution->contribution_page_id) && is_numeric($contribution->contribution_page_id)) { $contributionPageTitle = civicrm_api3('ContributionPage', 'getvalue', array( 'id' => $contribution->contribution_page_id, 'return' => 'title',