CRM-16535 Fix-Cannot record contributions in a data entry batch of type pledge payment
authorpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 29 May 2015 09:21:34 +0000 (14:51 +0530)
committerpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 29 May 2015 09:21:34 +0000 (14:51 +0530)
----------------------------------------
* CRM-16535: Cannot record contributions in a data entry batch of type pledge payment
  https://issues.civicrm.org/jira/browse/CRM-16535

CRM/Batch/Form/Entry.php

index fea1fe186874c2c0e9643ae6433d11bf23a4b072..6357f3ed4626a9b163a7fc3b3c443a08e7165509 100755 (executable)
@@ -323,8 +323,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
     }
     if ($self->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) {
       foreach (array_unique($params["open_pledges"]) as $value) {
-        $duplicateRows = array_keys($params["open_pledges"], $value);
-        if (count($duplicateRows) > 1) {
+        if (!empty($value)) {
+          $duplicateRows = array_keys($params["open_pledges"], $value);
+        }
+        if (!empty($duplicateRows) && count($duplicateRows) > 1) {
           foreach ($duplicateRows as $key) {
             $errors["open_pledges[$key]"] = ts('You can not record two payments for the same pledge in a single batch.');
           }