class CRM_Contact_BAO_Contact_Utils

Methods

static string
getImage(string $contactType, bool $urlOnly = FALSE, int $contactId = NULL, bool $addProfileOverlay = TRUE)

Given a contact type, get the contact image.

static bool
checkContactType(array $contactIds)

Function check for mix contact ids(individual+household etc.

static array
generateChecksum(int $entityId, int $ts = NULL, int $live = NULL, string $hash = NULL, string $entityType = 'contact', null $hashSize = NULL)

Generate a checksum for a $entityId of type $entityType

static bool
validChecksum(int $contactID, string $inputCheck)

Make sure the checksum is valid for the passed in contactID.

static int
maxLocations(int $contactId)

Get the count of contact loctions.

static 
createCurrentEmployerRelationship(int $contactID, $organization, int $previousEmployerID = NULL, bool $newContact = FALSE)

Create Current employer relationship for a individual.

static 
currentEmployerRelatedMembership(int $contactID, int $employerID, array $relationshipParams, bool $duplicate = FALSE, int $previousEmpID = NULL)

Create related memberships for current employer.

static 
setCurrentEmployer(array $currentEmployerParams)

Set current employer id and organization name.

static 
updateCurrentEmployer(int $organizationId)

Update cached current employer name.

static 
clearCurrentEmployer(int $contactId, int $employerId = NULL)

Clear cached current employer name.

static 
buildOnBehalfForm(CRM_Core_Form $form, string $contactType, int $countryID, int $stateID, string $title)

Build form for related contacts / on behalf of organization.

static 
clearAllEmployee(int $employerId)

Clear cache employer name and employer id of all employee when employer get deleted.

static array
formatContactIDSToLinks(array $contactIDs, bool $addViewLink = TRUE, bool $addEditLink = TRUE, int $originalId = NULL)

Given an array of contact ids this function will return array with links to view contact page.

static array
contactDetails(array $componentIds, string $componentName, array $returnProperties = array())

This function retrieve component related contact information.

static 
processSharedAddress(array $address)

Function handles shared contact address processing.

static array
getAddressShareContactNames(array $addresses)

Get the list of contact name give address associated array.

static 
clearContactCaches($contactID = NULL)

Clear the contact cache so things are kosher. We started off being super aggressive with clearing caches, but are backing off from this with every release. Compromise between ease of coding versus performance versus being accurate at that very instant

static 
updateGreeting(array $params)

No description

static int|NULL
defaultGreeting(string $contactType, string $greetingType)

Fetch the default greeting for a given contact type.

static 
processGreetingTemplate(string $templateString, array $contactDetails, int $contactID, string $className)

Process a greeting template string to produce the individualised greeting text.

static bool
isContactId(int $contactId)

Determine if a contact ID is real/valid.

Details

at line 49
static string getImage(string $contactType, bool $urlOnly = FALSE, int $contactId = NULL, bool $addProfileOverlay = TRUE)

Given a contact type, get the contact image.

Parameters

string $contactType Contact type.
bool $urlOnly If we need to return only image url.
int $contactId Contact id.
bool $addProfileOverlay If profile overlay class should be added.

Return Value

string

at line 124
static bool checkContactType(array $contactIds)

Function check for mix contact ids(individual+household etc.

..)

Parameters

array $contactIds Array of contact ids.

Return Value

bool true if mix contact array else false

at line 158
static array generateChecksum(int $entityId, int $ts = NULL, int $live = NULL, string $hash = NULL, string $entityType = 'contact', null $hashSize = NULL)

Generate a checksum for a $entityId of type $entityType

Parameters

int $entityId
int $ts Timestamp that checksum was generated.
int $live Life of this checksum in hours/ 'inf' for infinite.
string $hash Contact hash, if sent, prevents a query in inner loop.
string $entityType
null $hashSize

Return Value

array ( $cs, $ts, $live )

at line 222
static bool validChecksum(int $contactID, string $inputCheck)

Make sure the checksum is valid for the passed in contactID.

Parameters

int $contactID
string $inputCheck Checksum to match against.

Return Value

bool true if valid, else false

at line 255
static int maxLocations(int $contactId)

Get the count of contact loctions.

Parameters

int $contactId Contact id.

Return Value

int max locations for the contact

at line 284
static createCurrentEmployerRelationship(int $contactID, $organization, int $previousEmployerID = NULL, bool $newContact = FALSE)

Create Current employer relationship for a individual.

Parameters

int $contactID Contact id of the individual.
$organization (id or name).
int $previousEmployerID
bool $newContact

at line 360
static currentEmployerRelatedMembership(int $contactID, int $employerID, array $relationshipParams, bool $duplicate = FALSE, int $previousEmpID = NULL)

Create related memberships for current employer.

Parameters

int $contactID Contact id of the individual.
int $employerID Contact id of the organization.
array $relationshipParams Relationship params.
bool $duplicate Are we triggered existing relationship.
int $previousEmpID

Exceptions

CiviCRM_API3_Exception

at line 392
static setCurrentEmployer(array $currentEmployerParams)

Set current employer id and organization name.

Parameters

array $currentEmployerParams Associated array of contact id and its employer id.

at line 410
static updateCurrentEmployer(int $organizationId)

Update cached current employer name.

Parameters

int $organizationId Current employer id.

at line 426
static clearCurrentEmployer(int $contactId, int $employerId = NULL)

Clear cached current employer name.

Parameters

int $contactId Contact id ( mostly individual contact id).
int $employerId Contact id ( mostly organization contact id).

at line 477
static buildOnBehalfForm(CRM_Core_Form $form, string $contactType, int $countryID, int $stateID, string $title)

Build form for related contacts / on behalf of organization.

Parameters

CRM_Core_Form $form
string $contactType contact type.
int $countryID
int $stateID
string $title fieldset title.

at line 548
static clearAllEmployee(int $employerId)

Clear cache employer name and employer id of all employee when employer get deleted.

Parameters

int $employerId Contact id of employer ( organization id ).

Given an array of contact ids this function will return array with links to view contact page.

Parameters

array $contactIDs Associated contact id's.
bool $addViewLink
bool $addEditLink
int $originalId Associated with the contact which is edited.

Return Value

array returns array with links to contact view

at line 679
static array contactDetails(array $componentIds, string $componentName, array $returnProperties = array())

This function retrieve component related contact information.

Parameters

array $componentIds Array of component Ids.
string $componentName
array $returnProperties Array of return elements.

Return Value

array array of contact info.

at line 808
static processSharedAddress(array $address)

Function handles shared contact address processing.

In this function we just modify submitted values so that new address created for the user has same address as shared contact address. We copy the address so that search etc will be much efficient.

Parameters

array $address This is associated array which contains submitted form values.

at line 866
static array getAddressShareContactNames(array $addresses)

Get the list of contact name give address associated array.

Parameters

array $addresses Associated array of.

Return Value

array associated array of contact names

at line 903
static clearContactCaches($contactID = NULL)

Clear the contact cache so things are kosher. We started off being super aggressive with clearing caches, but are backing off from this with every release. Compromise between ease of coding versus performance versus being accurate at that very instant

Parameters

$contactID The contactID that was edited / deleted.

at line 920
static updateGreeting(array $params)

Parameters

array $params

Exceptions

Exception

at line 1076
static int|NULL defaultGreeting(string $contactType, string $greetingType)

Fetch the default greeting for a given contact type.

Parameters

string $contactType Contact type.
string $greetingType Greeting type.

Return Value

int|NULL

at line 1117
static processGreetingTemplate(string $templateString, array $contactDetails, int $contactID, string $className)

Process a greeting template string to produce the individualised greeting text.

This works just like message templates for mailings: the template is processed with the token substitution mechanism, to supply the individual contact data; and it is also processed with Smarty, to allow for conditionals etc. based on the contact data.

Note: We don't pass any variables to Smarty -- all variable data is inserted into the input string by the token substitution mechanism, before Smarty is invoked.

Parameters

string $templateString The greeting template string with contact tokens + Smarty syntax.
array $contactDetails
int $contactID
string $className

at line 1131
static bool isContactId(int $contactId)

Determine if a contact ID is real/valid.

Parameters

int $contactId The hypothetical contact ID

Return Value

bool