本文整理汇总了PHP中CRM_Core_BAO_CustomValue::getContributionValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomValue::getContributionValues方法的具体用法?PHP CRM_Core_BAO_CustomValue::getContributionValues怎么用?PHP CRM_Core_BAO_CustomValue::getContributionValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomValue
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomValue::getContributionValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _crm_initialize
/**
* Get an existing contribution.
*
* Returns a single existing Contribution object which matches ALL property
* values passed in $params. An error object is returned if there is
* no match, or more than one match. This API can be used to retrieve
* the CRM internal identifier (contribution_id) based on a unique property.
* It can also be used to retrieve any desired
* contribution properties based on a known contribution_id.
*
* @param array $params Associative array of property name/value
* pairs to attempt to match on.
* @param array $returnProperties Which properties should be included in the
* returned Contribution object. If NULL, the default
* set of properties will be included.
*
* @return CRM_Contribution|CRM_Core_Error Return the Contribution Object if found, else
* Error Object
*
* @access public
*
*/
function &crm_get_contribution($params, $returnProperties = null)
{
_crm_initialize();
// empty parameters ?
if (empty($params)) {
return _crm_error('$params is empty');
}
// correct parameter format ?
if (!is_array($params)) {
return _crm_error('$params is not an array');
}
if (!CRM_Utils_Array::value('contribution_id', $params)) {
$returnProperties = array('trxn_id');
$contributions = crm_contribution_search($params, $returnProperties);
if (count($contributions) != 1) {
return _crm_error(count($contributions) . " contributions matching input params.");
}
$contributionIds = array_keys($contributions);
$params['contribution_id'] = $contributionIds[0];
}
$params['id'] = $params['contribution_id'];
$ids = array();
$contribution =& CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids);
if ($contribution == null || is_a($contribution, 'CRM_Core_Error') || !$contribution->id) {
return _crm_error('Did not find contribution object for ' . $params['contribution_id']);
}
unset($params['id']);
$contribution->contribution_type_object = CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids);
$contribution->custom_values =& CRM_Core_BAO_CustomValue::getContributionValues($contribution->id);
return $contribution;
}