proposed workaround for CRM-17235
authorsystopia <endres@systopia.de>
Wed, 18 May 2016 13:31:31 +0000 (15:31 +0200)
committersystopia <endres@systopia.de>
Wed, 18 May 2016 13:31:31 +0000 (15:31 +0200)
CRM/Contribute/BAO/Contribution.php

index df48aab0a946a9d641677c4c9d4ecbd7256d73bf..15027ec83ffd6d3d8dda485ba12aecce80449e82 100644 (file)
@@ -3795,10 +3795,8 @@ WHERE con.id = {$contributionId}
     do {
       $creditNoteNum++;
       $creditNoteId = CRM_Utils_Array::value('credit_notes_prefix', $prefixValue) . "" . $creditNoteNum;
-      $result = civicrm_api3('Contribution', 'getcount', array(
-        'sequential' => 1,
-        'creditnote_id' => $creditNoteId,
-      ));
+      $params = array(1 => array($creditNoteId, 'String'));
+      $result = CRM_Core_DAO::singleValueQuery("SELECT count(id) FROM civicrm_contribution WHERE creditnote_id = %1", $params);
     } while ($result > 0);
 
     return $creditNoteId;