本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::createHonorContact方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::createHonorContact方法的具体用法?PHP CRM_Contribute_BAO_Contribution::createHonorContact怎么用?PHP CRM_Contribute_BAO_Contribution::createHonorContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::createHonorContact方法的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: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
require_once 'CRM/Pledge/BAO/Pledge.php';
CRM_Pledge_BAO_Pledge::deletePledge($this->_id);
return;
}
//get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
// set the contact, when contact is selected
if (CRM_Utils_Array::value('contact_select_id', $formValues)) {
$this->_contactID = CRM_Utils_Array::value('contact_select_id', $formValues);
}
$config =& CRM_Core_Config::singleton();
$session =& CRM_Core_Session::singleton();
//get All Payments status types.
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus();
$fields = array('frequency_unit', 'frequency_interval', 'frequency_day', 'installments', 'contribution_type_id', 'initial_reminder_day', 'max_reminders', 'additional_reminder_day', 'honor_type_id', 'honor_prefix_id', 'honor_first_name', 'honor_last_name', 'honor_email', 'contribution_page_id');
foreach ($fields as $f) {
$params[$f] = CRM_Utils_Array::value($f, $formValues);
}
//defaults status is "Pending".
//if update get status.
if ($this->_id) {
$params['pledge_status_id'] = $params['status_id'] = $this->_values['status_id'];
} else {
$params['pledge_status_id'] = $params['status_id'] = array_search('Pending', $paymentStatusTypes);
}
//format amount
$params['amount'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('amount', $formValues));
$dates = array('create_date', 'start_date', 'acknowledge_date', 'cancel_date');
foreach ($dates as $d) {
if ($this->_id && !$this->_isPending) {
if ($d == 'start_date') {
$params['scheduled_date'] = CRM_Utils_Date::processDate($this->_values[$d]);
}
$params[$d] = CRM_Utils_Date::processDate($this->_values[$d]);
} else {
if (CRM_Utils_Array::value($d, $formValues) && !CRM_Utils_System::isNull($formValues[$d])) {
if ($d == 'start_date') {
$params['scheduled_date'] = CRM_Utils_Date::processDate($formValues[$d]);
}
$params[$d] = CRM_Utils_Date::processDate($formValues[$d]);
} else {
$params[$d] = 'null';
}
}
}
if (CRM_Utils_Array::value('is_acknowledge', $formValues)) {
$params['acknowledge_date'] = date("Y-m-d");
}
// assign id only in update mode
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
}
$params['contact_id'] = $this->_contactID;
//handle Honoree contact.
if (CRM_Utils_Array::value('honor_type_id', $params)) {
require_once 'CRM/Contribute/BAO/Contribution.php';
if ($this->_honorID) {
$honorID = CRM_Contribute_BAO_Contribution::createHonorContact($params, $this->_honorID);
} else {
$honorID = CRM_Contribute_BAO_Contribution::createHonorContact($params);
}
$params["honor_contact_id"] = $honorID;
} else {
$params["honor_contact_id"] = 'null';
}
//format custom data
if (CRM_Utils_Array::value('hidden_custom', $formValues)) {
$params['hidden_custom'] = 1;
$customFields = CRM_Core_BAO_CustomField::getFields('Pledge');
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($formValues, $customFields, $this->_id, 'Pledge');
}
//handle pending pledge.
$params['is_pledge_pending'] = $this->_isPending;
//create pledge record.
require_once 'CRM/Pledge/BAO/Pledge.php';
$pledge =& CRM_Pledge_BAO_Pledge::create($params);
$statusMsg = null;
if ($pledge->id) {
//set the status msg.
if ($this->_action & CRM_Core_Action::ADD) {
$statusMsg = ts('Pledge has been recorded and the payment schedule has been created.<br />');
} else {
if ($this->_action & CRM_Core_Action::UPDATE) {
$statusMsg = ts('Pledge has been updated.<br />');
}
}
}
//handle Acknowledgment.
if (CRM_Utils_Array::value('is_acknowledge', $formValues) && $pledge->id) {
//calculate scheduled amount.
$params['scheduled_amount'] = round($params['amount'] / $params['installments']);
//.........这里部分代码省略.........
示例3: createHonorContact
/**
* Create the Honor contact
*
* @return void
* @access public
*/
function createHonorContact()
{
$params = $this->controller->exportValues('Main');
// return if we dont have enough information
if (empty($params["honor_first_name"]) && empty($params["honor_last_name"]) && empty($params["honor_email"])) {
return null;
}
//assign to template for email reciept
$honor_block_is_active = $this->get('honor_block_is_active');
$this->assign('honor_block_is_active', $honor_block_is_active);
$this->assign("honor_block_title", $this->_values['honor_block_title']);
require_once "CRM/Core/PseudoConstant.php";
$prefix = CRM_Core_PseudoConstant::individualPrefix();
$honorType = CRM_Core_PseudoConstant::honor();
$this->assign("honor_type", $honorType[$params["honor_type_id"]]);
$this->assign("honor_prefix", $prefix[$params["honor_prefix_id"]]);
$this->assign("honor_first_name", $params["honor_first_name"]);
$this->assign("honor_last_name", $params["honor_last_name"]);
$this->assign("honor_email", $params["honor_email"]);
//create honoree contact
require_once 'CRM/Contribute/BAO/Contribution.php';
return CRM_Contribute_BAO_Contribution::createHonorContact($params);
}
示例4: postProcessCommon
/**
* Function to process the Common data
*
* @access public
* @return None
*/
function postProcessCommon(&$params, &$formatted)
{
$fields = array('non_deductible_amount', 'total_amount', 'fee_amount', 'net_amount', 'trxn_id', 'invoice_id', 'honor_type_id', 'contribution_page_id');
foreach ($fields as $f) {
$formatted[$f] = CRM_Utils_Array::value($f, $params);
}
if (CRM_Utils_Array::value('thankyou_date', $params) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
$formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']);
} else {
$formatted['thankyou_date'] = 'null';
}
if (CRM_Utils_Array::value('is_email_receipt', $params)) {
$params['receipt_date'] = $formatted['receipt_date'] = date('YmdHis');
}
if (CRM_Utils_Array::value('honor_type_id', $params)) {
require_once 'CRM/Contribute/BAO/Contribution.php';
if ($this->_honorID) {
$honorId = CRM_Contribute_BAO_Contribution::createHonorContact($params, $this->_honorID);
} else {
$honorId = CRM_Contribute_BAO_Contribution::createHonorContact($params);
}
$formatted["honor_contact_id"] = $honorId;
} else {
$formatted["honor_contact_id"] = 'null';
}
//special case to handle if all checkboxes are unchecked
$customFields = CRM_Core_BAO_CustomField::getFields('Contribution', false, false, CRM_Utils_Array::value('contribution_type_id', $params));
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, CRM_Utils_Array::value('id', $params, null), 'Contribution');
}
示例5: createHonorContact
/**
* Create the Honor contact
*
* @return void
* @access public
*/
function createHonorContact()
{
$params = $this->controller->exportValues('Main');
// email is enough to create a contact
if (!CRM_Utils_Array::value('honor_email', $params) && (!CRM_Utils_Array::value('honor_first_name', $params) || !CRM_Utils_Array::value('honor_last_name', $params))) {
//don't create contact - possibly the form was left blank
return null;
}
//assign to template for email receipt
$honor_block_is_active = $this->get('honor_block_is_active');
$this->assign('honor_block_is_active', $honor_block_is_active);
$this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
$prefix = CRM_Core_PseudoConstant::individualPrefix();
$honorType = CRM_Core_PseudoConstant::honor();
$this->assign('honor_type', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $params), $honorType));
$this->assign('honor_prefix', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id', $params), $prefix));
$this->assign('honor_first_name', CRM_Utils_Array::value('honor_first_name', $params));
$this->assign('honor_last_name', CRM_Utils_Array::value('honor_last_name', $params));
$this->assign('honor_email', CRM_Utils_Array::value('honor_email', $params));
//create honoree contact
return CRM_Contribute_BAO_Contribution::createHonorContact($params);
}