Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,372
    • Issues 1,372
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • CiviCRM Core
  • Issues
  • #1902

Closed
Open
Created Jul 22, 2020 by AllenShaw@AllenShawDeveloper

"Contribution Source" profile field has no effect on new contribution

Overview

Profiles allow inclusion of the "Contributions :: Contribution Source" on contribution pages, but any value entered therein is disregarded when saving a new contribution.

Steps to reproduce (on dmaster.demo.civicrm.org)

Reproduction steps

  1. Start with the Name and Address profile, and add to this profile the field "Contributions :: Contribution Source"
  2. Add this profile to a Contribution Page, e.g., "Help Support CiviCRM!"
  3. Open the Contribution Page, and fill in the form to submit an online contribution; for the Contribution Source field, enter a testable value such as "test source".
  4. Submit the contribution
  5. Find the contribution in CiviCRM, and open it; examine the value of the "Source" field.

Current behaviour

  • The "Source" field reads "Online Contribution: Help Support CiviCRM!"

Expected behaviour

  • The "Source" field should read "test source"

Environment information

The above repro steps were performed today on dmaster.demo.civicrm.org.

Comments

Testing on local dev indicates that a PR like this would produce the expected behavior:

diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php
index a9e84fa..8bbb2c5 100644
--- a/CRM/Contribute/BAO/Contribution/Utils.php
+++ b/CRM/Contribute/BAO/Contribution/Utils.php
@@ -83,6 +83,9 @@ class CRM_Contribute_BAO_Contribution_Utils {
       $form->_values['amount'] = $form->_params['amount'];
     }
 
+    if (isset($paymentParams['contribution_source'])) {
+      $paymentParams['source'] = $paymentParams['contribution_source'];
+    }
     if ($isPaymentTransaction) {
       $contributionParams = [
         'id' => $paymentParams['contribution_id'] ?? NULL,
@@ -142,9 +145,6 @@ class CRM_Contribute_BAO_Contribution_Utils {
 
       $paymentParams['contributionID'] = $contribution->id;
       $paymentParams['contributionPageID'] = $contribution->contribution_page_id;
-      if (isset($paymentParams['contribution_source'])) {
-        $paymentParams['source'] = $paymentParams['contribution_source'];
-      }
 
       if (!empty($form->_params['is_recur']) && $contribution->contribution_recur_id) {
         $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking