本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::getHonorContacts方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::getHonorContacts方法的具体用法?PHP CRM_Contribute_BAO_Contribution::getHonorContacts怎么用?PHP CRM_Contribute_BAO_Contribution::getHonorContacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::getHonorContacts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: browse
/**
* This function is called when action is browse
*
* return null
* @access 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);
$controller->setEmbedded(TRUE);
$controller->reset();
$controller->set('cid', $this->_contactId);
$controller->set('crid', $this->_crid);
$controller->set('context', 'contribution');
$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'));
}
}
// assign vars to templates
$this->assign('action', $this->_action);
$this->assign('recurRows', $params);
$this->assign('recur', TRUE);
}
//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) {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
$this->assign('displayName', $displayName);
}
}
示例4: listContribution
/**
* called when action is browse.
*/
public function listContribution()
{
$controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), NULL, FALSE, FALSE, TRUE, FALSE);
$controller->setEmbedded(TRUE);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
//add honor block
$params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
if (!empty($params)) {
// assign vars to templates
$this->assign('honorRows', $params);
$this->assign('honor', TRUE);
}
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
$recur->is_test = 0;
$recur->find();
$config = CRM_Core_Config::singleton();
$recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$recurRow = array();
$recurIDs = array();
while ($recur->fetch()) {
$mode = $recur->is_test ? 'test' : 'live';
$paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
if (!$paymentProcessor) {
continue;
}
require_once 'api/v3/utils.php';
//@todo calling api functions directly is not supported
_civicrm_api3_object_to_array($recur, $values);
$values['recur_status'] = $recurStatus[$values['contribution_status_id']];
$recurRow[$values['id']] = $values;
$action = array_sum(array_keys(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard')));
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recur->id, 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
if ($hideUpdate) {
$action -= CRM_Core_Action::UPDATE;
}
$recurRow[$values['id']]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard'), $action, array('cid' => $this->_contactId, 'crid' => $values['id'], 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.dashboard.recurring', 'Contribution', $values['id']);
$recurIDs[] = $values['id'];
//reset $paymentObject for checking other paymenet processor
//recurring url
$paymentObject = NULL;
}
if (is_array($recurIDs) && !empty($recurIDs)) {
$getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
foreach ($getCount as $key => $val) {
$recurRow[$key]['completed'] = $val;
$recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
}
}
$this->assign('recurRows', $recurRow);
if (!empty($recurRow)) {
$this->assign('recur', TRUE);
} else {
$this->assign('recur', FALSE);
}
}
示例5: 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);
}
}
示例6: listContribution
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function listContribution()
{
$controller =& new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), null);
$controller->setEmbedded(true);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
//add honor block
require_once 'CRM/Contribute/BAO/Contribution.php';
$params = array();
$params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
if (!empty($params)) {
// assign vars to templates
$this->assign('honorRows', $params);
$this->assign('honor', true);
}
require_once 'CRM/Contribute/Form/ContributionBase.php';
require_once 'CRM/Contribute/BAO/ContributionRecur.php';
$recur =& new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
$recur->is_test = 0;
$recur->find();
$config =& CRM_Core_Config::singleton();
$recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
require_once 'CRM/Core/Payment.php';
require_once 'api/v2/utils.php';
$recurRow = array();
$recurIDs = array();
while ($recur->fetch()) {
$mode = $recur->is_test ? 'test' : 'live';
$paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
if (!$paymentProcessor) {
continue;
}
// note that we are passing a CRM_Core_Page object ($this) as if it were a form here:
$paymentObject =& CRM_Core_Payment::singleton($mode, 'Contribute', $paymentProcessor, $this);
_civicrm_object_to_array($recur, $values);
$values['cancelSubscriptionUrl'] = $paymentObject->cancelSubscriptionURL();
$values['recur_status'] = $recurStatus[$values['contribution_status_id']];
$recurRow[$values['id']] = $values;
$recurIDs[] = $values['id'];
//reset $paymentObject for checking other paymenet processor
//recurring url
$paymentObject = null;
}
if (is_array($recurIDs) && !empty($recurIDs)) {
$getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
foreach ($getCount as $key => $val) {
$recurRow[$key]['completed'] = $val;
$recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
}
}
$this->assign('recurRows', $recurRow);
if (!empty($recurRow)) {
$this->assign('recur', true);
} else {
$this->assign('recur', false);
}
}