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


PHP CRM_Contribute_BAO_Contribution::fields方法代码示例

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


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

示例1: whereClauseSingle

 /**
  * @param $values
  * @param $query
  */
 public static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $quoteValue = NULL;
     $fields = array_merge(CRM_Contribute_BAO_Contribution::fields(), self::getFields());
     if (!empty($value) && !is_array($value)) {
         $quoteValue = "\"{$value}\"";
     }
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     foreach (self::getRecurringFields() as $dateField => $dateFieldTitle) {
         if (self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
             return;
         }
     }
     switch ($name) {
         case 'contribution_date':
         case 'contribution_date_low':
         case 'contribution_date_low_time':
         case 'contribution_date_high':
         case 'contribution_date_high_time':
             // process to / from date
             $query->dateQueryBuilder($values, 'civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date');
             return;
         case 'contribution_amount':
         case 'contribution_amount_low':
         case 'contribution_amount_high':
             // process min/max amount
             $query->numberRangeBuilder($values, 'civicrm_contribution', 'contribution_amount', 'total_amount', 'Contribution Amount', NULL);
             return;
         case 'contribution_thankyou_date_is_not_null':
             if ($value) {
                 $op = "IS NOT NULL";
                 $query->_qill[$grouping][] = ts('Contribution Thank-you Sent');
             } else {
                 $op = "IS NULL";
                 $query->_qill[$grouping][] = ts('Contribution Thank-you Not Sent');
             }
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.thankyou_date", $op);
             $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
             return;
         case 'contribution_receipt_date_is_not_null':
             if ($value) {
                 $op = "IS NOT NULL";
                 $query->_qill[$grouping][] = ts('Contribution Receipt Sent');
             } else {
                 $op = "IS NULL";
                 $query->_qill[$grouping][] = ts('Contribution Receipt Not Sent');
             }
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.receipt_date", $op);
             $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
             return;
         case 'financial_type':
         case 'contribution_page':
         case 'payment_instrument':
         case 'contribution_payment_instrument':
         case 'contribution_status':
             $name .= '_id';
         case 'financial_type_id':
         case 'payment_instrument_id':
         case 'contribution_payment_instrument_id':
         case 'contribution_page_id':
         case 'contribution_status_id':
         case 'contribution_id':
         case 'contribution_currency_type':
         case 'contribution_currency':
         case 'contribution_source':
         case 'contribution_trxn_id':
         case 'contribution_check_number':
         case 'contribution_contact_id':
         case strpos($name, '_amount') !== FALSE:
         case strpos($name, '_date') !== FALSE:
             $qillName = $name;
             $pseudoExtraParam = NULL;
             if (strpos($name, '_amount') !== FALSE || strpos($name, '_date') !== FALSE || in_array($name, array('contribution_id', 'contribution_currency', 'contribution_source', 'contribution_trxn_id', 'contribution_check_number', 'contribution_payment_instrument_id', 'contribution_contact_id'))) {
                 $name = str_replace('contribution_', '', $name);
                 if (!in_array($name, array('source', 'id', 'contact_id'))) {
                     $qillName = str_replace('contribution_', '', $qillName);
                 }
             }
             if (in_array($name, array('contribution_currency', 'contribution_currency_type'))) {
                 $qillName = $name = 'currency';
                 $pseudoExtraParam = array('labelColumn' => 'name');
             }
             $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.{$name}", $op, $value, $dataType);
             list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op, $pseudoExtraParam);
             $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
             $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
             return;
         case 'contribution_pcp_made_through_id':
         case 'contribution_soft_credit_type_id':
             $qillName = $name;
             if ($name == 'contribution_pcp_made_through_id') {
                 $qillName = $name = 'pcp_id';
                 $fields[$name] = array('title' => ts('Personal Campaign Page'), 'type' => 2);
             }
//.........这里部分代码省略.........
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:Query.php


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