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


PHP CRM_Contribute_BAO_Contribution::addPremium方法代码示例

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


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

示例1: processMembership


//.........这里部分代码省略.........
             //Get the membership status
             if (!empty($value['membership_status'])) {
                 $value['status_id'] = $value['membership_status'];
                 unset($value['membership_status']);
             }
             if (empty($customFields)) {
                 // membership type custom data
                 $customFields = CRM_Core_BAO_CustomField::getFields('Membership', FALSE, FALSE, $membershipTypeId);
                 $customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFields('Membership', FALSE, FALSE, NULL, NULL, TRUE));
             }
             //check for custom data
             $value['custom'] = CRM_Core_BAO_CustomField::postProcess($params['field'][$key], $customFields, $key, 'Membership', $membershipTypeId);
             if (!empty($value['financial_type'])) {
                 $value['financial_type_id'] = $value['financial_type'];
             }
             if (!empty($value['payment_instrument'])) {
                 $value['payment_instrument_id'] = $value['payment_instrument'];
             }
             // handle soft credit
             if (is_array(CRM_Utils_Array::value('soft_credit_contact_id', $params)) && !empty($params['soft_credit_contact_id'][$key]) && CRM_Utils_Array::value($key, $params['soft_credit_amount'])) {
                 $value['soft_credit'][$key]['contact_id'] = $params['soft_credit_contact_id'][$key];
                 $value['soft_credit'][$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]);
             }
             if (!empty($value['receive_date'])) {
                 $value['receive_date'] = CRM_Utils_Date::processDate($value['receive_date'], $value['receive_date_time'], TRUE);
             }
             $params['actualBatchTotal'] += $value['total_amount'];
             unset($value['financial_type']);
             unset($value['payment_instrument']);
             $value['batch_id'] = $this->_batchId;
             $value['skipRecentView'] = TRUE;
             // make entry in line item for contribution
             $editedFieldParams = array('price_set_id' => $priceSetId, 'name' => $value['membership_type'][0]);
             $editedResults = array();
             CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
             if (!empty($editedResults)) {
                 unset($this->_priceSet['fields']);
                 $this->_priceSet['fields'][$editedResults['id']] = $priceSets['fields'][$editedResults['id']];
                 unset($this->_priceSet['fields'][$editedResults['id']]['options']);
                 $fid = $editedResults['id'];
                 $editedFieldParams = array('price_field_id' => $editedResults['id'], 'membership_type_id' => $value['membership_type_id']);
                 $editedResults = array();
                 CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults);
                 $this->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']];
                 if (!empty($value['total_amount'])) {
                     $this->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $value['total_amount'];
                 }
                 $fieldID = key($this->_priceSet['fields']);
                 $value['price_' . $fieldID] = $editedResults['id'];
                 $lineItem = array();
                 CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $value, $lineItem[$priceSetId]);
                 //CRM-11529 for backoffice transactions
                 //when financial_type_id is passed in form, update the
                 //lineitems with the financial type selected in form
                 if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) {
                     foreach ($lineItem[$priceSetId] as &$values) {
                         $values['financial_type_id'] = $value['financial_type_id'];
                     }
                 }
                 $value['lineItems'] = $lineItem;
                 $value['processPriceSet'] = TRUE;
             }
             // end of contribution related section
             unset($value['membership_type']);
             unset($value['membership_start_date']);
             unset($value['membership_end_date']);
             $value['is_renew'] = false;
             if (!empty($params['member_option']) && CRM_Utils_Array::value($key, $params['member_option']) == 2) {
                 $this->_params = $params;
                 $value['is_renew'] = true;
                 $membership = CRM_Member_BAO_Membership::renewMembershipFormWrapper($value['contact_id'], $value['membership_type_id'], FALSE, $this, NULL, NULL, $value['custom']);
                 // make contribution entry
                 CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($value, array('membership_id' => $membership->id)));
             } else {
                 $membership = CRM_Member_BAO_Membership::create($value, CRM_Core_DAO::$_nullArray);
             }
             //process premiums
             if (!empty($value['product_name'])) {
                 if ($value['product_name'][0] > 0) {
                     list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
                     $value['hidden_Premium'] = 1;
                     $value['product_option'] = CRM_Utils_Array::value($value['product_name'][1], $options[$value['product_name'][0]]);
                     $premiumParams = array('product_id' => $value['product_name'][0], 'contribution_id' => $value['contribution_id'], 'product_option' => $value['product_option'], 'quantity' => 1);
                     CRM_Contribute_BAO_Contribution::addPremium($premiumParams);
                 }
             }
             // end of premium
             //send receipt mail.
             if ($membership->id && !empty($value['send_receipt'])) {
                 // add the domain email id
                 $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
                 $domainEmail = "{$domainEmail['0']} <{$domainEmail['1']}>";
                 $value['from_email_address'] = $domainEmail;
                 $value['membership_id'] = $membership->id;
                 CRM_Member_Form_Membership::emailReceipt($this, $value, $membership);
             }
         }
     }
     return TRUE;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Entry.php

