當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Contact_BAO_Relationship::deleteContact方法代碼示例

本文整理匯總了PHP中CRM_Contact_BAO_Relationship::deleteContact方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_BAO_Relationship::deleteContact方法的具體用法?PHP CRM_Contact_BAO_Relationship::deleteContact怎麽用?PHP CRM_Contact_BAO_Relationship::deleteContact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Contact_BAO_Relationship的用法示例。


在下文中一共展示了CRM_Contact_BAO_Relationship::deleteContact方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteContact

 /**
  * Delete a contact and all its associated records
  * 
  * @param  int  $id id of the contact to delete
  *
  * @return boolean true if contact deleted, false otherwise
  * @access public
  * @static
  */
 function deleteContact($id)
 {
     require_once 'CRM/Core/BAO/EmailHistory.php';
     require_once 'CRM/Core/BAO/Meeting.php';
     require_once 'CRM/Core/BAO/Phonecall.php';
     // make sure we have edit permission for this contact
     // before we delete
     if (!CRM_Contact_BAO_Contact::permissionedContact($id, CRM_CORE_PERMISSION_EDIT)) {
         return false;
     }
     require_once 'CRM/Utils/Hook.php';
     $contact =& new CRM_Contact_DAO_Contact();
     $contact->id = $id;
     if (!$contact->find(true)) {
         return false;
     }
     $contactType = $contact->contact_type;
     CRM_Utils_Hook::pre('delete', $contactType, $id);
     CRM_Core_DAO::transaction('BEGIN');
     // do a top down deletion
     CRM_Mailing_Event_BAO_Subscribe::deleteContact($id);
     CRM_Contact_BAO_GroupContact::deleteContact($id);
     CRM_Contact_BAO_SubscriptionHistory::deleteContact($id);
     CRM_Contact_BAO_Relationship::deleteContact($id);
     CRM_Contribute_BAO_Contribution::deleteContact($id);
     CRM_Core_BAO_Note::deleteContact($id);
     CRM_Core_DAO::deleteEntityContact('CRM_Core_DAO_CustomValue', $id);
     CRM_Core_DAO::deleteEntityContact('CRM_Core_DAO_ActivityHistory', $id);
     require_once 'CRM/Core/BAO/UFMatch.php';
     CRM_Core_BAO_UFMatch::deleteContact($id);
     // need to remove them from email, meeting and phonecall
     CRM_Core_BAO_EmailHistory::deleteContact($id);
     CRM_Core_BAO_Meeting::deleteContact($id);
     CRM_Core_BAO_Phonecall::deleteContact($id);
     // location shld be deleted after phonecall, since fields in phonecall are
     // fkeyed into location/phone.
     CRM_Core_BAO_Location::deleteContact($id);
     // fix household and org primary contact ids
     foreach ($GLOBALS['_CRM_CONTACT_BAO_CONTACT']['misc'] as $name) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_DAO_" . $name) . ".php";
         eval('$object =& new CRM_Contact_DAO_' . $name . '( );');
         $object->primary_contact_id = $id;
         $object->find();
         while ($object->fetch()) {
             // we need to set this to null explicitly
             $object->primary_contact_id = 'null';
             $object->save();
         }
     }
     require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_BAO_" . $contactType) . ".php";
     eval('$object =& new CRM_Contact_BAO_' . $contactType . '( );');
     $object->contact_id = $contact->id;
     $object->delete();
     $contact->delete();
     //delete the contact id from recently view
     CRM_Utils_Recent::del($id);
     CRM_Core_DAO::transaction('COMMIT');
     CRM_Utils_Hook::post('delete', $contactType, $contact->id, $contact);
     return true;
 }
開發者ID:bhirsch,項目名稱:voipdrupal-4.7-1.0,代碼行數:69,代碼來源:Contact.php


注:本文中的CRM_Contact_BAO_Relationship::deleteContact方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。