本文整理汇总了PHP中CRM_Utils_Recent::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Recent::del方法的具体用法?PHP CRM_Utils_Recent::del怎么用?PHP CRM_Utils_Recent::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Recent
的用法示例。
在下文中一共展示了CRM_Utils_Recent::del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteParticipant
/**
* Delete the record that are associated with this participation
*
* @param int $id id of the participation to delete
*
* @return void
* @access public
* @static
*/
static function deleteParticipant($id)
{
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
//delete activity record
require_once "CRM/Activity/BAO/Activity.php";
$params = array('source_record_id' => $id, 'activity_type_id' => 5);
// activity type id for event registration
CRM_Activity_BAO_Activity::deleteActivity($params);
// delete the participant payment record
// we need to do this since the cascaded constraints
// dont work with join tables
require_once 'CRM/Event/BAO/ParticipantPayment.php';
$p = array('participant_id' => $id);
CRM_Event_BAO_ParticipantPayment::deleteParticipantPayment($p);
// cleanup line items.
require_once 'CRM/Price/BAO/LineItem.php';
$participantsId = array();
$participantsId = self::getAdditionalParticipantIds($id);
$participantsId[] = $id;
CRM_Price_BAO_LineItem::deleteLineItems($participantsId, 'civicrm_participant');
$participant = new CRM_Event_DAO_Participant();
$participant->id = $id;
$participant->delete();
$transaction->commit();
// delete the recently created Participant
require_once 'CRM/Utils/Recent.php';
$participantRecent = array('id' => $id, 'type' => 'Participant');
CRM_Utils_Recent::del($participantRecent);
return $participant;
}
示例2: del
/**
* Delete the notes.
*
* @param int $id
* Note id.
* @param bool $showStatus
* Do we need to set status or not.
*
* @return int|NULL
* no of deleted notes on success, null otherwise
*/
public static function del($id, $showStatus = TRUE)
{
$return = NULL;
$recent = array($id);
$note = new CRM_Core_DAO_Note();
$note->id = $id;
$note->find();
$note->fetch();
if ($note->entity_table == 'civicrm_note') {
$status = ts('Selected Comment has been deleted successfully.');
} else {
$status = ts('Selected Note has been deleted successfully.');
}
// Delete all descendents of this Note
foreach (self::getDescendentIds($id) as $childId) {
$childNote = new CRM_Core_DAO_Note();
$childNote->id = $childId;
$childNote->delete();
$childNote->free();
$recent[] = $childId;
}
$return = $note->delete();
$note->free();
if ($showStatus) {
CRM_Core_Session::setStatus($status, ts('Deleted'), 'success');
}
// delete the recently created Note
foreach ($recent as $recentId) {
$noteRecent = array('id' => $recentId, 'type' => 'Note');
CRM_Utils_Recent::del($noteRecent);
}
return $return;
}
示例3: deleteCase
/**
* Delete the record that are associated with this case
* record are deleted from case
*
* @param int $caseId id of the case to delete
*
* @param bool $moveToTrash
*
* @return bool is successful
* @access public
* @static
*/
static function deleteCase($caseId, $moveToTrash = FALSE)
{
CRM_Utils_Hook::pre('delete', 'Case', $caseId, CRM_Core_DAO::$_nullArray);
//delete activities
$activities = self::getCaseActivityDates($caseId);
if ($activities) {
foreach ($activities as $value) {
CRM_Activity_BAO_Activity::deleteActivity($value, $moveToTrash);
}
}
if (!$moveToTrash) {
$transaction = new CRM_Core_Transaction();
}
$case = new CRM_Case_DAO_Case();
$case->id = $caseId;
if (!$moveToTrash) {
$result = $case->delete();
$transaction->commit();
} else {
$result = $case->is_deleted = 1;
$case->save();
}
if ($result) {
// CRM-7364, disable relationships
self::enableDisableCaseRelationships($caseId, FALSE);
CRM_Utils_Hook::post('delete', 'Case', $caseId, $case);
// remove case from recent items.
$caseRecent = array('id' => $caseId, 'type' => 'Case');
CRM_Utils_Recent::del($caseRecent);
return TRUE;
}
return FALSE;
}
示例4: deleteActivity
/**
* Function to delete the activity
* @param array $params associated array
*
* @return void
* @access public
*
*/
public function deleteActivity(&$params, $moveToTrash = false)
{
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
$activity =& new CRM_Activity_DAO_Activity();
$activity->copyValues($params);
if (!$moveToTrash) {
$result = $activity->delete();
} else {
$activity->is_deleted = 1;
$result = $activity->save();
//log activty delete.CRM-4525.
$logMsg = "Case Activity deleted for";
$msgs = array();
$sourceContactId = CRM_Core_DAO::getfieldValue('CRM_Activity_DAO_Activity', $activity->id, 'source_contact_id');
if ($sourceContactId) {
$msgs[] = " source={$sourceContactId}";
}
//get target contacts.
$targetContactIds = CRM_Activity_BAO_ActivityTarget::getTargetNames($activity->id);
if (!empty($targetContactIds)) {
$msgs[] = " target =" . implode(',', array_keys($targetContactIds));
}
//get assignee contacts.
$assigneeContactIds = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activity->id);
if (!empty($assigneeContactIds)) {
$msgs[] = " assigne =" . implode(',', array_keys($assigneeContactIds));
}
$logMsg .= implode(', ', $msgs);
self::logActivityAction($activity, $logMsg);
}
// delete the recently created Activity
require_once 'CRM/Utils/Recent.php';
if ($result) {
CRM_Utils_Recent::del($activity->id);
}
$transaction->commit();
return $result;
}
示例5: deletePledge
/**
* Function to delete the pledge
*
* @param int $id pledge id
*
* @access public
* @static
*
*/
static function deletePledge($id)
{
CRM_Utils_Hook::pre('delete', 'Pledge', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
//check for no Completed Payment records with the pledge
$payment = new CRM_Pledge_DAO_PledgePayment();
$payment->pledge_id = $id;
$payment->find();
while ($payment->fetch()) {
//also delete associated contribution.
if ($payment->contribution_id) {
CRM_Contribute_BAO_Contribution::deleteContribution($payment->contribution_id);
}
$payment->delete();
}
$dao = new CRM_Pledge_DAO_Pledge();
$dao->id = $id;
$results = $dao->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Pledge', $dao->id, $dao);
// delete the recently created Pledge
$pledgeRecent = array('id' => $id, 'type' => 'Pledge');
CRM_Utils_Recent::del($pledgeRecent);
return $results;
}
示例6: 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;
}
示例7: deleteActivity
/**
* Function to delete the activity
* @param array $params associated array
*
* @return void
* @access public
*
*/
public function deleteActivity(&$params, $moveToTrash = false)
{
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
if (!$moveToTrash) {
if (!isset($params['id'])) {
if (is_array($params['activity_type_id'])) {
$activityTypes = implode(',', $params['activity_type_id']);
} else {
$activityTypes = $params['activity_type_id'];
}
$query = "DELETE FROM civicrm_activity WHERE source_record_id = {$params['source_record_id']} AND activity_type_id IN ( {$activityTypes} )";
$dao = CRM_Core_DAO::executeQuery($query);
} else {
$activity = new CRM_Activity_DAO_Activity();
$activity->copyValues($params);
$result = $activity->delete();
}
} else {
$activity = new CRM_Activity_DAO_Activity();
$activity->copyValues($params);
$activity->is_deleted = 1;
$result = $activity->save();
//log activty delete.CRM-4525.
$logMsg = "Case Activity deleted for";
$msgs = array();
$sourceContactId = CRM_Core_DAO::getfieldValue('CRM_Activity_DAO_Activity', $activity->id, 'source_contact_id');
if ($sourceContactId) {
$msgs[] = " source={$sourceContactId}";
}
//get target contacts.
$targetContactIds = CRM_Activity_BAO_ActivityTarget::getTargetNames($activity->id);
if (!empty($targetContactIds)) {
$msgs[] = " target =" . implode(',', array_keys($targetContactIds));
}
//get assignee contacts.
$assigneeContactIds = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activity->id);
if (!empty($assigneeContactIds)) {
$msgs[] = " assignee =" . implode(',', array_keys($assigneeContactIds));
}
$logMsg .= implode(', ', $msgs);
self::logActivityAction($activity, $logMsg);
}
// delete the recently created Activity
require_once 'CRM/Utils/Recent.php';
if ($result) {
$activityRecent = array('id' => $activity->id, 'type' => 'Activity');
CRM_Utils_Recent::del($activityRecent);
}
$transaction->commit();
return $result;
}
示例8: del
/**
* Delete the relationship.
*
* @param int $id
* Relationship id.
*
* @return null
*/
public static function del($id)
{
// delete from relationship table
CRM_Utils_Hook::pre('delete', 'Relationship', $id, CRM_Core_DAO::$_nullArray);
$relationship = self::clearCurrentEmployer($id, CRM_Core_Action::DELETE);
if (CRM_Core_Permission::access('CiviMember')) {
// create $params array which isrequired to delete memberships
// of the related contacts.
$params = array('relationship_type_id' => "{$relationship->relationship_type_id}_a_b", 'contact_check' => array($relationship->contact_id_b => 1));
$ids = array();
// calling relatedMemberships to delete the memberships of
// related contacts.
self::relatedMemberships($relationship->contact_id_a, $params, $ids, CRM_Core_Action::DELETE, FALSE);
}
$relationship->delete();
CRM_Core_Session::setStatus(ts('Selected relationship has been deleted successfully.'), ts('Record Deleted'), 'success');
CRM_Utils_Hook::post('delete', 'Relationship', $id, $relationship);
// delete the recently created Relationship
$relationshipRecent = array('id' => $id, 'type' => 'Relationship');
CRM_Utils_Recent::del($relationshipRecent);
return $relationship;
}
示例9: del
/**
* Function to delete the relationship
*
* @param int $id relationship id
*
* @return null
* @access public
*
* @static
*/
static function del($id)
{
// delete from relationship table
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::pre('delete', 'Relationship', $id, CRM_Core_DAO::$_nullArray);
$relationship =& new CRM_Contact_DAO_Relationship();
$relationship->id = $id;
$relationship->find(true);
//to delete relationship between household and individual
//or between individual and orgnization
if ($relationship->relationship_type_id == 4 || $relationship->relationship_type_id == 7) {
$sharedContact = new CRM_Contact_DAO_Contact();
$sharedContact->id = $relationship->contact_id_a;
$sharedContact->find(true);
if ($relationship->relationship_type_id == 4 && $relationship->contact_id_b == $sharedContact->employer_id) {
require_once 'CRM/Contact/BAO/Contact/Utils.php';
CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a);
} else {
if ($sharedContact->mail_to_household_id == $relationship->contact_id_b) {
self::deleteSharedAddress($relationship->contact_id_a);
}
}
}
if (CRM_Core_Permission::access('CiviMember')) {
// create $params array which isrequired to delete memberships
// of the related contacts.
$params = array('relationship_type_id' => "{$relationship->relationship_type_id}_a_b", 'contact_check' => array($relationship->contact_id_b => 1));
$ids = array();
// calling relatedMemberships to delete the memberships of
// related contacts.
self::relatedMemberships($relationship->contact_id_a, $params, $ids, CRM_Core_Action::DELETE);
}
$relationship->delete();
CRM_Core_Session::setStatus(ts('Selected Relationship has been Deleted Successfuly.'));
CRM_Utils_Hook::post('delete', 'Relationship', $relationship->id, $relationship);
// delete the recently created Relationship
require_once 'CRM/Utils/Recent.php';
$relationshipRecent = array('id' => $id, 'type' => 'Relationship');
CRM_Utils_Recent::del($relationshipRecent);
return $relationship;
}
示例10: del
/**
* Function to delete the notes
*
* @param int $id note id
*
* @return $return no of deleted notes on success, false otherwise
* @access public
* @static
*
*/
static function del($id)
{
$return = null;
$note =& new CRM_Core_DAO_Note();
$note->id = $id;
$return = $note->delete();
CRM_Core_Session::setStatus(ts('Selected Note has been Deleted Successfully.'));
// delete the recently created Note
require_once 'CRM/Utils/Recent.php';
$noteRecent = array('id' => $id, 'type' => 'Note');
CRM_Utils_Recent::del($noteRecent);
return $return;
}
示例11: del
/**
* Function to delete the grant
*
* @param int $id grant id
*
* @access public
* @static
*
*/
static function del($id)
{
require_once 'CRM/Grant/DAO/Grant.php';
$grant = new CRM_Grant_DAO_Grant();
$grant->id = $id;
$grant->find();
// delete the recently created Grant
require_once 'CRM/Utils/Recent.php';
$grantRecent = array('id' => $id, 'type' => 'Grant');
CRM_Utils_Recent::del($grantRecent);
while ($grant->fetch()) {
return $grant->delete();
}
return false;
}
示例12: deletePledge
/**
* Function to delete the pledge
*
* @param int $id pledge id
*
* @access public
* @static
*
*/
static function deletePledge($id)
{
CRM_Utils_Hook::pre('delete', 'Pledge', $id, CRM_Core_DAO::$_nullArray);
//check for no Completed Payment records with the pledge
require_once 'CRM/Pledge/DAO/Payment.php';
$payment = new CRM_Pledge_DAO_Payment();
$payment->pledge_id = $id;
$payment->find();
while ($payment->fetch()) {
//also delete associated contribution.
if ($payment->contribution_id) {
require_once 'CRM/Contribute/BAO/Contribution.php';
CRM_Contribute_BAO_Contribution::deleteContribution($payment->contribution_id);
}
$payment->delete();
}
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
$results = null;
$dao = new CRM_Pledge_DAO_Pledge();
$dao->id = $id;
$results = $dao->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Pledge', $dao->id, $dao);
// delete the recently created Activity
require_once 'CRM/Utils/Recent.php';
CRM_Utils_Recent::del($id);
return $results;
}
示例13: deleteMembership
/**
* Function to delete membership.
*
* @param int $membershipId membership id that needs to be deleted
*
* @static
*
* @return $results no of deleted Membership on success, false otherwise
* @access public
*/
static function deleteMembership($membershipId)
{
CRM_Utils_Hook::pre('delete', 'Membership', $membershipId, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
$results = NULL;
//delete activity record
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
$params = array();
$deleteActivity = false;
$membershipActivities = array('Membership Signup', 'Membership Renewal', 'Change Membership Status', 'Change Membership Type', 'Membership Renewal Reminder');
foreach ($membershipActivities as $membershipActivity) {
$activityId = array_search($membershipActivity, $activityTypes);
if ($activityId) {
$params['activity_type_id'][] = $activityId;
$deleteActivity = true;
}
}
if ($deleteActivity) {
$params['source_record_id'] = $membershipId;
CRM_Activity_BAO_Activity::deleteActivity($params);
}
self::deleteMembershipPayment($membershipId);
$membership = new CRM_Member_DAO_Membership();
$membership->id = $membershipId;
$results = $membership->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Membership', $membership->id, $membership);
// delete the recently created Membership
$membershipRecent = array('id' => $membershipId, 'type' => 'Membership');
CRM_Utils_Recent::del($membershipRecent);
return $results;
}
示例14: discard
/**
* Delete the group and all the object that connect to this group.
*
* Incredibly destructive.
*
* @param int $id Group id.
*/
public static function discard($id)
{
CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
// added for CRM-1631 and CRM-1794
// delete all subscribed mails with the selected group id
$subscribe = new CRM_Mailing_Event_DAO_Subscribe();
$subscribe->group_id = $id;
$subscribe->delete();
// delete all Subscription records with the selected group id
$subHistory = new CRM_Contact_DAO_SubscriptionHistory();
$subHistory->group_id = $id;
$subHistory->delete();
// delete all crm_group_contact records with the selected group id
$groupContact = new CRM_Contact_DAO_GroupContact();
$groupContact->group_id = $id;
$groupContact->delete();
// make all the 'add_to_group_id' field of 'civicrm_uf_group table', pointing to this group, as null
$params = array(1 => array($id, 'Integer'));
$query = "UPDATE civicrm_uf_group SET `add_to_group_id`= NULL WHERE `add_to_group_id` = %1";
CRM_Core_DAO::executeQuery($query, $params);
$query = "UPDATE civicrm_uf_group SET `limit_listings_group_id`= NULL WHERE `limit_listings_group_id` = %1";
CRM_Core_DAO::executeQuery($query, $params);
// make sure u delete all the entries from civicrm_mailing_group and civicrm_campaign_group
// CRM-6186
$query = "DELETE FROM civicrm_mailing_group where entity_table = 'civicrm_group' AND entity_id = %1";
CRM_Core_DAO::executeQuery($query, $params);
$query = "DELETE FROM civicrm_campaign_group where entity_table = 'civicrm_group' AND entity_id = %1";
CRM_Core_DAO::executeQuery($query, $params);
$query = "DELETE FROM civicrm_acl_entity_role where entity_table = 'civicrm_group' AND entity_id = %1";
CRM_Core_DAO::executeQuery($query, $params);
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled')) {
// clear any descendant groups cache if exists
CRM_Core_BAO_Cache::deleteGroup('descendant groups for an org');
}
// delete from group table
$group = new CRM_Contact_DAO_Group();
$group->id = $id;
$group->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Group', $id, $group);
// delete the recently created Group
$groupRecent = array('id' => $id, 'type' => 'Group');
CRM_Utils_Recent::del($groupRecent);
}
示例15: del
/**
* Function to delete the grant
*
* @param int $id grant id
*
* @access public
* @static
*
*/
static function del($id)
{
require_once 'CRM/Grant/DAO/Grant.php';
$grant =& new CRM_Grant_DAO_Grant();
$grant->id = $id;
$grant->find();
// delete the recently created Activity
require_once 'CRM/Utils/Recent.php';
CRM_Utils_Recent::del($id);
while ($grant->fetch()) {
return $grant->delete();
}
return false;
}