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


PHP CRM_Contribute_BAO_Contribution::transitionComponentWithReturnMessage方法代码示例

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


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

示例1: submit


//.........这里部分代码省略.........
         }
     } else {
         // Offline Contribution.
         $submittedValues = $this->unsetCreditCardFields($submittedValues);
         // get the required field value only.
         $params = $ids = array();
         $params['contact_id'] = $this->_contactID;
         $params['currency'] = $this->getCurrency($submittedValues);
         //format soft-credit/pcp param first
         CRM_Contribute_BAO_ContributionSoft::formatSoftCreditParams($submittedValues, $this);
         $params = array_merge($params, $submittedValues);
         $fields = array('financial_type_id', 'contribution_status_id', 'payment_instrument_id', 'cancel_reason', 'source', 'check_number');
         foreach ($fields as $f) {
             $params[$f] = CRM_Utils_Array::value($f, $formValues);
         }
         // CRM-5740 if priceset is used, no need to cleanup money.
         if ($priceSetId) {
             $params['skipCleanMoney'] = 1;
         }
         $params['revenue_recognition_date'] = NULL;
         if (!empty($formValues['revenue_recognition_date']) && count(array_filter($formValues['revenue_recognition_date'])) == 2) {
             $params['revenue_recognition_date'] = CRM_Utils_Date::processDate('01-' . implode('-', $formValues['revenue_recognition_date']));
         }
         $dates = array('receive_date', 'receipt_date', 'cancel_date');
         foreach ($dates as $d) {
             if (isset($formValues[$d])) {
                 $params[$d] = CRM_Utils_Date::processDate($formValues[$d], CRM_Utils_Array::value($d . '_time', $formValues), TRUE);
             }
         }
         if (!empty($formValues['is_email_receipt'])) {
             $params['receipt_date'] = date("Y-m-d");
         }
         if (CRM_Contribute_BAO_Contribution::isContributionStatusNegative($params['contribution_status_id'])) {
             if (CRM_Utils_System::isNull(CRM_Utils_Array::value('cancel_date', $params))) {
                 $params['cancel_date'] = date('YmdHis');
             }
         } else {
             $params['cancel_date'] = $params['cancel_reason'] = 'null';
         }
         // Set is_pay_later flag for back-office offline Pending status contributions CRM-8996
         // else if contribution_status is changed to Completed is_pay_later flag is changed to 0, CRM-15041
         if ($params['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Pending', 'name')) {
             $params['is_pay_later'] = 1;
         } elseif ($params['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
             $params['is_pay_later'] = 0;
         }
         $ids['contribution'] = $params['id'] = $this->_id;
         // Add Additional common information to formatted params.
         CRM_Contribute_Form_AdditionalInfo::postProcessCommon($formValues, $params, $this);
         if ($pId) {
             $params['contribution_mode'] = 'participant';
             $params['participant_id'] = $pId;
             $params['skipLineItem'] = 1;
         } elseif ($isRelatedId) {
             $params['contribution_mode'] = 'membership';
         }
         $params['line_item'] = $lineItem;
         $params['payment_processor_id'] = $params['payment_processor'] = CRM_Utils_Array::value('id', $this->_paymentProcessor);
         if (isset($submittedValues['tax_amount'])) {
             $params['tax_amount'] = $submittedValues['tax_amount'];
         }
         //create contribution.
         if ($isQuickConfig) {
             $params['is_quick_config'] = 1;
         }
         $params['non_deductible_amount'] = $this->calculateNonDeductibleAmount($params, $formValues);
         // we are already handling note below, so to avoid duplicate notes against $contribution
         if (!empty($params['note']) && !empty($submittedValues['note'])) {
             unset($params['note']);
         }
         $contribution = CRM_Contribute_BAO_Contribution::create($params, $ids);
         // process associated membership / participant, CRM-4395
         if ($contribution->id && $action & CRM_Core_Action::UPDATE) {
             $this->statusMessage[] = CRM_Contribute_BAO_Contribution::transitionComponentWithReturnMessage($contribution->id, $contribution->contribution_status_id, CRM_Utils_Array::value('contribution_status_id', $this->_values), $contribution->receive_date);
         }
         array_unshift($this->statusMessage, ts('The contribution record has been saved.'));
         $this->invoicingPostProcessHook($submittedValues, $action, $lineItem);
         //send receipt mail.
         if ($contribution->id && !empty($formValues['is_email_receipt'])) {
             $formValues['contact_id'] = $this->_contactID;
             $formValues['contribution_id'] = $contribution->id;
             $formValues += CRM_Contribute_BAO_ContributionSoft::getSoftContribution($contribution->id);
             // to get 'from email id' for send receipt
             $this->fromEmailId = $formValues['from_email_address'];
             if (CRM_Contribute_Form_AdditionalInfo::emailReceipt($this, $formValues)) {
                 $this->statusMessage[] = ts('A receipt has been emailed to the contributor.');
             }
         }
         $this->statusMessageTitle = ts('Saved');
     }
     if ($contribution->id && isset($formValues['product_name'][0])) {
         CRM_Contribute_Form_AdditionalInfo::processPremium($submittedValues, $contribution->id, $this->_premiumID, $this->_options);
     }
     if ($contribution->id && !empty($submittedValues['note'])) {
         CRM_Contribute_Form_AdditionalInfo::processNote($submittedValues, $this->_contactID, $contribution->id, $this->_noteID);
     }
     CRM_Core_Session::setStatus(implode(' ', $this->statusMessage), $this->statusMessageTitle, 'success');
     CRM_Contribute_BAO_Contribution::updateRelatedPledge($action, $pledgePaymentID, $contribution->id, CRM_Utils_Array::value('option_type', $formValues) == 2 ? TRUE : FALSE, $formValues['total_amount'], CRM_Utils_Array::value('total_amount', $this->_defaults), $formValues['contribution_status_id'], CRM_Utils_Array::value('contribution_status_id', $this->_defaults));
     return $contribution;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例2: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     $dates = array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date');
     if (isset($params['field'])) {
         foreach ($params['field'] as $key => $value) {
             $value['custom'] = CRM_Core_BAO_CustomField::postProcess($value, $key, 'Contribution');
             $ids['contribution'] = $key;
             foreach ($dates as $val) {
                 if (isset($value[$val])) {
                     $value[$val] = CRM_Utils_Date::processDate($value[$val]);
                 }
             }
             if (!empty($value['financial_type'])) {
                 $value['financial_type_id'] = $value['financial_type'];
             }
             if (!empty($value['payment_instrument'])) {
                 $value['payment_instrument_id'] = $value['payment_instrument'];
             }
             if (!empty($value['contribution_source'])) {
                 $value['source'] = $value['contribution_source'];
             }
             unset($value['financial_type']);
             unset($value['contribution_source']);
             $contribution = CRM_Contribute_BAO_Contribution::add($value, $ids);
             if (!empty($value['contribution_status_id'])) {
                 CRM_Contribute_BAO_Contribution::transitionComponentWithReturnMessage($contribution->id, $value['contribution_status_id'], CRM_Utils_Array::value("field[{$key}][contribution_status_id]", $this->_defaultValues), $contribution->receive_date);
             }
             // add custom field values
             if (!empty($value['custom']) && is_array($value['custom'])) {
                 CRM_Core_BAO_CustomValueTable::store($value['custom'], 'civicrm_contribution', $contribution->id);
             }
         }
         CRM_Core_Session::setStatus(ts("Your updates have been saved."), ts('Saved'), 'success');
     } else {
         CRM_Core_Session::setStatus(ts("No updates have been saved."), ts('Not Saved'), 'alert');
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:41,代码来源:Batch.php


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