本文整理汇总了PHP中CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner方法的具体用法?PHP CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner怎么用?PHP CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_Form_Contribution_Confirm
的用法示例。
在下文中一共展示了CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processSoftContribution
/**
* Process the soft contribution and/or link to personal campaign page.
*
* @param array $params
* @param object $contribution CRM_Contribute_DAO_Contribution
*
*/
public static function processSoftContribution($params, $contribution)
{
//retrieve existing soft-credit and pcp id(s) if any against $contribution
$softIDs = self::getSoftCreditIds($contribution->id);
$pcpId = self::getSoftCreditIds($contribution->id, TRUE);
if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
$softParams = array();
$softParams['id'] = $pcpId ? $pcpId : NULL;
$softParams['contribution_id'] = $contribution->id;
$softParams['pcp_id'] = $pcp['pcp_made_through_id'];
$softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcp['pcp_made_through_id'], 'contact_id');
$softParams['currency'] = $contribution->currency;
$softParams['amount'] = $contribution->total_amount;
$softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
$softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
$softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
$contributionSoft = self::add($softParams);
//Send notification to owner for PCP
if ($contributionSoft->pcp_id && empty($pcpId)) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
}
} elseif (array_key_exists('pcp', $params) && $pcpId) {
$deleteParams = array('id' => $pcpId);
CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
}
if (isset($params['soft_credit'])) {
$softParams = $params['soft_credit'];
foreach ($softParams as $softParam) {
if (!empty($softIDs)) {
$key = key($softIDs);
$softParam['id'] = $softIDs[$key];
unset($softIDs[$key]);
}
$softParam['contribution_id'] = $contribution->id;
$softParam['currency'] = $contribution->currency;
//case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
if (empty($softParam['amount'])) {
$softParam['amount'] = $contribution->total_amount;
}
CRM_Contribute_BAO_ContributionSoft::add($softParam);
}
// delete any extra soft-credit while updating back-office contribution
foreach ((array) $softIDs as $softID) {
if (!in_array($softID, $params['soft_credit_ids'])) {
$deleteParams = array('id' => $softID);
CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
}
}
}
}
示例2: create
/**
* Takes an associative array and creates a contribution object.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $ids
* The array that holds all the db ids.
*
* @return CRM_Contribute_BAO_Contribution
*/
public static function create(&$params, $ids = array())
{
$dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
foreach ($dateFields as $df) {
if (isset($params[$df])) {
$params[$df] = CRM_Utils_Date::isoToMysql($params[$df]);
}
}
$transaction = new CRM_Core_Transaction();
$contribution = self::add($params, $ids);
if (is_a($contribution, 'CRM_Core_Error')) {
$transaction->rollback();
return $contribution;
}
$params['contribution_id'] = $contribution->id;
if (!empty($params['custom']) && is_array($params['custom'])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id);
}
$session = CRM_Core_Session::singleton();
if (!empty($params['note'])) {
$noteParams = array('entity_table' => 'civicrm_contribution', 'note' => $params['note'], 'entity_id' => $contribution->id, 'contact_id' => $session->get('userID'), 'modified_date' => date('Ymd'));
if (!$noteParams['contact_id']) {
$noteParams['contact_id'] = $params['contact_id'];
}
CRM_Core_BAO_Note::add($noteParams);
}
// make entry in batch entity batch table
if (!empty($params['batch_id'])) {
// in some update cases we need to get extra fields - ie an update that doesn't pass in all these params
$titleFields = array('contact_id', 'total_amount', 'currency', 'financial_type_id');
$retrieveRequired = 0;
foreach ($titleFields as $titleField) {
if (!isset($contribution->{$titleField})) {
$retrieveRequired = 1;
break;
}
}
if ($retrieveRequired == 1) {
$contribution->find(TRUE);
}
}
// Handle soft credit and / or link to personal campaign page
$softIDs = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id);
$pcpId = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id, TRUE);
if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
$softParams = array();
$softParams['id'] = $pcpId ? $pcpId : NULL;
$softParams['contribution_id'] = $contribution->id;
$softParams['pcp_id'] = $pcp['pcp_made_through_id'];
$softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcp['pcp_made_through_id'], 'contact_id');
$softParams['currency'] = $contribution->currency;
$softParams['amount'] = $contribution->total_amount;
$softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
$softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
$softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
$contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($softParams);
//Send notification to owner for PCP
if ($contributionSoft->pcp_id && empty($pcpId)) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
}
} elseif (array_key_exists('pcp', $params) && $pcpId) {
$deleteParams = array('id' => $pcpId);
CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
}
if (isset($params['soft_credit'])) {
$softParams = $params['soft_credit'];
foreach ($softParams as $softParam) {
if (!empty($softIDs)) {
$key = key($softIDs);
$softParam['id'] = $softIDs[$key];
unset($softIDs[$key]);
}
$softParam['contribution_id'] = $contribution->id;
$softParam['currency'] = $contribution->currency;
//case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
if (empty($softParam['amount'])) {
$softParam['amount'] = $contribution->total_amount;
}
CRM_Contribute_BAO_ContributionSoft::add($softParam);
}
if (!empty($softIDs)) {
foreach ($softIDs as $softID) {
if (!in_array($softID, $params['soft_credit_ids'])) {
$deleteParams = array('id' => $softID);
CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
}
}
}
}
//.........这里部分代码省略.........
示例3: processPcpSoft
/**
* Function used to save pcp / soft credit entry.
*
* This is used by contribution and also event pcps
*
* @param array $params
* @param object $contribution
* Contribution object.
*/
public static function processPcpSoft(&$params, &$contribution)
{
// Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
if (!empty($params['soft_credit_to'])) {
$contributionSoftParams = array();
foreach (array('pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) {
if (!empty($params[$val])) {
$contributionSoftParams[$val] = $params[$val];
}
}
$contributionSoftParams['contact_id'] = $params['soft_credit_to'];
// add contribution id
$contributionSoftParams['contribution_id'] = $contribution->id;
// add pcp id
$contributionSoftParams['pcp_id'] = $params['pcp_made_through_id'];
$contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
$contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
//Send notification to owner for PCP
if ($contributionSoft->id && $contributionSoft->pcp_id) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
}
}
}