CRM-12463
authoryashodha <yashodha.chaku@webaccess.co.in>
Fri, 3 May 2013 00:43:22 +0000 (06:13 +0530)
committeryashodha <yashodha.chaku@webaccess.co.in>
Fri, 3 May 2013 00:44:03 +0000 (06:14 +0530)
CRM/Contribute/Form/Contribution.php

index 351deffc59bbba96f718bdc3def2ebba60e88803..91eebcd0fad5d9945dd3266f739c58bfad43f2ce 100644 (file)
@@ -966,8 +966,12 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     }
 
     if (!empty($fields['soft_credit_amount'])) {
+      $repeat = array_count_values($fields['soft_credit_contact_select_id']);
       foreach ($fields['soft_credit_amount'] as $key => $val) {
         if (!empty($fields['soft_credit_contact_select_id'][$key])) {
+          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] && ($fields['soft_credit_amount'][$key] > $fields['total_amount'])) {
             $errors["soft_credit_amount[$key]"] = ts('Soft credit amount cannot be more than the total amount.');
           }