当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contribute_BAO_Contribution::loadRelatedObjects方法代码示例

本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::loadRelatedObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::loadRelatedObjects方法的具体用法?PHP CRM_Contribute_BAO_Contribution::loadRelatedObjects怎么用?PHP CRM_Contribute_BAO_Contribution::loadRelatedObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contribute_BAO_Contribution的用法示例。


在下文中一共展示了CRM_Contribute_BAO_Contribution::loadRelatedObjects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processFailedTransaction

 /**
  * Process failed transaction - would be nice to do this through api too but for now lets put in
  * here - this is a copy & paste of the completetransaction api
  * @param unknown $contributionID
  */
 function processFailedTransaction($contributionID)
 {
     $input = $ids = array();
     $contribution = new CRM_Contribute_BAO_Contribution();
     $contribution->id = $contributionID;
     $contribution->find(TRUE);
     if (!$contribution->id == $contributionID) {
         throw new Exception('A valid contribution ID is required', 'invalid_data');
     }
     try {
         if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
             throw new Exception('failed to load related objects');
         }
         $objects = $contribution->_relatedObjects;
         $objects['contribution'] =& $contribution;
         $input['component'] = $contribution->_component;
         $input['is_test'] = $contribution->is_test;
         $input['amount'] = $contribution->total_amount;
         // @todo required for base ipn but problematic as api layer handles this
         $transaction = new CRM_Core_Transaction();
         $ipn = new CRM_Core_Payment_BaseIPN();
         $ipn->failed($objects, $transaction, $input);
     } catch (Exception $e) {
     }
 }
开发者ID:torrance,项目名称:nz.co.fuzion.cmcic,代码行数:30,代码来源:CmcicIPN.php

示例2: loadObjects

 /**
  * Load objects related to contribution.
  *
  * @input array information from Payment processor
  * @param array $ids
  * @param array $objects
  * @param boolean $required
  * @param integer $paymentProcessorID
  * @param array $error_handling
  * @return multitype:number NULL |boolean
  */
 function loadObjects(&$input, &$ids, &$objects, $required, $paymentProcessorID, $error_handling = NULL)
 {
     if (empty($error_handling)) {
         // default options are that we log an error & echo it out
         // note that we should refactor this error handling into error code @ some point
         // but for now setting up enough separation so we can do unit tests
         $error_handling = array('log_error' => 1, 'echo_error' => 1);
     }
     $ids['paymentProcessor'] = $paymentProcessorID;
     if (is_a($objects['contribution'], 'CRM_Contribute_BAO_Contribution')) {
         $contribution =& $objects['contribution'];
     } else {
         //legacy support - functions are 'used' to be able to pass in a DAO
         $contribution = new CRM_Contribute_BAO_Contribution();
         $contribution->id = CRM_Utils_Array::value('contribution', $ids);
         $contribution->find(TRUE);
         $objects['contribution'] =& $contribution;
     }
     try {
         $success = $contribution->loadRelatedObjects($input, $ids, $required);
     } catch (Exception $e) {
         $success = FALSE;
         if (CRM_Utils_Array::value('log_error', $error_handling)) {
             CRM_Core_Error::debug_log_message($e->getMessage());
         }
         if (CRM_Utils_Array::value('echo_error', $error_handling)) {
             echo $e->getMessage();
         }
         if (CRM_Utils_Array::value('return_error', $error_handling)) {
             return array('is_error' => 1, 'error_message' => $e->getMessage());
         }
     }
     $objects = array_merge($objects, $contribution->_relatedObjects);
     return $success;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:46,代码来源:BaseIPN.php

示例3: civicrm_api3_contribution_repeattransaction

/**
 * Complete an existing (pending) transaction.
 *
 * This will update related entities (participant, membership, pledge etc)
 * and take any complete actions from the contribution page (e.g. send receipt).
 *
 * @todo - most of this should live in the BAO layer but as we want it to be an addition
 * to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
 *
 * @param array $params
 *   Input parameters.
 *
 * @throws API_Exception
 *   Api result array.
 */
function civicrm_api3_contribution_repeattransaction(&$params)
{
    $input = $ids = array();
    civicrm_api3_verify_one_mandatory($params, NULL, array('contribution_recur_id', 'original_contribution_id'));
    if (empty($params['original_contribution_id'])) {
        $params['original_contribution_id'] = civicrm_api3('contribution', 'getvalue', array('return' => 'id', 'contribution_recur_id' => $params['contribution_recur_id'], 'options' => array('limit' => 1, 'sort' => 'id DESC')));
    }
    $contribution = new CRM_Contribute_BAO_Contribution();
    $contribution->id = $params['original_contribution_id'];
    if (!$contribution->find(TRUE)) {
        throw new API_Exception('A valid original contribution ID is required', 'invalid_data');
    }
    $original_contribution = clone $contribution;
    try {
        if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
            throw new API_Exception('failed to load related objects');
        }
        unset($contribution->id, $contribution->receive_date, $contribution->invoice_id);
        $contribution->receive_date = $params['receive_date'];
        $passThroughParams = array('trxn_id', 'total_amount', 'campaign_id', 'fee_amount', 'financial_type_id', 'contribution_status_id');
        $input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL));
        $params = _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution);
    } catch (Exception $e) {
        throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
    }
}
开发者ID:scardinius,项目名称:civicrm-core,代码行数:41,代码来源:Contribution.php

示例4: civicrm_api3_contribution_repeattransaction

/**
 * Complete an existing (pending) transaction.
 *
 * This will update related entities (participant, membership, pledge etc)
 * and take any complete actions from the contribution page (e.g. send receipt).
 *
 * @todo - most of this should live in the BAO layer but as we want it to be an addition
 * to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
 *
 * @param array $params
 *   Input parameters.
 *
 * @throws API_Exception
 *   Api result array.
 */
