From 5850d2e97750e06720cf23a05785739b27c0619e Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 5 Oct 2015 16:50:12 +0530 Subject: [PATCH] CRM-17286 - add 'Soft Credit For Contact ID' to the 'default' (Primary fields) export AND to the available fields for Selected fields export --- CRM/Contribute/BAO/Contribution.php | 6 ++++++ CRM/Contribute/BAO/Query.php | 1 + tests/phpunit/WebTest/Export/ContactTest.php | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 47410603f5..142d44318b 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -744,6 +744,12 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { 'where' => 'civicrm_contribution_soft.contribution_id', 'data_type' => CRM_Utils_Type::T_INT, ), + 'contribution_soft_credit_contact_id' => array( + 'name' => 'contribution_soft_credit_contact_id', + 'title' => 'Soft Credit For Contact ID', + 'where' => 'civicrm_contribution_soft.contact_id', + 'data_type' => CRM_Utils_Type::T_INT, + ), ); // CRM-16713 - contribution search by Premiums on 'Find Contribution' form. diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 4ff886c356..1a2a7d8e83 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -788,6 +788,7 @@ class CRM_Contribute_BAO_Query { 'contribution_soft_credit_type' => 1, ); if ($isExportMode) { + $properties['contribution_soft_credit_contact_id'] = 1; $properties['contribution_soft_credit_contribution_id'] = 1; } return $properties; diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index 34adfbb8ee..f2ec496270 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -484,6 +484,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { $softCreditFname = substr(sha1(rand()), 0, 7); $softCreditLname = substr(sha1(rand()), 0, 7); $this->webtestAddContact($softCreditFname, $softCreditLname, FALSE); + $softContactId = $this->urlArg('cid'); $firstName = 'a' . substr(sha1(rand()), 0, 7); $this->openCiviPage('contribute/add', 'reset=1&action=add&context=standalone', '_qf_Contribution_upload-bottom'); @@ -537,6 +538,9 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { $this->select("mapper_1_3_0", 'Contribution'); $this->select("mapper_1_3_1", 'Soft Credit Type'); + $this->select("mapper_1_4_0", 'Contribution'); + $this->select("mapper_1_4_1", 'Soft Credit For Contact ID'); + $csvFile = $this->downloadCSV("_qf_Map_next-bottom", 'CiviCRM_Contribution_Search.csv'); // All other rows to be check. @@ -546,6 +550,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { 'Soft Credit For' => "{$softCreditLname}, {$softCreditFname}", 'Soft Credit For Contribution ID' => $contributionID, 'Soft Credit Type' => 'Solicited', + 'Soft Credit For Contact ID' => $softContactId, ), ); -- 2.25.1