Skip to content
Snippets Groups Projects
Commit 4050a811 authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #2315 from davecivicrm/CRM-14034

CRM-14034 - Fix soft credit form rule to handle editing contributions us...
parents 6ab36750 1100eb17
No related branches found
No related tags found
No related merge requests found
......@@ -920,7 +920,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
}
}
$softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields);
$softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self);
if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
$sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']);
......
......@@ -130,7 +130,7 @@ class CRM_Contribute_Form_SoftCredit {
* @access public
* @static
*/
static function formRule($fields) {
static function formRule($fields, $errors, $self) {
$errors = array();
// if honor roll fields are populated but no PCP is selected
......@@ -150,7 +150,7 @@ class CRM_Contribute_Form_SoftCredit {
if ($repeat[$fields['soft_credit_contact_select_id'][$key]] > 1) {
$errors["soft_credit_contact_select_id[$key]"] = ts('You cannot enter multiple soft credits for the same contact.');
}
if ($fields['soft_credit_amount'][$key]
if ($self->_action == CRM_Core_Action::ADD && $fields['soft_credit_amount'][$key]
&& (CRM_Utils_Rule::cleanMoney($fields['soft_credit_amount'][$key]) > CRM_Utils_Rule::cleanMoney($fields['total_amount']))) {
$errors["soft_credit_amount[$key]"] = ts('Soft credit amount cannot be more than the total amount.');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment