X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FBAO%2FContribution.php;h=811b51d87b3d9669396d1d4e0a65712339040652;hb=acef22a2302a1ef7c0280affc2322cb249cb4378;hp=a91d0ad2e4d1d493ea18c39dd44cb55bf2bd8899;hpb=816aa293ee0b48672114df4cad57e1ca0c362599;p=civicrm-core.git diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index a91d0ad2e4..811b51d87b 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -367,22 +367,6 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { } } - // check if activity record exist for this contribution, if - // not add activity - $activity = new CRM_Activity_DAO_Activity(); - $activity->source_record_id = $contribution->id; - $activity->activity_type_id = CRM_Core_OptionGroup::getValue('activity_type', - 'Contribution', - 'name' - ); - if (!$activity->find(TRUE)) { - CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline'); - } - else { - // 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); - } - // Handle soft credit and / or link to personal campaign page $softIDs = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id); @@ -436,6 +420,22 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $transaction->commit(); + // check if activity record exist for this contribution, if + // not add activity + $activity = new CRM_Activity_DAO_Activity(); + $activity->source_record_id = $contribution->id; + $activity->activity_type_id = CRM_Core_OptionGroup::getValue('activity_type', + 'Contribution', + 'name' + ); + if (!$activity->find(TRUE)) { + CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline'); + } + else { + // 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); + } + // do not add to recent items for import, CRM-4399 if (empty($params['skipRecentView'])) { $url = CRM_Utils_System::url('civicrm/contact/view/contribution', @@ -1632,7 +1632,9 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ } // CRM-15735-to update the membership status as per the contribution receive date + $joinDate = NULL; if (!empty($params['receive_date'])) { + $joinDate = $params['receive_date']; $status = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($membership->start_date, $membership->end_date, $membership->join_date, @@ -1651,7 +1653,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ $dates['join_date'] = CRM_Utils_Date::customFormat($currentMembership['join_date'], $format); } else { - $dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membership->membership_type_id, NULL, NULL, NULL, $numterms); + $dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membership->membership_type_id, $joinDate, NULL, NULL, $numterms); } //get the status for membership.