$contactID = $contributionParams['contact_id'];
$isEmailReceipt = !empty($form->_values['is_email_receipt']);
- // How do these vary from params? These are currently passed to
- // - custom data function....
- $formParams = $form->_params;
- $isSeparateMembershipPayment = empty($formParams['separate_membership_payment']) ? FALSE : TRUE;
- $pledgeID = empty($formParams['pledge_id']) ? NULL : $formParams['pledge_id'];
+ $isSeparateMembershipPayment = empty($params['separate_membership_payment']) ? FALSE : TRUE;
+ $pledgeID = empty($params['pledge_id']) ? NULL : $params['pledge_id'];
if (!$isSeparateMembershipPayment && !empty($form->_values['pledge_block_id']) &&
- (!empty($formParams['is_pledge']) || $pledgeID)) {
+ (!empty($params['is_pledge']) || $pledgeID)) {
$isPledge = TRUE;
}
else {
$receiptDate = $now;
}
- // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
- if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) {
- // if its due to pcp
- if (!empty($params['pcp_made_through_id'])) {
- $contributionParams['soft_credit_to'] = CRM_Core_DAO::getFieldValue(
- 'CRM_PCP_DAO_PCP',
- $params['pcp_made_through_id'],
- 'contact_id'
- );
- // Pass these details onto with the contribution to make them
- // available at hook_post_process, CRM-8908
- // @todo - obsolete?
- $params['soft_credit_to'] = $contributionParams['soft_credit_to'];
- }
- else {
- $contributionParams['soft_credit_to'] = CRM_Utils_Array::value('soft_credit_to', $params);
- }
- }
-
if (isset($params['amount'])) {
$contributionParams = array_merge(self::getContributionParams(
$params, $financialType->id, $nonDeductibleAmount, TRUE,
$form->_contributionID = $contribution->id;
}
- //CRM-13981, processing honor contact into soft-credit contribution
- CRM_Contact_Form_ProfileContact::postProcess($form);
+ // process soft credit / pcp params first
+ CRM_Contribute_BAO_ContributionSoft::formatSoftCreditParams($params, $form);
- // process soft credit / pcp pages
- CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
+ //CRM-13981, processing honor contact into soft-credit contribution
+ CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
//handle pledge stuff.
if ($isPledge) {
if ($pledgeID) {
//when user doing pledge payments.
//update the schedule when payment(s) are made
- foreach ($form->_params['pledge_amount'] as $paymentId => $dontCare) {
+ foreach ($params['pledge_amount'] as $paymentId => $dontCare) {
$scheduledAmount = CRM_Core_DAO::getFieldValue(
'CRM_Pledge_DAO_PledgePayment',
$paymentId,
}
if ($online && $contribution) {
- CRM_Core_BAO_CustomValueTable::postProcess($form->_params,
+ CRM_Core_BAO_CustomValueTable::postProcess($params,
'civicrm_contribution',
$contribution->id,
'Contribution'
}
}
- /**
- * Function used to save pcp / soft credit entry.
- *
- * This is used by contribution and also event pcps
- *
- * @param array $params
- * @param object $contribution
- * Contribution object.
- */
- public static function processPcpSoft(&$params, &$contribution) {
- // Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
- if (!empty($params['soft_credit_to'])) {
- $contributionSoftParams = array();
- foreach (array(
- 'pcp_display_in_roll',
- 'pcp_roll_nickname',
- 'pcp_personal_note',
- 'amount',
- ) as $val) {
- if (!empty($params[$val])) {
- $contributionSoftParams[$val] = $params[$val];
- }
- }
-
- $contributionSoftParams['contact_id'] = $params['soft_credit_to'];
- // add contribution id
- $contributionSoftParams['contribution_id'] = $contribution->id;
- // add pcp id
- $contributionSoftParams['pcp_id'] = $params['pcp_made_through_id'];
-
- $contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
-
- $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
-
- //Send notification to owner for PCP
- if ($contributionSoft->id && $contributionSoft->pcp_id) {
- CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
- }
- }
- }
-
/**
* Function used to send notification mail to pcp owner.
*