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


PHP CRM_Contribute_BAO_ContributionRecur::copyCustomValues方法代码示例

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


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

示例1: repeatTransaction

 /**
  * Repeat a transaction as part of a recurring series.
  *
  * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function
  * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a
  * subsequent call to the contribution.completetransaction api.
  *
  * The completeTransaction functionality has historically been overloaded to both complete and repeat payments.
  *
  * @param CRM_Contribute_BAO_Contribution $contribution
  * @param array $input
  * @param array $contributionParams
  *
  * @return array
  */
 protected static function repeatTransaction(&$contribution, &$input, $contributionParams)
 {
     if (!empty($contribution->id)) {
         return FALSE;
     }
     if (empty($contribution->id)) {
         // Unclear why this would only be set for repeats.
         if (!empty($input['amount'])) {
             $contribution->total_amount = $contributionParams['total_amount'] = $input['amount'];
         }
         $templateContribution = civicrm_api3('Contribution', 'getsingle', array('contribution_recur_id' => $contributionParams['contribution_recur_id'], 'options' => array('limit' => 1)));
         $contributionParams['skipLineItem'] = TRUE;
         $contributionParams['status_id'] = 'Pending';
         $contributionParams['financial_type_id'] = $templateContribution['financial_type_id'];
         $contributionParams['contact_id'] = $templateContribution['contact_id'];
         $contributionParams['source'] = empty($templateContribution['source']) ? ts('Recurring contribution') : $templateContribution['source'];
         $createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
         $contribution->id = $createContribution['id'];
         $input['line_item'] = CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($contribution->contribution_recur_id, $contribution);
         CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id);
         return TRUE;
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:38,代码来源:Contribution.php

示例2: cancelled

 /**
  * Process cancelled payment outcome.
  *
  * @param array $objects
  * @param CRM_Core_Transaction $transaction
  * @param array $input
  *
  * @return bool
  */
 public function cancelled(&$objects, &$transaction, $input = array())
 {
     $contribution =& $objects['contribution'];
     $memberships =& $objects['membership'];
     if (is_numeric($memberships)) {
         $memberships = array($objects['membership']);
     }
     $participant =& $objects['participant'];
     $addLineItems = FALSE;
     if (empty($contribution->id)) {
         $addLineItems = TRUE;
     }
     $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
     $contribution->contribution_status_id = $contributionStatuses['Cancelled'];
     $contribution->cancel_date = self::$_now;
     $contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input);
     $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
     $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date);
     $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
     $contribution->save();
     //add lineitems for recurring payments
     if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) {
         CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($objects['contributionRecur']->id, $contribution);
     }
     //add new soft credit against current $contribution and
     //copy initial contribution custom fields for recurring contributions
     if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
         CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
         CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id);
     }
     if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
         if (!empty($memberships)) {
             $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
             foreach ($memberships as $membership) {
                 if ($membership) {
                     $membership->status_id = $membershipStatuses['Cancelled'];
                     $membership->save();
                     //update related Memberships.
                     $params = array('status_id' => $membershipStatuses['Cancelled']);
                     CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params);
                 }
             }
         }
         if ($participant) {
             $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
             $participant->status_id = $participantStatuses['Cancelled'];
             $participant->save();
         }
     }
     $transaction->commit();
     CRM_Core_Error::debug_log_message("Setting contribution status to cancelled");
     //echo "Success: Setting contribution status to cancelled<p>";
     return TRUE;
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:63,代码来源:BaseIPN.php

