本文整理汇总了PHP中CRM_Contribute_BAO_Contribution类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution类的具体用法?PHP CRM_Contribute_BAO_Contribution怎么用?PHP CRM_Contribute_BAO_Contribution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Contribute_BAO_Contribution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: init
/**
* the initializer code, called before the processing
*
* @return void
* @access public
*/
function init()
{
require_once 'CRM/Contribute/BAO/Contribution.php';
$fields =& CRM_Contribute_BAO_Contribution::importableFields();
foreach ($fields as $name => $field) {
$this->addField($name, $field['title'], $field['type'], $field['headerPattern'], $field['dataPattern']);
}
$this->_newContributions = array();
$this->setActiveFields($this->_mapperKeys);
//$this->setActiveFieldLocationTypes( $this->_mapperLocType );
//$this->setActiveFieldPhoneTypes( $this->_mapperPhoneType );
// FIXME: we should do this in one place together with Form/MapField.php
$this->_contactIdIndex = -1;
$this->_totalAmountIndex = -1;
$this->_contributionTypeIndex = -1;
$index = 0;
foreach ($this->_mapperKeys as $key) {
switch ($key) {
case 'contact_id':
$this->_contactIdIndex = $index;
break;
case 'total_amount':
$this->_totalAmountIndex = $index;
break;
case 'contribution_type':
$this->_contributionTypeIndex = $index;
break;
}
$index++;
}
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:37,代码来源:Contribution.php
示例2: testCreateSingleNowDated
/**
* Create a single post dated payment as a recurring transaction.
*
* Test works but not both due to some form of caching going on in the SmartySingleton
*/
public function testCreateSingleNowDated()
{
$firstName = 'John_' . substr(sha1(rand()), 0, 7);
$lastName = 'Smith_' . substr(sha1(rand()), 0, 7);
$nameParams = array('first_name' => $firstName, 'last_name' => $lastName);
$contactId = $this->individualCreate($nameParams);
$invoiceID = sha1(rand());
$amount = rand(100, 1000) . '.00';
$contributionRecurParams = array('contact_id' => $contactId, 'amount' => $amount, 'currency' => 'USD', 'frequency_unit' => 'week', 'frequency_interval' => 1, 'installments' => 2, 'start_date' => date('Ymd'), 'create_date' => date('Ymd'), 'invoice_id' => $invoiceID, 'contribution_status_id' => 2, 'is_test' => 1, 'payment_processor_id' => $this->_paymentProcessorID);
$recur = CRM_Contribute_BAO_ContributionRecur::add($contributionRecurParams);
$contributionParams = array('contact_id' => $contactId, 'financial_type_id' => $this->_financialTypeId, 'receive_date' => date('Ymd'), 'total_amount' => $amount, 'invoice_id' => $invoiceID, 'currency' => 'USD', 'contribution_recur_id' => $recur->id, 'is_test' => 1, 'contribution_status_id' => 2);
$contribution = CRM_Contribute_BAO_Contribution::add($contributionParams);
$params = array('qfKey' => '08ed21c7ca00a1f7d32fff2488596ef7_4454', 'hidden_CreditCard' => 1, 'billing_first_name' => $firstName, 'billing_middle_name' => "", 'billing_last_name' => $lastName, 'billing_street_address-5' => '8 Hobbitton Road', 'billing_city-5' => 'The Shire', 'billing_state_province_id-5' => 1012, 'billing_postal_code-5' => 5010, 'billing_country_id-5' => 1228, 'credit_card_number' => '4007000000027', 'cvv2' => 123, 'credit_card_exp_date' => array('M' => 10, 'Y' => 2019), 'credit_card_type' => 'Visa', 'is_recur' => 1, 'frequency_interval' => 1, 'frequency_unit' => 'month', 'installments' => 12, 'financial_type_id' => $this->_financialTypeId, 'is_email_receipt' => 1, 'from_email_address' => "{$firstName}.{$lastName}@example.com", 'receive_date' => date('Ymd'), 'receipt_date_time' => '', 'payment_processor_id' => $this->_paymentProcessorID, 'price_set_id' => '', 'total_amount' => $amount, 'currency' => 'USD', 'source' => "Mordor", 'soft_credit_to' => '', 'soft_contact_id' => '', 'billing_state_province-5' => 'IL', 'state_province-5' => 'IL', 'billing_country-5' => 'US', 'country-5' => 'US', 'year' => 2019, 'month' => 10, 'ip_address' => '127.0.0.1', 'amount' => 7, 'amount_level' => 0, 'currencyID' => 'USD', 'pcp_display_in_roll' => "", 'pcp_roll_nickname' => "", 'pcp_personal_note' => "", 'non_deductible_amount' => "", 'fee_amount' => "", 'net_amount' => "", 'invoiceID' => $invoiceID, 'contribution_page_id' => "", 'thankyou_date' => NULL, 'honor_contact_id' => NULL, 'first_name' => $firstName, 'middle_name' => '', 'last_name' => $lastName, 'street_address' => '8 Hobbiton Road', 'city' => 'The Shire', 'state_province' => 'IL', 'postal_code' => 5010, 'country' => 'US', 'contributionType_name' => 'My precious', 'contributionType_accounting_code' => '', 'contributionPageID' => '', 'email' => "{$firstName}.{$lastName}@example.com", 'contactID' => $contactId, 'contributionID' => $contribution->id, 'contributionTypeID' => $this->_financialTypeId, 'contributionRecurID' => $recur->id);
// turn verifySSL off
CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
$this->processor->doPayment($params);
// turn verifySSL on
CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
// if subscription was successful, processor_id / subscription-id must not be null
$this->assertDBNotNull('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id', 'id', 'Failed to create subscription with Authorize.');
// cancel it or the transaction will be rejected by A.net if the test is re-run
$subscriptionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id');
$message = '';
$result = $this->processor->cancelSubscription($message, array('subscriptionId' => $subscriptionID));
$this->assertTrue($result, 'Failed to cancel subscription with Authorize.');
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:31,代码来源:AuthorizeNetTest.php
示例3: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
require_once 'CRM/Contribute/BAO/Contribution.php';
$values = array();
$ids = array();
$params = array('id' => $this->get('id'));
CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids);
CRM_Contribute_BAO_Contribution::resolveDefaults($values);
$groupTree =& CRM_Core_BAO_CustomGroup::getTree('Contribution', $this->get('id'));
CRM_Core_BAO_CustomGroup::buildViewHTML($this, $groupTree);
$id = $this->get('id');
if ($id) {
require_once 'CRM/Contribute/DAO/ContributionProduct.php';
$dao =& new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $id;
if ($dao->find(true)) {
$premiumId = $dao->id;
$productID = $dao->product_id;
}
}
if ($premiumId) {
require_once 'CRM/Contribute/DAO/Product.php';
$productDAO =& new CRM_Contribute_DAO_Product();
$productDAO->id = $productID;
$productDAO->find(true);
$this->assign('premium', $productDAO->name);
$this->assign('option', $dao->product_option);
$this->assign('fulfilled', $dao->fulfilled_date);
}
$this->assign($values);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:37,代码来源:ContributionView.php
示例4: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
CRM_Core_Resources::singleton()->addSetting(array('feePaid' => $this->_paidAmount));
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:28,代码来源:ParticipantFeeSelection.php
示例5: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
$this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
$this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->_crid) {
$this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'obj');
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_crid);
$this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
$this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
$this->assign('amount', $this->_subscriptionDetails->amount);
$this->assign('installments', $this->_subscriptionDetails->installments);
// Are we cancelling a recurring contribution that is linked to an auto-renew membership?
if ($this->_subscriptionDetails->membership_id) {
$this->_mid = $this->_subscriptionDetails->membership_id;
}
}
if ($this->_mid) {
$this->_mode = 'auto_renew';
// CRM-18468: crid is more accurate than mid for getting
// subscriptionDetails, so don't get them again.
if (!$this->_crid) {
$this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
}
$membershipTypes = CRM_Member_PseudoConstant::membershipType();
$membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
$this->assign('membershipType', CRM_Utils_Array::value($membershipTypeId, $membershipTypes));
}
$this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
if ($this->_coid) {
if (CRM_Contribute_BAO_Contribution::isSubscriptionCancelled($this->_coid)) {
CRM_Core_Error::fatal(ts('The recurring contribution looks to have been cancelled already.'));
}
$this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
$this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
$this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
$this->assign('amount', $this->_subscriptionDetails->amount);
$this->assign('installments', $this->_subscriptionDetails->installments);
}
if (!$this->_crid && !$this->_coid && !$this->_mid || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
CRM_Core_Error::fatal('Required information missing.');
}
if (!CRM_Core_Permission::check('edit contributions')) {
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
CRM_Core_Error::fatal(ts('You do not have permission to cancel this recurring contribution.'));
}
$this->_selfService = TRUE;
}
$this->assign('self_service', $this->_selfService);
// handle context redirection
CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
CRM_Utils_System::setTitle($this->_mid ? ts('Cancel Auto-renewal') : ts('Cancel Recurring Contribution'));
$this->assign('mode', $this->_mode);
if ($this->_subscriptionDetails->contact_id) {
list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:62,代码来源:CancelSubscription.php
示例6: browse
public function browse()
{
$getTrxnInfo = $this->_context == 'transaction' ? TRUE : FALSE;
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, $getTrxnInfo, TRUE);
if ($this->_context == 'payment_info') {
$this->assign('paymentInfo', $paymentInfo);
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:8,代码来源:PaymentInfo.php
示例7: browse
/**
* called when action is browse.
*
*/
public function browse()
{
// add annual contribution
$annual = array();
list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId);
$this->assign('annual', $annual);
$controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action, FALSE, FALSE, TRUE);
$controller->setEmbedded(TRUE);
$controller->reset();
$controller->set('cid', $this->_contactId);
$controller->set('crid', $this->_crid);
$controller->set('context', 'contribution');
$controller->set('limit', 50);
$controller->process();
$controller->run();
// add recurring block
$action = array_sum(array_keys($this->recurLinks()));
$params = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactId);
if (!empty($params)) {
foreach ($params as $ids => $recur) {
$action = array_sum(array_keys($this->recurLinks($ids)));
// no action allowed if it's not active
$params[$ids]['is_active'] = $recur['contribution_status_id'] != 3;
if ($params[$ids]['is_active']) {
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
if ($hideUpdate) {
$action -= CRM_Core_Action::UPDATE;
}
$params[$ids]['action'] = CRM_Core_Action::formLink(self::recurLinks($ids), $action, array('cid' => $this->_contactId, 'crid' => $ids, 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.selector.recurring', 'Contribution', $ids);
}
}
// assign vars to templates
$this->assign('action', $this->_action);
$this->assign('recurRows', $params);
$this->assign('recur', TRUE);
}
//enable/disable soft credit records for test contribution
$isTest = 0;
if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) {
$isTest = 1;
}
$this->assign('isTest', $isTest);
$softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, NULL, $isTest);
if (!empty($softCreditList)) {
$softCreditTotals = array();
list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
$this->assign('softCredit', TRUE);
$this->assign('softCreditRows', $softCreditList);
$this->assign('softCreditTotals', $softCreditTotals);
}
if ($this->_contactId) {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
$this->assign('displayName', $displayName);
$this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
}
}
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:61,代码来源:Tab.php
示例8: array
/**
* Function get the import/export fields for contribution
*
* @return array self::$_contributionFields associative array of contribution fields
* @static
*/
static function &getFields()
{
if (!self::$_contributionFields) {
self::$_contributionFields = array();
$fields = CRM_Contribute_BAO_Contribution::exportableFields();
unset($fields['contribution_contact_id']);
self::$_contributionFields = $fields;
}
return self::$_contributionFields;
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:16,代码来源:Query.php
示例9: browse
function browse()
{
$getTrxnInfo = $this->_context == 'transaction' ? TRUE : FALSE;
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, $getTrxnInfo);
if ($this->_context == 'payment_info') {
$this->assign('paymentInfo', $paymentInfo);
} else {
$rows = CRM_Utils_Array::value('transaction', $paymentInfo);
$this->assign('rows', $rows);
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:11,代码来源:PaymentInfo.php
示例10: array
/**
* Function get the import/export fields for contribution
*
* @return array self::$_contributionFields associative array of contribution fields
* @static
*/
static function &getFields()
{
if (!self::$_contributionFields) {
self::$_contributionFields = array();
require_once 'CRM/Contribute/BAO/Contribution.php';
$fields =& CRM_Contribute_BAO_Contribution::exportableFields();
unset($fields['contribution_contact_id']);
self::$_contributionFields = $fields;
}
return self::$_contributionFields;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:17,代码来源:Query.php
示例11: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
$deletedContributions = 0;
foreach ($this->_contributionIds as $contributionId) {
if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionId)) {
$deletedContributions++;
}
}
$status = ts('Deleted Contribution(s): %1 (Total Selected: %2) ', array(1 => $deletedContributions, 2 => count($this->_contributionIds)));
CRM_Core_Session::setStatus($status, '', 'info');
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:18,代码来源:Delete.php
示例12: array
/**
* Function get the import/export fields for contribution
*
* @return array self::$_contributionFields associative array of contribution fields
* @static
*/
static function &getFields()
{
if (!self::$_contributionFields) {
self::$_contributionFields = array();
require_once 'CRM/Contribute/BAO/Contribution.php';
$fields =& CRM_Contribute_BAO_Contribution::exportableFields();
// add field to get recur_id
$fields['contribution_recur_id'] = array('name' => 'contribution_recur_id', 'title' => ts('Recurring Contributions ID'), 'where' => 'civicrm_contribution.contribution_recur_id');
$fields['contribution_note'] = array('name' => 'contribution_note', 'title' => ts('Contribution Note'));
unset($fields['contribution_contact_id']);
self::$_contributionFields = $fields;
}
return self::$_contributionFields;
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:20,代码来源:Query.php
示例13: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviContribute'));
$startToDate = array();
$yearToDate = array();
$monthToDate = array();
$status = array('Valid', 'Cancelled');
$startDate = null;
$config =& CRM_Core_Config::singleton();
$currentMonth = date('m');
$currentDay = date('d');
if ((int) $config->fiscalYearStart['M'] > $currentMonth || (int) $config->fiscalYearStart['M'] == $currentMonth && (int) $config->fiscalYearStart['d'] > $currentDay) {
$year = date('Y') - 1;
} else {
$year = date('Y');
}
$year = array('Y' => $year);
$yearDate = $config->fiscalYearStart;
$yearDate = array_merge($year, $yearDate);
$yearDate = CRM_Utils_Date::format($yearDate);
$monthDate = date('Ym') . '01000000';
$prefixes = array('start', 'month', 'year');
$status = array('Valid', 'Cancelled');
$yearNow = $yearDate + 10000;
$yearNow .= '000000';
$yearDate = $yearDate . '000000';
// we are specific since we want all information till this second
$now = date('YmdHis');
require_once 'CRM/Contribute/BAO/Contribution.php';
foreach ($prefixes as $prefix) {
$aName = $prefix . 'ToDate';
$dName = $prefix . 'Date';
if ($prefix == 'year') {
$now = $yearNow;
}
foreach ($status as $s) {
${$aName}[$s] = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount($s, ${$dName}, $now);
${$aName}[$s]['url'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&status=1&start={${$dName}}&end={$now}&test=0");
}
$this->assign($aName, ${$aName});
}
// Check for admin permission to see if we should include the Manage Contribution Pages action link
$isAdmin = 0;
require_once 'CRM/Core/Permission.php';
if (CRM_Core_Permission::check('administer CiviCRM')) {
$isAdmin = 1;
}
$this->assign('isAdmin', $isAdmin);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:57,代码来源:DashBoard.php
示例14: civicrm_api3_order_create
/**
* Add or update a Order.
*
* @param array $params
* Input parameters.
*
* @throws API_Exception
* @return array
* Api result array
*/
function civicrm_api3_order_create(&$params)
{
$contribution = array();
$entity = NULL;
$entityIds = array();
if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) {
$priceSetID = NULL;
CRM_Contribute_BAO_Contribution::checkLineItems($params);
foreach ($params['line_items'] as $lineItems) {
$entityParams = CRM_Utils_Array::value('params', $lineItems, array());
if (!empty($entityParams) && !empty($lineItems['line_item'])) {
$item = reset($lineItems['line_item']);
$entity = str_replace('civicrm_', '', $item['entity_table']);
}
if ($entityParams) {
if (in_array($entity, array('participant', 'membership'))) {
$entityParams['skipLineItem'] = TRUE;
$entityResult = civicrm_api3($entity, 'create', $entityParams);
$params['contribution_mode'] = $entity;
$entityIds[] = $params[$entity . '_id'] = $entityResult['id'];
foreach ($lineItems['line_item'] as &$items) {
$items['entity_id'] = $entityResult['id'];
}
} else {
// pledge payment
}
}
if (empty($priceSetID)) {
$item = reset($lineItems['line_item']);
$priceSetID = civicrm_api3('PriceField', 'getvalue', array('return' => 'price_set_id', 'id' => $item['price_field_id']));
$params['line_item'][$priceSetID] = array();
}
$params['line_item'][$priceSetID] = array_merge($params['line_item'][$priceSetID], $lineItems['line_item']);
}
}
$contribution = civicrm_api3('Contribution', 'create', $params);
// add payments
if ($entity && CRM_Utils_Array::value('id', $contribution)) {
foreach ($entityIds as $entityId) {
$paymentParams = array('contribution_id' => $contribution['id'], $entity . '_id' => $entityId);
// if entity is pledge then build pledge param
if ($entity == 'pledge') {
$paymentParams += $entityParams;
}
$payments = civicrm_api3($entity . '_payment', 'create', $paymentParams);
}
}
return civicrm_api3_create_success(CRM_Utils_Array::value('values', $contribution), $params, 'Order', 'create');
}
开发者ID:andrew-cormick-dockery,项目名称:civicrm-core,代码行数:59,代码来源:Order.php
示例15: testsendMail
/**
* test setMail() method
*/
function testsendMail()
{
$this->markTestSkipped('throws fatals');
$contactId = Contact::createIndividual();
$params = array('title' => 'Test Cotribution Page', 'contribution_type_id' => $this->_contributionTypeID, 'is_active' => 1);
require_once 'CRM/Contribute/BAO/ContributionPage.php';
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params, $ids);
$contactId = Contact::createIndividual();
$ids = array('contribution' => null);
$params = array('contact_id' => $contactId, 'currency' => 'USD', 'contribution_type_id' => 1, 'contribution_status_id' => 1, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'id' => $contributionpage->id, 'non_deductible_amount' => 0.0, 'total_amount' => 200.0, 'fee_amount' => 5, 'net_amount' => 195, 'trxn_id' => '22ereerwww322323', 'invoice_id' => '22ed39c9e9ee6ef6031621ce0eafe6da70', 'thankyou_date' => '20080522');
require_once 'CRM/Contribute/BAO/Contribution.php';
$contribution = CRM_Contribute_BAO_Contribution::create($params, $ids);
$params = array('id' => 1, 'title' => test, 'contribution_type_id' => $this->_contributionTypeID, 'payment_processor_id' => 1, 'is_credit_card_only' => 0, 'is_monetary' => 1, 'is_recur' => 0, 'is_pay_later' => 1, 'pay_later_text' => 'I will send payment by check', 'pay_later_receipt' => 'test', 'is_allow_other_amount' => 0, 'is_for_organization' => 0, 'for_organization' => 'I am contributing on behalf of an organization.', 'is_email_receipt' => 1, 'is_active' => 1, 'amount_block_is_active' => 1, 'honor_block_is_active' => 0, 'start_date' => '2009-10-22 11:01:00', 'end_date' => '1970-01-01 00:00:00', 'amount' => array(), 'custom_post_id' => null, 'custom_pre_id' => 1, 'accountingCode' => null, 'footer_text' => 'test', 'contribution_id' => $contribution->id);
$sendmail = CRM_Contribute_BAO_ContributionPage::sendMail($contactId, &$params, $isTest = false, $returnMessageText = false);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:18,代码来源:ContributionPageTest.php
示例16: testGetTotalPayments
/**
* Test getTotalPayments function.
*/
public function testGetTotalPayments()
{
$contactId = $this->individualCreate();
$params = array('contact_id' => $contactId, 'currency' => 'USD', 'financial_type_id' => 1, 'contribution_status_id' => 2, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'is_pay_later' => 1, 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'non_deductible_amount' => 0.0, 'total_amount' => 200.0, 'fee_amount' => 5, 'net_amount' => 195, 'trxn_id' => '22ereerwwe4444yy', 'invoice_id' => '86ed39e9e9yy6ef6541621ce0eafe7eb81', 'thankyou_date' => '20080522');
$contribution = CRM_Contribute_BAO_Contribution::create($params);
$this->assertEquals($params['trxn_id'], $contribution->trxn_id);
$this->assertEquals($contactId, $contribution->contact_id);
$totalPaymentAmount = CRM_Core_BAO_FinancialTrxn::getTotalPayments($contribution->id);
$this->assertEquals(0, $totalPaymentAmount, 'Amount not matching.');
//update contribution amount
$params['id'] = $contribution->id;
$params['contribution_status_id'] = 1;
$contribution = CRM_Contribute_BAO_Contribution::create($params);
$this->assertEquals($params['trxn_id'], $contribution->trxn_id);
$this->assertEquals($params['contribution_status_id'], $contribution->contribution_status_id);
$totalPaymentAmount = CRM_Core_BAO_FinancialTrxn::getTotalPayments($contribution->id);
$this->assertEquals('200.00', $totalPaymentAmount, 'Amount not matching.');
}
开发者ID:konadave,项目名称:civicrm-core,代码行数:21,代码来源:FinancialTrxnTest.php
示例17: postProcess
/**
* Process the form after the input has been submitted and validated.
*/
public function postProcess()
{
$deleted = $failed = 0;
foreach ($this->_contributionIds as $contributionId) {
if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionId)) {
$deleted++;
} else {
$failed++;
}
}
if ($deleted) {
$msg = ts('%count contribution deleted.', array('plural' => '%count contributions deleted.', 'count' => $deleted));
CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
if ($failed) {
CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
}
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:21,代码来源:Delete.php
示例18: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if (!$this->_contributionId) {
if ($primaryParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'registered_by_id')) {
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $primaryParticipantId, 'contribution_id', 'participant_id');
}
}
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
$this->assign('feePaid', $this->_paidAmount);
$ids = CRM_Event_BAO_Participant::getParticipantIds($this->_contributionId);
if (count($ids) > 1) {
$total = 0;
foreach ($ids as $val) {
$total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant');
}
$this->assign('totalLineTotal', $total);
$lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($this->_participantId, 'civicrm_participant');
$this->assign('lineItemTotal', $lineItemTotal);
}
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:43,代码来源:ParticipantFeeSelection.php
示例19: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviContribute'));
$status = array('Valid', 'Cancelled');
$prefixes = array('start', 'month', 'year');
$startDate = NULL;
$startToDate = $monthToDate = $yearToDate = array();
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
foreach (array('now', 'yearDate', 'monthDate') as $date) {
${$date} = $dates[$date];
}
// fiscal years end date
$yearNow = date('Ymd', strtotime('+1 year -1 day', strtotime($yearDate)));
foreach ($prefixes as $prefix) {
$aName = $prefix . 'ToDate';
$dName = $prefix . 'Date';
if ($prefix == 'year') {
$now = $yearNow;
}
// appending end date i.e $now with time
// to also calculate records of end date till mid-night
$nowWithTime = $now . '235959';
foreach ($status as $s) {
${$aName}[$s] = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount($s, ${$dName}, $nowWithTime);
${$aName}[$s]['url'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&status=1&start={${$dName}}&end={$now}&test=0");
}
$this->assign($aName, ${$aName});
}
//for contribution tabular View
$buildTabularView = CRM_Utils_Array::value('showtable', $_GET, FALSE);
$this->assign('buildTabularView', $buildTabularView);
if ($buildTabularView) {
return;
}
// Check for admin permission to see if we should include the Manage Contribution Pages action link
$isAdmin = 0;
if (CRM_Core_Permission::check('administer CiviCRM')) {
$isAdmin = 1;
}
$this->assign('isAdmin', $isAdmin);
}
开发者ID:hguru,项目名称:224Civi,代码行数:50,代码来源:DashBoard.php
示例20: deleteParticipantPayment
/**
* Delete the record that are associated with this Participation Payment
*
* @param array $params array in the format of $field => $value.
*
* @return boolean true if deleted false otherwise
* @access public
*/
static function deleteParticipantPayment($params)
{
require_once 'CRM/Event/DAO/ParticipantPayment.php';
$participantPayment =& new CRM_Event_DAO_ParticipantPayment();
$valid = false;
foreach ($params as $field => $value) {
if (!empty($value)) {
$participantPayment->{$field} = $value;
$valid = true;
}
}
if (!$valid) {
CRM_Core_Error::fatal();
}
if ($participantPayment->find(true)) {
require_once 'CRM/Contribute/BAO/Contribution.php';
CRM_Contribute_BAO_Contribution::deleteContribution($participantPayment->contribution_id);
$participantPayment->delete();
return $participantPayment;
}
return false;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:30,代码来源:ParticipantPayment.php
注:本文中的CRM_Contribute_BAO_Contribution类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论