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