From 8a6844b370b64459ecda0c68959ff88396909e21 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Tue, 23 Apr 2013 15:36:20 -0700 Subject: [PATCH] CRM-12274 ---------------------------------------- * CRM-12274: Merge activity tables into one unified table activity contact table http://issues.civicrm.org/jira/browse/CRM-12274 --- CRM/Activity/BAO/Activity.php | 7 +++++-- api/v3/examples/ParticipantPaymentGet.php | 10 ++++++++++ tests/phpunit/api/v3/ParticipantPaymentTest.php | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index a9ddc03677..57b7c1e4d4 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -625,7 +625,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $session = CRM_Core_Session::singleton(); $id = $session->get('userID'); if (!$id) { - $id = $activity->source_contact_id; + $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); + $id = self::getActivityContact($activity->id. $sourceID); } $logParams = array( 'entity_table' => 'civicrm_activity', @@ -1696,7 +1698,6 @@ WHERE activity.id IN ($activityIds)"; $activityStatuses = CRM_Core_OptionGroup::values('activity_status'); while ($dao->fetch()) { - //$activities[$dao->activity_id]['source_contact_id'] = $dao->source_contact_id; $activities[$dao->activity_id]['id'] = $dao->activity_id; $activities[$dao->activity_id]['activity_type_id'] = $dao->activity_type_id; $activities[$dao->activity_id]['subject'] = $dao->subject; @@ -2166,6 +2167,8 @@ AND cl.modified_id = c.id // delete activity if there is no record in // civicrm_activity_contact // pointing to any other contact record. + // FIXME: this will be an awful query, figure out what function does + // and clean up $activity = new CRM_Activity_DAO_Activity(); $activity->source_contact_id = $contactId; $activity->find(); diff --git a/api/v3/examples/ParticipantPaymentGet.php b/api/v3/examples/ParticipantPaymentGet.php index 6024d1a8ba..13a068d179 100644 --- a/api/v3/examples/ParticipantPaymentGet.php +++ b/api/v3/examples/ParticipantPaymentGet.php @@ -8,6 +8,7 @@ $params = array( 'participant_id' => 4, 'contribution_id' => 1, 'version' => 3, + 'debug' => 1, ); $result = civicrm_api( 'participant_payment','get',$params ); @@ -22,6 +23,10 @@ function participant_payment_get_expectedresult(){ $expectedResult = array( 'is_error' => 0, + 'undefined_fields' => array( + '0' => 'participant_id', + '1' => 'contribution_id', + ), 'version' => 3, 'count' => 1, 'id' => 1, @@ -32,6 +37,11 @@ function participant_payment_get_expectedresult(){ 'contribution_id' => '1', ), ), + 'xdebug' => array( + 'peakMemory' => 31758384, + 'memory' => 31463600, + 'timeIndex' => '45.313442230225', + ), ); return $expectedResult ; diff --git a/tests/phpunit/api/v3/ParticipantPaymentTest.php b/tests/phpunit/api/v3/ParticipantPaymentTest.php index ce1b9e2adb..be967dfe0b 100644 --- a/tests/phpunit/api/v3/ParticipantPaymentTest.php +++ b/tests/phpunit/api/v3/ParticipantPaymentTest.php @@ -396,6 +396,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { 'participant_id' => $this->_participantID4, 'contribution_id' => $contributionID, 'version' => $this->_apiversion, + 'debug' => 1, ); $result = civicrm_api('participant_payment', 'get', $params); -- 2.25.1