本文整理汇总了PHP中CRM_Pledge_BAO_PledgePayment::resetPledgePayment方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Pledge_BAO_PledgePayment::resetPledgePayment方法的具体用法?PHP CRM_Pledge_BAO_PledgePayment::resetPledgePayment怎么用?PHP CRM_Pledge_BAO_PledgePayment::resetPledgePayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Pledge_BAO_PledgePayment
的用法示例。
在下文中一共展示了CRM_Pledge_BAO_PledgePayment::resetPledgePayment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteContribution
/**
* Delete the indirect records associated with this contribution first.
*
* @param int $id
*
* @return mixed|null
* $results no of deleted Contribution on success, false otherwise
*/
public static function deleteContribution($id)
{
CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
$results = NULL;
//delete activity record
$params = array('source_record_id' => $id, 'activity_type_id' => 6);
CRM_Activity_BAO_Activity::deleteActivity($params);
//delete billing address if exists for this contribution.
self::deleteAddress($id);
//update pledge and pledge payment, CRM-3961
CRM_Pledge_BAO_PledgePayment::resetPledgePayment($id);
// remove entry from civicrm_price_set_entity, CRM-5095
if (CRM_Price_BAO_PriceSet::getFor('civicrm_contribution', $id)) {
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution', $id);
}
// cleanup line items.
$participantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $id, 'participant_id', 'contribution_id');
// delete any related entity_financial_trxn, financial_trxn and financial_item records.
CRM_Core_BAO_FinancialTrxn::deleteFinancialTrxn($id);
if ($participantId) {
CRM_Price_BAO_LineItem::deleteLineItems($participantId, 'civicrm_participant');
} else {
CRM_Price_BAO_LineItem::deleteLineItems($id, 'civicrm_contribution');
}
//delete note.
$note = CRM_Core_BAO_Note::getNote($id, 'civicrm_contribution');
$noteId = key($note);
if ($noteId) {
CRM_Core_BAO_Note::del($noteId, FALSE);
}
$dao = new CRM_Contribute_DAO_Contribution();
$dao->id = $id;
$results = $dao->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Contribution', $dao->id, $dao);
// delete the recently created Contribution
$contributionRecent = array('id' => $id, 'type' => 'Contribution');
CRM_Utils_Recent::del($contributionRecent);
return $results;
}