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


PHP CRM_Contribute_Form_Contribution_Confirm::formatSoftCreditParams方法代码示例

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


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

示例1: processContribution

 /**
  * Process the contribution.
  *
  * @param CRM_Core_Form $form
  * @param array $params
  * @param $result
  * @param int $contactID
  * @param bool $pending
  * @param bool $isAdditionalAmount
  *
  * @return void
  */
 public static function processContribution(&$form, $params, $result, $contactID, $pending = FALSE, $isAdditionalAmount = FALSE)
 {
     $transaction = new CRM_Core_Transaction();
     $now = date('YmdHis');
     $receiptDate = NULL;
     if (!empty($form->_values['event']['is_email_confirm'])) {
         $receiptDate = $now;
     }
     //CRM-4196
     if ($isAdditionalAmount) {
         $params['amount_level'] = $params['amount_level'] . ts(' (multiple participants)') . CRM_Core_DAO::VALUE_SEPARATOR;
     }
     $contribParams = array('contact_id' => $contactID, 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ? $form->_values['event']['financial_type_id'] : $params['financial_type_id'], 'receive_date' => $now, 'total_amount' => $params['amount'], 'tax_amount' => $params['tax_amount'], 'amount_level' => $params['amount_level'], 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'source' => !empty($params['participant_source']) ? $params['participant_source'] : $params['description'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params));
     if (empty($params['is_pay_later'])) {
         $contribParams['payment_instrument_id'] = 1;
     }
     if (!$pending && $result) {
         $contribParams += array('fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $params['amount']), 'trxn_id' => $result['trxn_id'], 'receipt_date' => $receiptDate);
     }
     $allStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $contribParams['contribution_status_id'] = array_search('Completed', $allStatuses);
     if ($pending) {
         $contribParams['contribution_status_id'] = array_search('Pending', $allStatuses);
     }
     $contribParams['is_test'] = 0;
     if ($form->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
         $contribParams['is_test'] = 1;
     }
     $contribID = NULL;
     if (!empty($contribParams['invoice_id'])) {
         $contribID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribParams['invoice_id'], 'id', 'invoice_id');
     }
     $ids = array();
     if ($contribID) {
         $ids['contribution'] = $contribID;
         $contribParams['id'] = $contribID;
     }
     //create an contribution address
     if ($form->_contributeMode != 'notify' && empty($params['is_pay_later'])) {
         $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
     }
     $contribParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $params);
     $contribParams['skipLineItem'] = 1;
     // create contribution record
     $contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids);
     // CRM-11124
     CRM_Event_BAO_Participant::createDiscountTrxn($form->_eventId, $contribParams, CRM_Utils_Array::value('amount_priceset_level_radio', $params, NULL));
     // process soft credit / pcp pages
     if (!empty($params['pcp_made_through_id'])) {
         CRM_Contribute_Form_Contribution_Confirm::formatSoftCreditParams($params, $form);
         CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
     }
     $transaction->commit();
     return $contribution;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:67,代码来源:Confirm.php


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