CRM-18287: Cannot cancel pledge
authoryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 28 Mar 2016 08:38:09 +0000 (14:08 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 28 Mar 2016 08:38:09 +0000 (14:08 +0530)
----------------------------------------
* CRM-18287: Cannot cancel pledge
  https://issues.civicrm.org/jira/browse/CRM-18287

CRM/Pledge/BAO/Pledge.php

index bd77b43a1862abf6e210b8cd83cb700128643c4e..8687d908b922e6d93d835b9d0329d4f46e00a77c 100644 (file)
@@ -1108,10 +1108,11 @@ SELECT  pledge.contact_id              as contact_id,
    * @param int $pledgeID
    */
   public static function cancel($pledgeID) {
-    $statuses = array_flip(CRM_Contribute_PseudoConstant::contributionStatus());
     $paymentIDs = self::findCancelablePayments($pledgeID);
+    $status = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
+    $cancelled = array_search('Cancelled', $status);
     CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, $paymentIDs, NULL,
-      $statuses['Cancelled'], 0, FALSE, TRUE
+      $cancelled, 0, FALSE, TRUE
     );
   }