Merge pull request #10162 from yashodha/CRM-20429
[civicrm-core.git] / CRM / Utils / Token.php
index 26209d40e1ea92bfe97b26f3dd0825f262af0182..1353e2646008fd249bfbc032ef52f069450497e4 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  */
 
 /**
@@ -1335,73 +1335,6 @@ class CRM_Utils_Token {
     return $details;
   }
 
-  /**
-   * Gives required details of contribuion in an indexed array format so we
-   * can iterate in a nice loop and do token evaluation
-   *
-   * @param array $contributionIDs
-   * @param array $returnProperties
-   *   Of required properties.
-   * @param array $extraParams
-   *   Extra params.
-   * @param array $tokens
-   *   The list of tokens we've extracted from the content.
-   * @param string $className
-   *
-   * @return array
-   */
-  public static function getContributionTokenDetails(
-    $contributionIDs,
-    $returnProperties = NULL,
-    $extraParams = NULL,
-    $tokens = array(),
-    $className = NULL
-  ) {
-    // @todo this function basically replicates calling
-    // civicrm_api3('contribution', 'get', array('id' => array('IN' => array())
-    if (empty($contributionIDs)) {
-      // putting a fatal here so we can track if/when this happens
-      CRM_Core_Error::fatal();
-    }
-
-    $details = array();
-
-    // no apiQuery helper yet, so do a loop and find contribution by id
-    foreach ($contributionIDs as $contributionID) {
-
-      $dao = new CRM_Contribute_DAO_Contribution();
-      $dao->id = $contributionID;
-
-      if ($dao->find(TRUE)) {
-
-        $details[$dao->id] = array();
-        CRM_Core_DAO::storeValues($dao, $details[$dao->id]);
-
-        // do the necessary transformation
-        if (!empty($details[$dao->id]['payment_instrument_id'])) {
-          $piId = $details[$dao->id]['payment_instrument_id'];
-          $pis = CRM_Contribute_PseudoConstant::paymentInstrument();
-          $details[$dao->id]['payment_instrument'] = $pis[$piId];
-        }
-        if (!empty($details[$dao->id]['campaign_id'])) {
-          $campaignId = $details[$dao->id]['campaign_id'];
-          $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
-          $details[$dao->id]['campaign'] = $campaigns[$campaignId];
-        }
-
-        if (!empty($details[$dao->id]['financial_type_id'])) {
-          $financialtypeId = $details[$dao->id]['financial_type_id'];
-          $ftis = CRM_Contribute_PseudoConstant::financialType();
-          $details[$dao->id]['financial_type'] = $ftis[$financialtypeId];
-        }
-
-        // @todo call a hook to get token contribution details
-      }
-    }
-
-    return $details;
-  }
-
   /**
    * Get Membership Token Details.
    * @param array $membershipIDs