示例2: postProcessPremium

 /**
  * Process the form.
  *
  * @param array $premiumParams
  * @param CRM_Contribute_BAO_Contribution $contribution
  */
 protected function postProcessPremium($premiumParams, $contribution)
 {
     $hour = $minute = $second = 0;
     // assigning Premium information to receipt tpl
     $selectProduct = CRM_Utils_Array::value('selectProduct', $premiumParams);
     if ($selectProduct && $selectProduct != 'no_thanks') {
         $startDate = $endDate = "";
         $this->assign('selectPremium', TRUE);
         $productDAO = new CRM_Contribute_DAO_Product();
         $productDAO->id = $selectProduct;
         $productDAO->find(TRUE);
         $this->assign('product_name', $productDAO->name);
         $this->assign('price', $productDAO->price);
         $this->assign('sku', $productDAO->sku);
         $this->assign('option', CRM_Utils_Array::value('options_' . $premiumParams['selectProduct'], $premiumParams));
         $periodType = $productDAO->period_type;
         if ($periodType) {
             $fixed_period_start_day = $productDAO->fixed_period_start_day;
             $duration_unit = $productDAO->duration_unit;
             $duration_interval = $productDAO->duration_interval;
             if ($periodType == 'rolling') {
                 $startDate = date('Y-m-d');
             } elseif ($periodType == 'fixed') {
                 if ($fixed_period_start_day) {
                     $date = explode('-', date('Y-m-d'));
                     $month = substr($fixed_period_start_day, 0, strlen($fixed_period_start_day) - 2);
                     $day = substr($fixed_period_start_day, -2) . "<br/>";
                     $year = $date[0];
                     $startDate = $year . '-' . $month . '-' . $day;
                 } else {
                     $startDate = date('Y-m-d');
                 }
             }
             $date = explode('-', $startDate);
             $year = $date[0];
             $month = $date[1];
             $day = $date[2];
             switch ($duration_unit) {
                 case 'year':
                     $year = $year + $duration_interval;
                     break;
                 case 'month':
                     $month = $month + $duration_interval;
                     break;
                 case 'day':
                     $day = $day + $duration_interval;
                     break;
                 case 'week':
                     $day = $day + $duration_interval * 7;
             }
             $endDate = date('Y-m-d H:i:s', mktime($hour, $minute, $second, $month, $day, $year));
             $this->assign('start_date', $startDate);
             $this->assign('end_date', $endDate);
         }
         $dao = new CRM_Contribute_DAO_Premium();
         $dao->entity_table = 'civicrm_contribution_page';
         $dao->entity_id = $this->_id;
         $dao->find(TRUE);
         $this->assign('contact_phone', $dao->premiums_contact_phone);
         $this->assign('contact_email', $dao->premiums_contact_email);
         //create Premium record
         $params = array('product_id' => $premiumParams['selectProduct'], 'contribution_id' => $contribution->id, 'product_option' => CRM_Utils_Array::value('options_' . $premiumParams['selectProduct'], $premiumParams), 'quantity' => 1, 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'), 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'));
         if (!empty($premiumParams['selectProduct'])) {
             $daoPremiumsProduct = new CRM_Contribute_DAO_PremiumsProduct();
             $daoPremiumsProduct->product_id = $premiumParams['selectProduct'];
             $daoPremiumsProduct->premiums_id = $dao->id;
             $daoPremiumsProduct->find(TRUE);
             $params['financial_type_id'] = $daoPremiumsProduct->financial_type_id;
         }
         //Fixed For CRM-3901
         $daoContrProd = new CRM_Contribute_DAO_ContributionProduct();
         $daoContrProd->contribution_id = $contribution->id;
         if ($daoContrProd->find(TRUE)) {
             $params['id'] = $daoContrProd->id;
         }
         CRM_Contribute_BAO_Contribution::addPremium($params);
         if ($productDAO->cost && !empty($params['financial_type_id'])) {
             $trxnParams = array('cost' => $productDAO->cost, 'currency' => $productDAO->currency, 'financial_type_id' => $params['financial_type_id'], 'contributionId' => $contribution->id);
             CRM_Core_BAO_FinancialTrxn::createPremiumTrxn($trxnParams);
         }
     } elseif ($selectProduct == 'no_thanks') {
         //Fixed For CRM-3901
         $daoContrProd = new CRM_Contribute_DAO_ContributionProduct();
         $daoContrProd->contribution_id = $contribution->id;
         if ($daoContrProd->find(TRUE)) {
             $daoContrProd->delete();
         }
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:95,代码来源:Confirm.php

示例3: processMembership


//.........这里部分代码省略.........
                     $value['soft_credit'][$key]['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'Gift', 'name');
                 }
             }
             if (!empty($value['receive_date'])) {
                 $value['receive_date'] = CRM_Utils_Date::processDate($value['receive_date'], $value['receive_date_time'], TRUE);
             }
             $params['actualBatchTotal'] += $value['total_amount'];
             unset($value['financial_type']);
             unset($value['payment_instrument']);
             $value['batch_id'] = $this->_batchId;
             $value['skipRecentView'] = TRUE;
             // make entry in line item for contribution
             $editedFieldParams = array('price_set_id' => $priceSetId, 'name' => $value['membership_type'][0]);
             $editedResults = array();
             CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
             if (!empty($editedResults)) {
                 unset($this->_priceSet['fields']);
                 $this->_priceSet['fields'][$editedResults['id']] = $priceSets['fields'][$editedResults['id']];
                 unset($this->_priceSet['fields'][$editedResults['id']]['options']);
                 $fid = $editedResults['id'];
                 $editedFieldParams = array('price_field_id' => $editedResults['id'], 'membership_type_id' => $value['membership_type_id']);
                 $editedResults = array();
                 CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults);
                 $this->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']];
                 if (!empty($value['total_amount'])) {
                     $this->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $value['total_amount'];
                 }
                 $fieldID = key($this->_priceSet['fields']);
                 $value['price_' . $fieldID] = $editedResults['id'];
                 $lineItem = array();
                 CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $value, $lineItem[$priceSetId]);
                 //CRM-11529 for backoffice transactions
                 //when financial_type_id is passed in form, update the
                 //lineitems with the financial type selected in form
                 if (!empty($value['financial_type_id']) && !empty($lineItem[$priceSetId])) {
                     foreach ($lineItem[$priceSetId] as &$values) {
                         $values['financial_type_id'] = $value['financial_type_id'];
                     }
                 }
                 $value['lineItems'] = $lineItem;
                 $value['processPriceSet'] = TRUE;
             }
             // end of contribution related section
             unset($value['membership_type']);
             unset($value['membership_start_date']);
             unset($value['membership_end_date']);
             $value['is_renew'] = FALSE;
             if (!empty($params['member_option']) && CRM_Utils_Array::value($key, $params['member_option']) == 2) {
                 // The following parameter setting may be obsolete.
                 $this->_params = $params;
                 $value['is_renew'] = TRUE;
                 $isPayLater = CRM_Utils_Array::value('is_pay_later', $params);
                 $campaignId = NULL;
                 if (isset($this->_values) && is_array($this->_values) && !empty($this->_values)) {
                     $campaignId = CRM_Utils_Array::value('campaign_id', $this->_params);
                     if (!array_key_exists('campaign_id', $this->_params)) {
                         $campaignId = CRM_Utils_Array::value('campaign_id', $this->_values);
                     }
                 }
                 foreach (array('join_date', 'start_date', 'end_date') as $dateType) {
                     //CRM-18000 - ignore $dateType if its not explicitly passed
                     if (!empty($fDate[$dateType]) || !empty($fDate['membership_' . $dateType])) {
                         $formDates[$dateType] = CRM_Utils_Array::value($dateType, $value);
                     }
                 }
                 $membershipSource = CRM_Utils_Array::value('source', $value);
                 list($membership) = CRM_Member_BAO_Membership::renewMembership($value['contact_id'], $value['membership_type_id'], FALSE, NULL, NULL, $value['custom'], 1, NULL, FALSE, NULL, $membershipSource, $isPayLater, $campaignId, $formDates);
                 // make contribution entry
                 $contrbutionParams = array_merge($value, array('membership_id' => $membership->id));
                 // @todo - calling this from here is pretty hacky since it is called from membership.create anyway
                 // This form should set the correct params & not call this fn directly.
                 CRM_Member_BAO_Membership::recordMembershipContribution($contrbutionParams);
             } else {
                 $membership = CRM_Member_BAO_Membership::create($value, CRM_Core_DAO::$_nullArray);
             }
             //process premiums
             if (!empty($value['product_name'])) {
                 if ($value['product_name'][0] > 0) {
                     list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
                     $value['hidden_Premium'] = 1;
                     $value['product_option'] = CRM_Utils_Array::value($value['product_name'][1], $options[$value['product_name'][0]]);
                     $premiumParams = array('product_id' => $value['product_name'][0], 'contribution_id' => CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id'), 'product_option' => $value['product_option'], 'quantity' => 1);
                     CRM_Contribute_BAO_Contribution::addPremium($premiumParams);
                 }
             }
             // end of premium
             //send receipt mail.
             if ($membership->id && !empty($value['send_receipt'])) {
                 // add the domain email id
                 $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
                 $domainEmail = "{$domainEmail['0']} <{$domainEmail['1']}>";
                 $value['from_email_address'] = $domainEmail;
                 $value['membership_id'] = $membership->id;
                 $value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
                 CRM_Member_Form_Membership::emailReceipt($this, $value, $membership);
             }
         }
     }
     return TRUE;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Entry.php