示例3: repeatTransaction

 /**
  * Repeat a transaction as part of a recurring series.
  *
  * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function
  * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a
  * subsequent call to the contribution.completetransaction api.
  *
  * The completeTransaction functionality has historically been overloaded to both complete and repeat payments.
  *
  * @param CRM_Contribute_BAO_Contribution $contribution
  * @param array $input
  * @param array $contributionParams
  *
  * @return array
  */
 protected static function repeatTransaction(&$contribution, &$input, $contributionParams)
 {
     if (!empty($contribution->id)) {
         return FALSE;
     }
     if (empty($contribution->id)) {
         // Unclear why this would only be set for repeats.
         if (!empty($input['amount'])) {
             $contribution->total_amount = $contributionParams['total_amount'] = $input['amount'];
         }
         $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionParams['contribution_recur_id']);
         if (!empty($contributionParams['contribution_recur_id'])) {
             $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', array('id' => $contributionParams['contribution_recur_id']));
             if (!empty($recurringContribution['campaign_id'])) {
                 // CRM-17718 the campaign id on the contribution recur record should get precedence.
                 $contributionParams['campaign_id'] = $recurringContribution['campaign_id'];
             }
             if (!empty($recurringContribution['financial_type_id'])) {
                 // CRM-17718 the campaign id on the contribution recur record should get precedence.
                 $contributionParams['financial_type_id'] = $recurringContribution['financial_type_id'];
             }
         }
         $contributionParams['skipLineItem'] = TRUE;
         $contributionParams['status_id'] = 'Pending';
         if (isset($contributionParams['financial_type_id'])) {
             // Give precedence to passed in type.
             $contribution->financial_type_id = $contributionParams['financial_type_id'];
         } else {
             $contributionParams['financial_type_id'] = $templateContribution['financial_type_id'];
         }
         $contributionParams['contact_id'] = $templateContribution['contact_id'];
         $contributionParams['source'] = empty($templateContribution['source']) ? ts('Recurring contribution') : $templateContribution['source'];
         $createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
         $contribution->id = $createContribution['id'];
         $input['line_item'] = CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($contribution->contribution_recur_id, $contribution);
         CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id);
         return TRUE;
     }
 }
开发者ID:joshgowans,项目名称:civicrm-core,代码行数:54,代码来源:Contribution.php

示例4: repeatTransaction

 /**
  * Repeat a transaction as part of a recurring series.
  *
  * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function
  * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a
  * subsequent call to the contribution.completetransaction api.
  *
  * The completeTransaction functionality has historically been overloaded to both complete and repeat payments.
  *
  * @param CRM_Contribute_BAO_Contribution $contribution
  * @param array $input
  * @param array $contributionParams
  * @param int $paymentProcessorID
  *
  * @return array
  * @throws CiviCRM_API3_Exception
  */
 protected static function repeatTransaction(&$contribution, &$input, $contributionParams, $paymentProcessorID)
 {
     if (!empty($contribution->id)) {
         return FALSE;
     }
     if (empty($contribution->id)) {
         // Unclear why this would only be set for repeats.
         if (!empty($input['amount'])) {
             $contribution->total_amount = $contributionParams['total_amount'] = $input['amount'];
         }
         if (!empty($contributionParams['contribution_recur_id'])) {
             $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', array('id' => $contributionParams['contribution_recur_id']));
             if (!empty($recurringContribution['campaign_id'])) {
                 // CRM-17718 the campaign id on the contribution recur record should get precedence.
                 $contributionParams['campaign_id'] = $recurringContribution['campaign_id'];
             }
             if (!empty($recurringContribution['financial_type_id'])) {
                 // CRM-17718 the campaign id on the contribution recur record should get precedence.
                 $contributionParams['financial_type_id'] = $recurringContribution['financial_type_id'];
             }
         }
         $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionParams['contribution_recur_id'], array_intersect_key($contributionParams, array('total_amount' => TRUE, 'financial_type_id' => TRUE)));
         $input['line_item'] = $contributionParams['line_item'] = $templateContribution['line_item'];
         $contributionParams['status_id'] = 'Pending';
         if (isset($contributionParams['financial_type_id'])) {
             // Give precedence to passed in type.
             $contribution->financial_type_id = $contributionParams['financial_type_id'];
         } else {
             $contributionParams['financial_type_id'] = $templateContribution['financial_type_id'];
         }
         $contributionParams['contact_id'] = $templateContribution['contact_id'];
         $contributionParams['source'] = empty($templateContribution['source']) ? ts('Recurring contribution') : $templateContribution['source'];
         //CRM-18805 -- Contribution page not recorded on recurring transactions, Recurring contribution payments
         //do not create CC or BCC emails or profile notifications.
         //The if is just to be safe. Not sure if we can ever arrive with this unset
         if (isset($contribution->contribution_page_id)) {
             $contributionParams['contribution_page_id'] = $contribution->contribution_page_id;
         }
         $createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
         $contribution->id = $createContribution['id'];
         CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id);
         return TRUE;
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:61,代码来源:Contribution.php


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