本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::addSoftContribution方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::addSoftContribution方法的具体用法?PHP CRM_Contribute_BAO_Contribution::addSoftContribution怎么用?PHP CRM_Contribute_BAO_Contribution::addSoftContribution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::addSoftContribution方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_contributionsoft_create
function civicrm_contributionsoft_create( &$params ) {
_civicrm_initialize( );
require_once 'CRM/Contribute/BAO/Contribution.php';
$softContribution = CRM_Contribute_BAO_Contribution::addSoftContribution( $params );
_civicrm_object_to_array($softContribution, $softContributionArray);
return $softContributionArray;
}
示例2: processContribution
//.........这里部分代码省略.........
}
foreach (array('pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note') as $val) {
if (CRM_Utils_Array::value($val, $params)) {
$contribSoftParams[$val] = $params[$val];
}
}
require_once 'CRM/Contribute/BAO/Contribution.php';
//create an contribution address
if ($form->_contributeMode != 'notify' && !CRM_Utils_Array::value('is_pay_later', $params)) {
$contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
}
// CRM-4038: for non-en_US locales, CRM_Contribute_BAO_Contribution::add() expects localised amounts
require_once 'CRM/Utils/Money.php';
$contribParams['non_deductible_amount'] = trim(CRM_Utils_Money::format($contribParams['non_deductible_amount'], ' '));
$contribParams['total_amount'] = trim(CRM_Utils_Money::format($contribParams['total_amount'], ' '));
//add contribution record
$contribution =& CRM_Contribute_BAO_Contribution::add($contribParams, $ids);
// process price set, CRM-5095
if ($contribution->id && $form->_priceSetId) {
require_once 'CRM/Contribute/Form/AdditionalInfo.php';
CRM_Contribute_Form_AdditionalInfo::processPriceSet($contribution->id, $form->_lineItem);
}
//add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
if (CRM_Utils_Array::value('pcp_made_through_id', $params) || CRM_Utils_Array::value('soft_credit_to', $params)) {
$contribSoftParams['contribution_id'] = $contribution->id;
$contribSoftParams['amount'] = $params['amount'];
//if its due to pcp
if (CRM_Utils_Array::value('pcp_made_through_id', $params)) {
$contribSoftParams['pcp_id'] = $params['pcp_made_through_id'];
$contribSoftParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $params['pcp_made_through_id'], 'contact_id');
} else {
$contribSoftParams['contact_id'] = CRM_Utils_Array::value('soft_credit_to', $params);
}
$softContribution = CRM_Contribute_BAO_Contribution::addSoftContribution($contribSoftParams);
}
//handle pledge stuff.
if (!CRM_Utils_Array::value('separate_membership_payment', $form->_params) && CRM_Utils_Array::value('pledge_block_id', $form->_values) && (CRM_Utils_Array::value('is_pledge', $form->_params) || CRM_Utils_Array::value('pledge_id', $form->_values))) {
if (CRM_Utils_Array::value('pledge_id', $form->_values)) {
//when user doing pledge payments.
//update the schedule when payment(s) are made
require_once 'CRM/Pledge/BAO/Payment.php';
foreach ($form->_params['pledge_amount'] as $paymentId => $dontCare) {
$pledgePaymentParams = array('id' => $paymentId, 'contribution_id' => $contribution->id, 'status_id' => $contribution->contribution_status_id);
CRM_Pledge_BAO_Payment::add($pledgePaymentParams);
}
//update pledge status according to the new payment statuses
CRM_Pledge_BAO_Payment::updatePledgePaymentStatus($form->_values['pledge_id']);
} else {
//when user creating pledge record.
$pledgeParams = array();
$pledgeParams['contact_id'] = $contribution->contact_id;
$pledgeParams['installment_amount'] = $contribution->total_amount;
$pledgeParams['contribution_id'] = $contribution->id;
$pledgeParams['contribution_page_id'] = $contribution->contribution_page_id;
$pledgeParams['contribution_type_id'] = $contribution->contribution_type_id;
$pledgeParams['frequency_interval'] = $params['pledge_frequency_interval'];
$pledgeParams['installments'] = $params['pledge_installments'];
$pledgeParams['frequency_unit'] = $params['pledge_frequency_unit'];
$pledgeParams['frequency_day'] = 1;
$pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
$pledgeParams['status_id'] = $contribution->contribution_status_id;
$pledgeParams['max_reminders'] = $form->_values['max_reminders'];
$pledgeParams['initial_reminder_day'] = $form->_values['initial_reminder_day'];
$pledgeParams['additional_reminder_day'] = $form->_values['additional_reminder_day'];
$pledgeParams['is_test'] = $contribution->is_test;
$pledgeParams['acknowledge_date'] = date('Ymd');
示例3: processPcpSoft
/**
* Function used to save pcp / soft credit entry
* This is used by contribution and also event pcps
*
* @param array $params associated array
* @param object $contribution contribution object
*
* @static
* @access public
*/
static function processPcpSoft(&$params, &$contribution)
{
//add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
if (CRM_Utils_Array::value('soft_credit_to', $params)) {
$contribSoftParams = array();
foreach (array('pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) {
if (CRM_Utils_Array::value($val, $params)) {
$contribSoftParams[$val] = $params[$val];
}
}
$contribSoftParams['contact_id'] = $params['soft_credit_to'];
// add contribution id
$contribSoftParams['contribution_id'] = $contribution->id;
// add pcp id
$contribSoftParams['pcp_id'] = $params['pcp_made_through_id'];
$softContribution = CRM_Contribute_BAO_Contribution::addSoftContribution($contribSoftParams);
}
}