From: Web Access Date: Tue, 17 May 2016 11:32:48 +0000 (+0530) Subject: CRM-18406: When a contribution is edited it doesn't update the activity to match X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6e143f06a189e3cc2c3de6b3d07537baa1a4d98e;p=civicrm-core.git CRM-18406: When a contribution is edited it doesn't update the activity to match CRM-18406: Warning Fix --- diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 154729bbee..8256673f34 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -1880,6 +1880,9 @@ SELECT display_name 'campaign_id' => $activity->campaign_id, ); + if (!empty($activity->activity_id)) { + $activityParams['id'] = $activity->activity_id; + } // create activity with target contacts $session = CRM_Core_Session::singleton(); $id = $session->get('userID'); diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index b6319bed46..e5f2a3d39e 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -541,16 +541,14 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { 'Contribution', 'name' ); - if (!$activity->find(TRUE)) { - if (empty($contribution->contact_id)) { - $contribution->find(TRUE); - } - CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline'); - } - else { + + //CRM-18406: Update activity when edit contribution. + if ($activity->find(TRUE)) { // CRM-13237 : if activity record found, update it with campaign id of contribution CRM_Core_DAO::setFieldValue('CRM_Activity_BAO_Activity', $activity->id, 'campaign_id', $contribution->campaign_id); + $contribution->activity_id = $activity->id; } + CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline'); // do not add to recent items for import, CRM-4399 if (empty($params['skipRecentView'])) {