//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;
}
$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;
}
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',
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',