Skip to content

Instantly share code, notes, and snippets.

@monishdeb
Created July 7, 2015 08:12
Show Gist options
  • Save monishdeb/7b818bad715d5fa31067 to your computer and use it in GitHub Desktop.
Save monishdeb/7b818bad715d5fa31067 to your computer and use it in GitHub Desktop.
diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php
index d46fb26..c7e3ce8 100644
--- a/CRM/Contribute/BAO/Contribution.php
+++ b/CRM/Contribute/BAO/Contribution.php
@@ -387,7 +387,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
$contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($softParams);
//Send notification to owner for PCP
- if ($contributionSoft->pcp_id) {
+ if ($contributionSoft->pcp_id && empty($pcpId)) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
}
}
diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php
index d37164e..b865048 100644
--- a/CRM/Contribute/Form/Contribution.php
+++ b/CRM/Contribute/Form/Contribution.php
@@ -1153,7 +1153,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
$isEmpty = array_keys(array_flip($submittedValues['soft_credit_contact_id']));
if ($this->_id && count($isEmpty) == 1 && key($isEmpty) == NULL) {
//Delete existing soft credit records if soft credit list is empty on update
- CRM_Contribute_BAO_ContributionSoft::del(array('contribution_id' => $this->_id));
+ CRM_Contribute_BAO_ContributionSoft::del(array('contribution_id' => $this->_id, 'pcp_id' => 0));
}
else {
//build soft credit params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment