Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Remove now non-variable variables from previously shared code #22284

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ protected function processFormContribution(
$result, $receiptDate,
$recurringContributionID), $contributionParams
);
$contributionParams['non_deductible_amount'] = CRM_Contribute_Form_Contribution_Confirm::getNonDeductibleAmount($params, $financialType, $online, $form);
$contributionParams['non_deductible_amount'] = CRM_Contribute_Form_Contribution_Confirm::getNonDeductibleAmount($params, $financialType, FALSE, $form);
$contributionParams['skipCleanMoney'] = TRUE;
// @todo this is the wrong place for this - it should be done as close to form submission
// as possible
Expand Down
35 changes: 9 additions & 26 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,6 @@ protected function postProcessPremium($premiumParams, $contribution) {
/**
* 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
Expand All @@ -1033,9 +1029,6 @@ protected function postProcessPremium($premiumParams, $contribution) {
* - 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
Expand All @@ -1045,17 +1038,19 @@ protected function postProcessPremium($premiumParams, $contribution) {
*
* @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'];

Expand Down Expand Up @@ -1100,7 +1095,7 @@ protected static function processFormContribution(
$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
Expand Down Expand Up @@ -1143,22 +1138,13 @@ protected static function processFormContribution(
$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 = [
Expand Down Expand Up @@ -1845,12 +1831,11 @@ protected function processSecondaryFinancialTransaction($contactID, &$form, $tem
// 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
);
Expand Down Expand Up @@ -2711,13 +2696,11 @@ public function processConfirm(
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
);
Expand Down