本文整理汇总了PHP中CRM_Core_BAO_Location::deleteLocationBlocks方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Location::deleteLocationBlocks方法的具体用法?PHP CRM_Core_BAO_Location::deleteLocationBlocks怎么用?PHP CRM_Core_BAO_Location::deleteLocationBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Location
的用法示例。
在下文中一共展示了CRM_Core_BAO_Location::deleteLocationBlocks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crm_delete_location
/**
* Deletes a contact location.
*
* @param object $contact A valid Contact object (passed by reference).
* @param string $location_id A valid location ID.
*
* @return null, if successful. CRM error object, if 'contact' or 'location_id' is invalid, permissions are insufficient, etc.
*
* @access public
*
*/
function crm_delete_location(&$contact, $location_id)
{
_crm_initialize();
if (!isset($contact->id)) {
return _crm_error('$contact is not valid contact datatype');
}
$locationId = (int) $location_id;
if ($locationId == 0) {
return _crm_error('missing or invalid $location_id');
}
$locationDAO =& new CRM_Core_DAO_Location();
$locationDAO->entity_table = 'civicrm_contact';
$locationDAO->entity_id = $contact->id;
$locationDAO->id = $locationId;
if (!$locationDAO->find()) {
return _crm_error('invalid $location_id');
}
$locationDAO->fetch();
CRM_Core_BAO_Location::deleteLocationBlocks($locationId);
// if we're deleting primary, lets change another one to primary
if ($locationDAO->is_primary) {
$otherLocationDAO =& new CRM_Core_DAO_Location();
$otherLocationDAO->entity_table = 'civicrm_contact';
$otherLocationDAO->entity_id = $contact->id;
$otherLocationDAO->whereAdd("id != {$locationId}");
$otherLocationDAO->orderBy('id');
if ($otherLocationDAO->find()) {
$otherLocationDAO->fetch();
$otherLocationDAO->is_primary = 1;
$otherLocationDAO->save();
}
}
$locationDAO->delete();
return null;
}
示例2: _civicrm_location_delete
/**
*
* @param <type> $contact
* @return <type>
*/
function _civicrm_location_delete(&$contact)
{
require_once 'CRM/Core/DAO/LocationType.php';
$locationTypeDAO =& new CRM_Core_DAO_LocationType();
$locationTypeDAO->id = $contact['location_type'];
if (!$locationTypeDAO->find()) {
return civicrm_create_error(ts('invalid location type'));
}
require_once 'CRM/Core/BAO/Location.php';
CRM_Core_BAO_Location::deleteLocationBlocks($contact['contact_id'], $contact['location_type']);
return null;
}
示例3: deleteContact
/**
* Delete the object records that are associated with this contact
*
* @param int $contactId id of the contact to delete
*
* @return void
* @access public
* @static
*/
function deleteContact($contactId)
{
$location =& new CRM_Core_DAO_Location();
$location->entity_id = $contactId;
$location->entity_table = CRM_Contact_DAO_Contact::getTableName();
$location->find();
while ($location->fetch()) {
CRM_Core_BAO_Location::deleteLocationBlocks($location->id);
$location->delete();
}
}