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


PHP CRM_Contribute_BAO_Query::defaultReturnProperties方法代码示例

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


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

示例1: civicrm_api3_contribution_get

/**
 * Retrieve a set of contributions.
 *
 * @param array $params
 *  Input parameters.
 *
 * @return array
 *   Array of contributions, if error an array with an error id and error message
 */
function civicrm_api3_contribution_get($params)
{
    $mode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE;
    $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties($mode);
    $contributions = _civicrm_api3_get_using_query_object('Contribution', $params, array(), NULL, $mode, $returnProperties);
    foreach ($contributions as $id => $contribution) {
        $softContribution = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($id, TRUE);
        $contributions[$id] = array_merge($contribution, $softContribution);
        // format soft credit for backward compatibility
        _civicrm_api3_format_soft_credit($contributions[$id]);
    }
    return civicrm_api3_create_success($contributions, $params, 'Contribution', 'get');
}
开发者ID:scardinius,项目名称:civicrm-core,代码行数:22,代码来源:Contribution.php

示例2: getBatchFinancialItems

 /**
  * Retrieve financial items assigned for a batch.
  *
  * @param int $entityID
  * @param array $returnValues
  * @param bool $notPresent
  * @param array $params
  * @param bool $getCount
  *
  * @return CRM_Core_DAO
  */
 public static function getBatchFinancialItems($entityID, $returnValues, $notPresent = NULL, $params = NULL, $getCount = FALSE)
 {
     if (!$getCount) {
         if (!empty($params['rowCount']) && $params['rowCount'] > 0) {
             $limit = " LIMIT {$params['offset']}, {$params['rowCount']} ";
         }
     }
     // action is taken depending upon the mode
     $select = 'civicrm_financial_trxn.id ';
     if (!empty($returnValues)) {
         $select .= " , " . implode(' , ', $returnValues);
     }
     $orderBy = " ORDER BY civicrm_financial_trxn.id";
     if (!empty($params['sort'])) {
         $orderBy = ' ORDER BY ' . CRM_Utils_Type::escape($params['sort'], 'String');
     }
     $from = "civicrm_financial_trxn\nLEFT JOIN civicrm_entity_financial_trxn ON civicrm_entity_financial_trxn.financial_trxn_id = civicrm_financial_trxn.id\nLEFT JOIN civicrm_entity_batch ON civicrm_entity_batch.entity_table = 'civicrm_financial_trxn'\nAND civicrm_entity_batch.entity_id = civicrm_financial_trxn.id\nLEFT JOIN civicrm_contribution ON civicrm_contribution.id = civicrm_entity_financial_trxn.entity_id\nLEFT JOIN civicrm_financial_type ON civicrm_financial_type.id = civicrm_contribution.financial_type_id\nLEFT JOIN civicrm_contact contact_a ON contact_a.id = civicrm_contribution.contact_id\nLEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id = civicrm_contribution.id\n";
     $searchFields = array('sort_name', 'financial_type_id', 'contribution_page_id', 'payment_instrument_id', 'contribution_trxn_id', 'contribution_source', 'contribution_currency_type', 'contribution_pay_later', 'contribution_recurring', 'contribution_test', 'contribution_thankyou_date_is_not_null', 'contribution_receipt_date_is_not_null', 'contribution_pcp_made_through_id', 'contribution_pcp_display_in_roll', 'contribution_date_relative', 'contribution_amount_low', 'contribution_amount_high', 'contribution_in_honor_of', 'contact_tags', 'group', 'contribution_date_relative', 'contribution_date_high', 'contribution_date_low', 'contribution_check_number', 'contribution_status_id');
     $values = array();
     foreach ($searchFields as $field) {
         if (isset($params[$field])) {
             $values[$field] = $params[$field];
             if ($field == 'sort_name') {
                 $from .= " LEFT JOIN civicrm_contact contact_b ON contact_b.id = civicrm_contribution.contact_id\n          LEFT JOIN civicrm_email ON contact_b.id = civicrm_email.contact_id";
             }
             if ($field == 'contribution_in_honor_of') {
                 $from .= " LEFT JOIN civicrm_contact contact_b ON contact_b.id = civicrm_contribution.contact_id";
             }
             if ($field == 'contact_tags') {
                 $from .= " LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-{$params[$field]}` ON `civicrm_entity_tag-{$params[$field]}`.entity_id = contact_a.id";
             }
             if ($field == 'group') {
                 $from .= " LEFT JOIN civicrm_group_contact `civicrm_group_contact-{$params[$field]}` ON contact_a.id = `civicrm_group_contact-{$params[$field]}`.contact_id ";
             }
             if ($field == 'contribution_date_relative') {
                 $relativeDate = explode('.', $params[$field]);
                 $date = CRM_Utils_Date::relativeToAbsolute($relativeDate[0], $relativeDate[1]);
                 $values['contribution_date_low'] = $date['from'];
                 $values['contribution_date_high'] = $date['to'];
             }
             $searchParams = CRM_Contact_BAO_Query::convertFormValues($values);
             $query = new CRM_Contact_BAO_Query($searchParams, CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
             if ($field == 'contribution_date_high' || $field == 'contribution_date_low') {
                 $query->dateQueryBuilder($params[$field], 'civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date');
             }
         }
     }
     if (!empty($query->_where[0])) {
         $where = implode(' AND ', $query->_where[0]) . " AND civicrm_entity_batch.batch_id IS NULL\n         AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution'";
         $where = str_replace('civicrm_contribution.payment_instrument_id', 'civicrm_financial_trxn.payment_instrument_id', $where);
         $searchValue = TRUE;
     } else {
         $searchValue = FALSE;
     }
     if (!$searchValue) {
         if (!$notPresent) {
             $where = " ( civicrm_entity_batch.batch_id = {$entityID}\n        AND civicrm_entity_batch.entity_table = 'civicrm_financial_trxn'\n        AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution') ";
         } else {
             $where = " ( civicrm_entity_batch.batch_id IS NULL\n        AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution')";
         }
     }
     $sql = "\nSELECT {$select}\nFROM   {$from}\nWHERE  {$where}\n       {$orderBy}\n";
     if (isset($limit)) {
         $sql .= "{$limit}";
     }
     $result = CRM_Core_DAO::executeQuery($sql);
     return $result;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:79,代码来源:Batch.php

示例3: __construct

 /**
  * Class constructor.
  *
  * @param array $queryParams
  *   Array of parameters for query.
  * @param \const|int $action - action of search basic or advanced.
  * @param string $contributionClause
  *   If the caller wants to further restrict the search (used in contributions).
  * @param bool $single
  *   Are we dealing only with one contact?.
  * @param int $limit
  *   How many contributions do we want returned.
  *
  * @param string $context
  * @param null $compContext
  *
  * @return \CRM_Contribute_Selector_Search
  */
 public function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $contributionClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_contributionClause = $contributionClause;
     // type of selector
     $this->_action = $action;
     $this->_includeSoftCredits = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($this->_queryParams);
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
     // @todo the function CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled should handle this
     // can we remove? if not why not?
     if ($this->_includeSoftCredits) {
         $this->_query->_rowCountClause = " count(civicrm_contribution.id)";
         $this->_query->_groupByComponentClause = " GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.contact_id, contribution_search_scredit_combined.scredit_id ";
     } else {
         $this->_query->_distinctComponentClause = " civicrm_contribution.id";
         $this->_query->_groupByComponentClause = " GROUP BY civicrm_contribution.id ";
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:41,代码来源:Search.php

示例4: _civicrm_api3_get_query_object

/**
 * Get dao query object based on input params.
 *
 * Ideally this would be merged with _civicrm_get_using_query_object but we need to resolve differences in what the
 * 2 variants call
 *
 * @param array $params
 * @param string $mode
 * @param string $entity
 *
 * @return array
 *   [CRM_Core_DAO|CRM_Contact_BAO_Query]
 */
function _civicrm_api3_get_query_object($params, $mode, $entity)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, $entity, 'get');
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options);
    $rowCount = CRM_Utils_Array::value('limit', $options);
    $inputParams = CRM_Utils_Array::value('input_params', $options, array());
    $returnProperties = CRM_Utils_Array::value('return', $options, NULL);
    if (empty($returnProperties)) {
        $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties($mode);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams, 0, FALSE, $entity);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL, FALSE, FALSE, $mode, empty($params['check_permissions']));
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    if (!empty($rowCount)) {
        $sql .= " LIMIT {$offset}, {$rowCount} ";
    }
    $dao = CRM_Core_DAO::executeQuery($sql);
    return array($dao, $query);
}
开发者ID:sugan2111,项目名称:Drupal_code,代码行数:37,代码来源:utils.php

