/**
* Process the contribution.
*
- * @todo - this code was previously shared with the backoffice form - some parts of this
- * function may relate to that form, not this one.
- *
- * @param CRM_Core_Form $form
* @param array $params
* @param array $result
* @param array $contributionParams
* - thankyou_date (not all forms will set this)
*
* @param CRM_Financial_DAO_FinancialType $financialType
- * @param bool $online
- * Is the form a front end form? If so set a bunch of unpredictable things that should be passed in from the form.
- *
* @param int $billingLocationID
* ID of billing location type.
* @param bool $isRecur
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
+ * @todo - this code was previously shared with the backoffice form - some parts of this
+ * function may relate to that form, not this one.
+ *
*/
- protected static function processFormContribution(
- &$form,
+ protected function processFormContribution(
$params,
$result,
$contributionParams,
$financialType,
- $online,
$billingLocationID,
$isRecur
) {
+ $form = $this;
$transaction = new CRM_Core_Transaction();
$contactID = $contributionParams['contact_id'];
$result, $receiptDate,
$recurringContributionID), $contributionParams
);
- $contributionParams['non_deductible_amount'] = self::getNonDeductibleAmount($params, $financialType, $online, $form);
+ $contributionParams['non_deductible_amount'] = self::getNonDeductibleAmount($params, $financialType, TRUE, $form);
$contributionParams['skipCleanMoney'] = TRUE;
// @todo this is the wrong place for this - it should be done as close to form submission
// as possible
$form = self::handlePledge($form, $params, $contributionParams, $pledgeID, $contribution, $isEmailReceipt);
}
- if ($online && $contribution) {
+ if ($contribution) {
CRM_Core_BAO_CustomValueTable::postProcess($params,
'civicrm_contribution',
$contribution->id,
'Contribution'
);
}
- elseif ($contribution) {
- //handle custom data.
- $params['contribution_id'] = $contribution->id;
- if (!empty($params['custom']) &&
- is_array($params['custom'])
- ) {
- CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id);
- }
- }
// Save note
if ($contribution && !empty($params['contribution_note'])) {
$noteParams = [
// CRM-19792 : set necessary fields for payment processor
CRM_Core_Payment_Form::mapParams($form->_bltID, $form->_params, $tempParams, TRUE);
- $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processFormContribution($form,
+ $membershipContribution = $this->processFormContribution(
$tempParams,
$tempParams,
$contributionParams,
$financialType,
- TRUE,
$form->_bltID,
$isRecur
);
if (!empty($form->_paymentProcessor)) {
$contributionParams['payment_instrument_id'] = $paymentParams['payment_instrument_id'] = $form->_paymentProcessor['payment_instrument_id'];
}
- $contribution = CRM_Contribute_Form_Contribution_Confirm::processFormContribution(
- $form,
+ $contribution = $this->processFormContribution(
$paymentParams,
NULL,
$contributionParams,
$financialType,
- TRUE,
$form->_bltID,
$isRecur
);