本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::annual方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::annual方法的具体用法?PHP CRM_Contribute_BAO_Contribution::annual怎么用?PHP CRM_Contribute_BAO_Contribution::annual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::annual方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testcreateAndGetHonorContact
/**
* create honor-contact method
* createHonorContact();
*/
function testcreateAndGetHonorContact()
{
$this->markTestSkipped('throws fatals');
$honorId = null;
$params = array('honor_type_id' => 1, 'honor_prefix_id' => 3, 'honor_first_name' => 'John', 'honor_last_name' => 'Smith', 'honor_email' => 'john.smith@example.org');
$contact = CRM_Contribute_BAO_Contribution::createHonorContact($params, $honorId);
$this->assertDBCompareValue('CRM_Contact_DAO_Contact', $contact, 'first_name', 'id', 'John', 'Database check for created honor contact record.');
//create contribution on behalf of honary.
$contactId = Contact::createIndividual();
$ids = array('contribution' => null);
$param = array('contact_id' => $contactId, 'currency' => 'USD', 'contribution_type_id' => 4, 'contribution_status_id' => 1, 'receive_date' => date('Ymd'), 'total_amount' => 66, 'honor_type_id' => 1, 'honor_contact_id' => $contact);
require_once 'CRM/Contribute/BAO/Contribution.php';
$contribution = CRM_Contribute_BAO_Contribution::create($param, $ids);
$id = $contribution->id;
$this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'honor_contact_id', 'id', $contact, 'Check DB for honor contact of the contribution');
//get honory information
$getHonorContact = CRM_Contribute_BAO_Contribution::getHonorContacts($contact);
$this->assertDBCompareValue('CRM_Contact_DAO_Contact', $contact, 'first_name', 'id', 'John', 'Database check for created honor contact record.');
//get annual contribution information
$annual = CRM_Contribute_BAO_Contribution::annual($contactId);
require_once 'CRM/Core/DAO.php';
$config =& CRM_Core_Config::singleton();
$currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Currency', $config->defaultCurrency, 'symbol', 'name');
$this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'total_amount', 'id', ltrim($annual[2], $currencySymbol), 'Check DB for total amount of the contribution');
//Delete honor contact
Contact::delete($contact);
//Delete contributor contact
Contact::delete($contactId);
}
示例2: 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);
}
}
示例3: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
require_once 'CRM/Contribute/BAO/Contribution.php';
// 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);
$controller->setEmbedded(true);
$controller->reset();
$controller->set('cid', $this->_contactId);
$controller->set('id', $this->_id);
$controller->set('context', 'contribution');
$controller->process();
$controller->run();
//add honor block
// form all action links
$action = array_sum(array_keys($this->honorLinks()));
$params = array();
$params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
if (!empty($params)) {
foreach ($params as $ids => $honorId) {
$params[$ids]['action'] = CRM_Core_Action::formLink(self::honorLinks(), $action, array('cid' => $honorId['honorId'], 'id' => $ids, 'cxt' => 'contribution', 'contributionType' => $honorId['type_id'], 'honorId' => $this->_contactId));
}
// assign vars to templates
$this->assign('action', $this->_action);
$this->assign('honorRows', $params);
$this->assign('honor', 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_Contribution::getSoftContributionList($this->_contactId, $isTest);
if (!empty($softCreditList)) {
$softCreditTotals = array();
list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_Contribution::getSoftContributionTotals($this->_contactId, $isTest);
$this->assign('softCredit', true);
$this->assign('softCreditRows', $softCreditList);
$this->assign('softCreditTotals', $softCreditTotals);
}
if ($this->_contactId) {
require_once 'CRM/Contact/BAO/Contact.php';
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
$this->assign('displayName', $displayName);
}
}
示例4: testcreateAndGetHonorContact
/**
* Create honor-contact method
*/
public function testcreateAndGetHonorContact()
{
$firstName = 'John_' . substr(sha1(rand()), 0, 7);
$lastName = 'Smith_' . substr(sha1(rand()), 0, 7);
$email = "{$firstName}.{$lastName}@example.com";
//Get profile id of name honoree_individual used to create profileContact
$honoreeProfileId = NULL;
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$honoreeProfileId = $ufGroupDAO->id;
}
$params = array('prefix_id' => 3, 'first_name' => $firstName, 'last_name' => $lastName, 'email-1' => $email);
$softParam = array('soft_credit_type_id' => 1);
$honoreeContactId = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray, NULL, NULL, $honoreeProfileId);
$this->assertDBCompareValue('CRM_Contact_DAO_Contact', $honoreeContactId, 'first_name', 'id', $firstName, 'Database check for created honor contact record.');
//create contribution on behalf of honary.
$contactId = Contact::createIndividual();
$softParam['contact_id'] = $honoreeContactId;
$ids = array('contribution' => NULL);
$param = array('contact_id' => $contactId, 'currency' => 'USD', 'financial_type_id' => 4, 'contribution_status_id' => 1, 'receive_date' => date('Ymd'), 'total_amount' => 66);
$contribution = CRM_Contribute_BAO_Contribution::create($param, $ids);
$id = $contribution->id;
$softParam['contribution_id'] = $id;
$softParam['currency'] = $contribution->currency;
$softParam['amount'] = $contribution->total_amount;
//Create Soft Contribution for honoree contact
CRM_Contribute_BAO_ContributionSoft::add($softParam);
$this->assertDBCompareValue('CRM_Contribute_DAO_ContributionSoft', $id, 'contact_id', 'contribution_id', $honoreeContactId, 'Check DB for honor contact of the contribution');
//get honorary information
$getHonorContact = CRM_Contribute_BAO_Contribution::getHonorContacts($honoreeContactId);
$this->assertEquals(array($id => array('honor_type' => 'In Honor of', 'honorId' => $id, 'display_name' => 'John Doe', 'type' => 'Event Fee', 'type_id' => '4', 'amount' => '$ 66.00', 'source' => NULL, 'receive_date' => date('Y-m-d 00:00:00'), 'contribution_status' => 'Completed')), $getHonorContact);
$this->assertDBCompareValue('CRM_Contact_DAO_Contact', $honoreeContactId, 'first_name', 'id', $firstName, 'Database check for created honor contact record.');
//get annual contribution information
$annual = CRM_Contribute_BAO_Contribution::annual($contactId);
$config = CRM_Core_Config::singleton();
$currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $config->defaultCurrency, 'symbol', 'name');
$this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'total_amount', 'id', ltrim($annual[2], $currencySymbol), 'Check DB for total amount of the contribution');
//Delete honor contact
Contact::delete($honoreeContactId);
//Delete Contribution record
$this->contributionDelete($contribution->id);
//Delete contributor contact
Contact::delete($contactId);
}
示例5: 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);
// Get all backoffice payment processors
$backOfficePaymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors(array('BackOffice'));
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;
// Get payment processor name
$paymentProcessorDetails = CRM_Financial_BAO_PaymentProcessor::getPayment($params[$ids]['payment_processor_id'], 'live');
$params[$ids]['payment_processor_name'] = $paymentProcessorDetails['name'];
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
if ($hideUpdate) {
$action -= CRM_Core_Action::UPDATE;
}
$links = self::recurLinks($ids);
// Disable Edit/Delete link if no back office support
if (!array_key_exists($recur['payment_processor_id'], $backOfficePaymentProcessors)) {
unset($links[2]);
unset($links[8]);
}
// Remove cancel link for already cancelled recurring records
if ($recur['contribution_status_id'] == 3) {
unset($links[64]);
}
$params[$ids]['action'] = CRM_Core_Action::formLink($links, $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_Contribute_BAO_ContributionRecur::contributionRecurCount($this->_contactId);
}
}