CRM-14950 exit on completetransaction is already completed
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 7 Jul 2014 12:11:35 +0000 (00:11 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 7 Jul 2014 12:11:35 +0000 (00:11 +1200)
api/v3/Contribution.php

index cd9f8f79d317a59fce43b5878749053889b40660..37fbc9468732995ed24b03a67a7cf479a5e343df 100644 (file)
@@ -376,6 +376,9 @@ function civicrm_api3_contribution_completetransaction(&$params) {
     if(!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)){
       throw new API_Exception('failed to load related objects');
     }
+    elseif ($contribution['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
+      throw new API_Exception(ts('Contribution already completed'));
+    }
     $objects = $contribution->_relatedObjects;
     $objects['contribution'] = &$contribution;
     $input['component'] = $contribution->_component;