function civicrm_api3_contribution_repeattransaction(&$params)
{
    $input = $ids = array();
    $contribution = new CRM_Contribute_BAO_Contribution();
    $contribution->id = $params['original_contribution_id'];
    if (!$contribution->find(TRUE)) {
        throw new API_Exception('A valid original contribution ID is required', 'invalid_data');
    }
    $original_contribution = clone $contribution;
    try {
        if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
            throw new API_Exception('failed to load related objects');
        }
        unset($contribution->id, $contribution->receive_date, $contribution->invoice_id);
        $contribution->contribution_status_id = $params['contribution_status_id'];
        $contribution->receive_date = $params['receive_date'];
        $passThroughParams = array('trxn_id', 'total_amount', 'campaign_id', 'fee_amount');
        $input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL));
        $params = _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution);
    } catch (Exception $e) {
        throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
    }
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:38,代码来源:Contribution.php

示例5: testLoadMembershipObjectsLoadAll

 /**
  * Test the LoadObjects function with recurring membership data.
  */
 public function testLoadMembershipObjectsLoadAll()
 {
     $this->_setUpMembershipObjects();
     $this->_setUpRecurringContribution();
     unset($this->ids['membership']);
     $contribution = new CRM_Contribute_BAO_Contribution();
     $contribution->id = $this->_contributionId;
     $contribution->find(TRUE);
     $contribution->loadRelatedObjects($this->input, $this->ids, FALSE, TRUE);
     $this->assertFalse(empty($contribution->_relatedObjects['membership']));
     $this->assertArrayHasKey($this->_membershipTypeID, $contribution->_relatedObjects['membership']);
     $this->assertTrue(is_a($contribution->_relatedObjects['membership'][$this->_membershipTypeID], 'CRM_Member_BAO_Membership'));
     $this->assertTrue(is_a($contribution->_relatedObjects['contributionType'], 'CRM_Financial_BAO_FinancialType'));
     $this->assertFalse(empty($contribution->_relatedObjects['contributionRecur']));
     $this->assertFalse(empty($contribution->_relatedObjects['paymentProcessor']));
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:19,代码来源:BaseIPNTest.php

示例6: sendMail

 /**
  * Send receipt from contribution.
  *
  * Do not call this directly - it is being refactored. use contribution.sendmessage api call.
  *
  * Note that the compose message part has been moved to contribution
  * In general LoadObjects is called first to get the objects but the composeMessageArray function now calls it.
  *
  * @param array $input
  *   Incoming data from Payment processor.
  * @param array $ids
  *   Related object IDs.
  * @param int $contributionID
  * @param array $values
  *   Values related to objects that have already been loaded.
  * @param bool $recur
  *   Is it part of a recurring contribution.
  * @param bool $returnMessageText
  *   Should text be returned instead of sent. This.
  *   is because the function is also used to generate pdfs
  *
  * @return array
  * @throws \CRM_Core_Exception
  * @throws \CiviCRM_API3_Exception
  */
 public static function sendMail(&$input, &$ids, $contributionID, &$values, $recur = FALSE, $returnMessageText = FALSE)
 {
     $input['is_recur'] = $recur;
     $contribution = new CRM_Contribute_BAO_Contribution();
     $contribution->id = $contributionID;
     if (!$contribution->find(TRUE)) {
         throw new CRM_Core_Exception('Contribution does not exist');
     }
     $contribution->loadRelatedObjects($input, $ids, TRUE);
     // set receipt from e-mail and name in value
     if (!$returnMessageText) {
         $session = CRM_Core_Session::singleton();
         $userID = $session->get('userID');
         if (!empty($userID)) {
             list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
             $values['receipt_from_email'] = CRM_Utils_Array::value('receipt_from_email', $input, $userEmail);
             $values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $input, $userName);
         }
     }
     $return = $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
     // Contribution ID should really always be set. But ?
     if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update']) && empty($contribution->receipt_date)) {
         civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id));
     }
     return $return;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:51,代码来源:Contribution.php

示例7: civicrm_api3_contribution_completetransaction

/**
 * Complete an existing (pending) transaction, updating related entities (participant, membership, pledge etc)
 * and taking any complete actions from the contribution page (e.g. send receipt)
 *
 * @todo - most of this should live in the BAO layer but as we want it to be an addition
 * to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
 *
 * @param array $params input parameters
 * {@getfields Contribution_completetransaction}
 * @return array  Api result array
 * @static void
 * @access public
 *
 */
function civicrm_api3_contribution_completetransaction(&$params)
{
    $input = $ids = array();
    $contribution = new CRM_Contribute_BAO_Contribution();
    $contribution->id = $params['id'];
    $contribution->find(TRUE);
    if (!$contribution->id == $params['id']) {
        throw new API_Exception('A valid contribution ID is required', 'invalid_data');
    }
    try {
        if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
            throw new API_Exception('failed to load related objects');
        }
        $objects = $contribution->_relatedObjects;
        $objects['contribution'] =& $contribution;
        $input['component'] = $contribution->_component;
        $input['is_test'] = $contribution->is_test;
        $input['trxn_id'] = $contribution->trxn_id;
        $input['amount'] = $contribution->total_amount;
        if (isset($params['is_email_receipt'])) {
            $input['is_email_receipt'] = $params['is_email_receipt'];
        }
        // @todo required for base ipn but problematic as api layer handles this
        $transaction = new CRM_Core_Transaction();
        $ipn = new CRM_Core_Payment_BaseIPN();
        $ipn->completeTransaction($input, $ids, $objects, $transaction);
    } catch (Exception $e) {
        throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
    }
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:44,代码来源:Contribution.php


注:本文中的CRM_Contribute_BAO_Contribution::loadRelatedObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。