示例4: testAddPremium

 /**
  * Add premium during online Contribution.
  *
  * AddPremium();
  */
 public function testAddPremium()
 {
     $contactId = Contact::createIndividual();
     $ids = array('premium' => NULL);
     $params = array('name' => 'TEST Premium', 'sku' => 111, 'imageOption' => 'noImage', 'MAX_FILE_SIZE' => 2097152, 'price' => 100.0, 'cost' => 90.0, 'min_contribution' => 100, 'is_active' => 1);
     $premium = CRM_Contribute_BAO_ManagePremiums::add($params, $ids);
     $this->assertEquals('TEST Premium', $premium->name, 'Check for premium  name.');
     $ids = array('contribution' => NULL);
     $param = array('contact_id' => $contactId, 'currency' => 'USD', 'financial_type_id' => 1, 'contribution_status_id' => 1, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'id' => NULL, 'non_deductible_amount' => 0.0, 'total_amount' => 300.0, 'fee_amount' => 5, 'net_amount' => 295, 'trxn_id' => '33erdfrwvw434', 'invoice_id' => '98ed34f7u9hh672ce0eafe8fb92', 'thankyou_date' => '20080522');
     $contribution = CRM_Contribute_BAO_Contribution::create($param, $ids);
     $this->assertEquals($param['trxn_id'], $contribution->trxn_id, 'Check for transcation id creation.');
     $this->assertEquals($contactId, $contribution->contact_id, 'Check for contact id  creation.');
     //parameter for adding premium to contribution
     $data = array('product_id' => $premium->id, 'contribution_id' => $contribution->id, 'product_option' => NULL, 'quantity' => 1);
     $contributionProduct = CRM_Contribute_BAO_Contribution::addPremium($data);
     $this->assertEquals($contributionProduct->product_id, $premium->id, 'Check for Product id .');
     //Delete Product
     CRM_Contribute_BAO_ManagePremiums::del($premium->id);
     $this->assertDBNull('CRM_Contribute_DAO_Product', $premium->name, 'id', 'name', 'Database check for deleted Product.');
     //Delete Contribution
     $this->contributionDelete($contribution->id);
     //Delete Contact
     Contact::delete($contactId);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:29,代码来源:ContributionTest.php

示例5: postProcess


//.........这里部分代码省略.........
                         $month = substr($fixed_period_start_day, 0, strlen($fixed_period_start_day) - 2);
                         $day = substr($fixed_period_start_day, -2) . "<br>";
                         $year = $date[0];
                         $startDate = $year . '-' . $month . '-' . $day;
                     } else {
                         $startDate = date('Y-m-d');
                     }
                 }
             }
             $date = explode('-', $startDate);
             $year = $date[0];
             $month = $date[1];
             $day = $date[2];
             switch ($duration_unit) {
                 case 'year':
                     $year = $year + $duration_interval;
                     break;
                 case 'month':
                     $month = $month + $duration_interval;
                     break;
                 case 'day':
                     $day = $day + $duration_interval;
                     break;
                 case 'week':
                     $day = $day + $duration_interval * 7;
             }
             $endDate = date('Y-m-d H:i:s', mktime($hour, $minute, $second, $month, $day, $year));
             $this->assign('start_date', $startDate);
             $this->assign('end_date', $endDate);
         }
         require_once 'CRM/Contribute/DAO/Premium.php';
         $dao =& new CRM_Contribute_DAO_Premium();
         $dao->entity_table = 'civicrm_contribution_page';
         $dao->entity_id = $this->_id;
         $dao->find(true);
         $this->assign('contact_phone', $dao->premiums_contact_phone);
         $this->assign('contact_email', $dao->premiums_contact_email);
     }
     CRM_Core_DAO::transaction('BEGIN');
     $nonDeductibleAmount = $result['gross_amount'];
     if ($contributionType->is_deductible) {
         if ($premiumParams['selectProduct'] != 'no_thanks') {
             require_once 'CRM/Contribute/DAO/Product.php';
             $productDAO =& new CRM_Contribute_DAO_Product();
             $productDAO->id = $premiumParams['selectProduct'];
             $productDAO->find(true);
             if ($result['gross_amount'] < $productDAO->price) {
                 $nonDeductibleAmount = $result['gross_amount'];
             } else {
                 $nonDeductibleAmount = $productDAO->price;
             }
         } else {
             $nonDeductibleAmount = '0.00';
         }
     }
     // check contribution Type
     // first create the contribution record
     $params = array('contact_id' => $contactID, 'contribution_type_id' => $contributionType->id, 'payment_instrument_id' => 1, 'receive_date' => $now, 'non_deductible_amount' => $nonDeductibleAmount, 'total_amount' => $result['gross_amount'], 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $result['gross_amount']), 'trxn_id' => $result['trxn_id'], 'invoice_id' => $this->_params['invoiceID'], 'currency' => $this->_params['currencyID'], 'receipt_date' => $receiptDate, 'source' => ts('Online Contribution:') . ' ' . $this->_values['title']);
     $ids = array();
     $contribution =& CRM_Contribute_BAO_Contribution::add($params, $ids);
     //create Premium record
     if ($premiumParams['selectProduct'] && $premiumParams['selectProduct'] != 'no_thanks') {
         require_once 'CRM/Contribute/DAO/Product.php';
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $premiumParams['selectProduct'];
         $productDAO->find(true);
         $periodType = $productDAO->period_type;
         require_once 'CRM/Utils/Date.php';
         $params = array('product_id' => $premiumParams['selectProduct'], 'contribution_id' => $contribution->id, 'product_option' => $premiumParams['options_' . $premiumParams['selectProduct']], 'quantity' => 1, 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'), 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'));
         CRM_Contribute_BAO_Contribution::addPremium($params);
     }
     // process the custom data that is submitted or that came via the url
     $groupTree = $this->get('groupTree');
     $customValues = $this->get('customGetValues');
     $customValues = array_merge($this->_params, $customValues);
     require_once 'CRM/Core/BAO/CustomGroup.php';
     CRM_Core_BAO_CustomGroup::postProcess($groupTree, $customValues);
     CRM_Core_BAO_CustomGroup::updateCustomData($groupTree, 'Contribution', $contribution->id);
     // next create the transaction record
     $params = array('entity_table' => 'civicrm_contribution', 'entity_id' => $contribution->id, 'trxn_date' => $now, 'trxn_type' => 'Debit', 'total_amount' => $result['gross_amount'], 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $result['gross_amount']), 'currency' => $this->_params['currencyID'], 'payment_processor' => $config->paymentProcessor, 'trxn_id' => $result['trxn_id']);
     require_once 'CRM/Contribute/BAO/FinancialTrxn.php';
     $trxn =& CRM_Contribute_BAO_FinancialTrxn::create($params);
     // also create an activity history record
     require_once 'CRM/Utils/Money.php';
     $params = array('entity_table' => 'civicrm_contact', 'entity_id' => $contactID, 'activity_type' => $contributionType->name, 'module' => 'CiviContribute', 'callback' => 'CRM_Contribute_Page_Contribution::details', 'activity_id' => $contribution->id, 'activity_summary' => 'Online - ' . CRM_Utils_Money::format($this->_params['amount']), 'activity_date' => $now);
     if (is_a(crm_create_activity_history($params), 'CRM_Core_Error')) {
         CRM_Core_Error::fatal("Could not create a system record");
     }
     CRM_Core_DAO::transaction('COMMIT');
     // finally send an email receipt
     if ($this->_values['is_email_receipt']) {
         list($displayName, $email) = CRM_Contact_BAO_Contact::getEmailDetails($contactID);
         $template =& CRM_Core_Smarty::singleton();
         $subject = trim($template->fetch('CRM/Contribute/Form/Contribution/ReceiptSubject.tpl'));
         $message = $template->fetch('CRM/Contribute/Form/Contribution/ReceiptMessage.tpl');
         $receiptFrom = '"' . $this->_values['receipt_from_name'] . '" <' . $this->_values['receipt_from_email'] . '>';
         require_once 'CRM/Utils/Mail.php';
         CRM_Utils_Mail::send($receiptFrom, $displayName, $email, $subject, $message, $this->_values['cc_receipt'], $this->_values['bcc_receipt']);
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Confirm.php


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