本文整理汇总了PHP中CRM_Contribute_BAO_ContributionRecur::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionRecur::create方法的具体用法?PHP CRM_Contribute_BAO_ContributionRecur::create怎么用?PHP CRM_Contribute_BAO_ContributionRecur::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_ContributionRecur
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_ContributionRecur::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveRecurringRecord
public function moveRecurringRecord($submittedValues)
{
// Move recurring record to another contact
if (!empty($submittedValues['contact_id']) && $submittedValues['contact_id'] != $this->_contactID) {
$selected_cid = $submittedValues['contact_id'];
// FIXME: Not getting the below value in $submittedValues
// So taking the value from $_POST
if (isset($_POST['membership_record'])) {
$membership_record = $_POST['membership_record'];
}
// Update contact id in civicrm_contribution_recur table
$recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->id = $this->_id;
if ($recurring->find(TRUE)) {
$recurParams = (array) $recurring;
$recurParams['contact_id'] = $selected_cid;
CRM_Contribute_BAO_ContributionRecur::create($recurParams);
}
// Update contact id in civicrm_contribution table, if 'Move Existing Contributions?' is ticked
if (isset($submittedValues['move_existing_contributions']) && $submittedValues['move_existing_contributions'] == 1) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contribution_recur_id = $this->_id;
$contribution->find();
while ($contribution->fetch()) {
$contributionParams = (array) $contribution;
$contributionParams['contact_id'] = $selected_cid;
// Update contact_id of contributions
// related to the recurring contribution
CRM_Contribute_BAO_Contribution::create($contributionParams);
}
}
}
if (!empty($membership_record)) {
// Remove the contribution_recur_id from existing membership
if (!empty($this->_membershipID)) {
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_membershipID;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = 'NULL';
CRM_Member_BAO_Membership::add($membershipParams);
}
}
// Update contribution_recur_id to the new membership
$membership = new CRM_Member_DAO_Membership();
$membership->id = $membership_record;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = $this->_id;
CRM_Member_BAO_Membership::add($membershipParams);
}
}
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:53,代码来源:ContributionRecur.php