本文整理匯總了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