示例5: __construct

 /**
  * Class constructor
  *
  * @param array $queryParams array of parameters for query
  * @param int   $action - action of search basic or advanced.
  * @param string   $contributionClause if the caller wants to further restrict the search (used in contributions)
  * @param boolean $single are we dealing only with one contact?
  * @param int     $limit  how many contributions do we want returned
  *
  * @return CRM_Contact_Selector
  * @access public
  */
 function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $contributionClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_contributionClause = $contributionClause;
     // type of selector
     $this->_action = $action;
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
     $this->_query->_distinctComponentClause = " civicrm_contribution.id";
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_contribution.id ";
 }
开发者ID:hguru,项目名称:224Civi,代码行数:27,代码来源:Search.php

示例6: civicrm_api3_contribution_get

/**
 * Retrieve a set of contributions, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters
 * @param array    $returnProperties Which properties should be included in the
 * returned Contribution object. If NULL, the default
 * set of properties will be included.
 *
 * @return array (reference )        array of contributions, if error an array with an error id and error message
 * @static void
 * @access public
 * {@getfields Contribution_get}
 * @example ContributionGet.php
 */
function civicrm_api3_contribution_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'contribution', 'get');
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options);
    $rowCount = CRM_Utils_Array::value('limit', $options);
    $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params);
    $inputParams = CRM_Utils_Array::value('input_params', $options, array());
    $returnProperties = CRM_Utils_Array::value('return', $options, NULL);
    if (empty($returnProperties)) {
        $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $contribution = array();
    while ($dao->fetch()) {
        //CRM-8662
        $contribution_details = $query->store($dao);
        $softContribution = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dao->contribution_id, TRUE);
        $contribution[$dao->contribution_id] = array_merge($contribution_details, $softContribution);
        if (isset($contribution[$dao->contribution_id]['financial_type_id'])) {
            $contribution[$dao->contribution_id]['financial_type_id'] = $contribution[$dao->contribution_id]['financial_type_id'];
        }
        // format soft credit for backward compatibility
        _civicrm_api3_format_soft_credit($contribution[$dao->contribution_id]);
    }
    return civicrm_api3_create_success($contribution, $params, 'contribution', 'get', $dao);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:49,代码来源:Contribution.php

示例7: _civicrm_initialize

/**
 * Retrieve a set of contributions, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters
 * @param array    $returnProperties Which properties should be included in the
 *                                   returned Contribution object. If NULL, the default
 *                                   set of properties will be included.
 *
 * @return array (reference )        array of contributions, if error an array with an error id and error message
 * @static void
 * @access public
 */
function &civicrm_contribution_search(&$params)
{
    _civicrm_initialize();
    $inputParams = array();
    $returnProperties = array();
    $otherVars = array('sort', 'offset', 'rowCount');
    $sort = null;
    $offset = 0;
    $rowCount = 25;
    foreach ($params as $n => $v) {
        if (substr($n, 0, 7) == 'return.') {
            $returnProperties[substr($n, 7)] = $v;
        } elseif (in_array($n, $otherVars)) {
            ${$n} = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    // add is_test to the clause if not present
    if (!array_key_exists('contribution_test', $inputParams)) {
        $inputParams['contribution_test'] = 0;
    }
    require_once 'CRM/Contribute/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php';
    if (empty($returnProperties)) {
        $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
    }
    $newParams =& CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query =& new CRM_Contact_BAO_Query($newParams, $returnProperties, null);
    list($select, $from, $where) = $query->query();
    $sql = "{$select} {$from} {$where}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao =& CRM_Core_DAO::executeQuery($sql);
    $contribution = array();
    while ($dao->fetch()) {
        $contribution[$dao->contribution_id] = $query->store($dao);
    }
    $dao->free();
    return $contribution;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:55,代码来源:Contribute.php


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