CRM_Contact_BAO_Contact_Utils
in package
Tags
Table of Contents
Methods
- buildOnBehalfForm() : mixed
- Build form for related contacts / on behalf of organization.
- checkContactType() : bool
- Function check for mix contact ids(individual+household etc...)
- clearAllEmployee() : mixed
- Clear cache employer name and employer id of all employee when employer get deleted.
- clearContactCaches() : void
- 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
- clearCurrentEmployer() : mixed
- Clear cached current employer name.
- contactDetails() : array<string|int, mixed>
- This function retrieve component related contact information.
- createCurrentEmployerRelationship() : void
- Create Current employer relationship for a individual.
- defaultGreeting() : int|null
- Fetch the default greeting for a given contact type.
- formatContactIDSToLinks() : array<string|int, mixed>
- Given an array of contact ids this function will return array with links to view contact page.
- generateChecksum() : string
- Generate a checksum for a $entityId of type $entityType
- getAddressShareContactNames() : array<string|int, mixed>
- Get the list of contact name give address associated array.
- getImage() : string
- Given a contact type or sub_type(s), generate markup for the contact type icon.
- getTokensRequiredForContactGreetings() : array<string|int, mixed>
- Get the tokens that will need to be resolved to populate the contact's greetings.
- isContactId() : bool
- Determine if a contact ID is real/valid.
- processSharedAddress() : mixed
- Function handles shared contact address processing.
- setCurrentEmployer() : mixed
- Set current employer id and organization name.
- updateCurrentEmployer() : mixed
- Update cached current employer name.
- updateGreeting() : mixed
- validChecksum() : bool
- Make sure the checksum is valid for the passed in contactID.
- currentEmployerRelatedMembership() : mixed
- Create related memberships for current employer.
Methods
buildOnBehalfForm()
Build form for related contacts / on behalf of organization.
public
static buildOnBehalfForm(CRM_Core_Form &$form, string $contactType, int $countryID, int $stateID, string $title) : mixed
since 5.74 will be removed around 5.80
Parameters
- $form : CRM_Core_Form
- $contactType : string
-
contact type.
- $countryID : int
- $stateID : int
- $title : string
-
fieldset title.
Tags
checkContactType()
Function check for mix contact ids(individual+household etc...)
public
static checkContactType(array<string|int, mixed> &$contactIds) : bool
Parameters
- $contactIds : array<string|int, mixed>
-
Array of contact ids.
Return values
bool —true if mix contact array else false
clearAllEmployee()
Clear cache employer name and employer id of all employee when employer get deleted.
public
static clearAllEmployee(int $employerId) : mixed
Parameters
- $employerId : int
-
Contact id of employer ( organization id ).
clearContactCaches()
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
public
static clearContactCaches([bool $isEmptyPrevNextTable = FALSE ]) : void
Parameters
- $isEmptyPrevNextTable : bool = FALSE
-
Should the civicrm_prev_next table be cleared of any contact entries. This is currently done from import but not other places and would likely affect user experience in unexpected ways. Existing behaviour retained ... reluctantly.
clearCurrentEmployer()
Clear cached current employer name.
public
static clearCurrentEmployer(int $contactId[, int $employerId = NULL ]) : mixed
Parameters
- $contactId : int
-
Contact id ( mostly individual contact id).
- $employerId : int = NULL
-
Contact id ( mostly organization contact id).
Tags
contactDetails()
This function retrieve component related contact information.
public
static contactDetails(array<string|int, mixed> $componentIds, string $componentName[, array<string|int, mixed> $returnProperties = [] ]) : array<string|int, mixed>
Parameters
- $componentIds : array<string|int, mixed>
-
Array of component Ids.
- $componentName : string
- $returnProperties : array<string|int, mixed> = []
-
Array of return elements.
Return values
array<string|int, mixed> —array of contact info.
createCurrentEmployerRelationship()
Create Current employer relationship for a individual.
public
static createCurrentEmployerRelationship(int $contactID, int|string $employerIDorName[, int|null $previousEmployerID = NULL ][, bool $newContact = FALSE ]) : void
Parameters
- $contactID : int
-
Contact id of the individual.
- $employerIDorName : int|string
-
(id or name).
- $previousEmployerID : int|null = NULL
- $newContact : bool = FALSE
Tags
defaultGreeting()
Fetch the default greeting for a given contact type.
public
static defaultGreeting(string $contactType, string $greetingType) : int|null
Parameters
- $contactType : string
-
Contact type.
- $greetingType : string
-
Greeting type.
Return values
int|nullformatContactIDSToLinks()
Given an array of contact ids this function will return array with links to view contact page.
public
static formatContactIDSToLinks(array<string|int, mixed> $contactIDs[, bool $addViewLink = TRUE ][, bool $addEditLink = TRUE ][, int $originalId = NULL ]) : array<string|int, mixed>
Parameters
- $contactIDs : array<string|int, mixed>
-
Associated contact id's.
- $addViewLink : bool = TRUE
- $addEditLink : bool = TRUE
- $originalId : int = NULL
-
Associated with the contact which is edited.
Return values
array<string|int, mixed> —returns array with links to contact view
generateChecksum()
Generate a checksum for a $entityId of type $entityType
public
static generateChecksum(int $entityId[, int $ts = NULL ][, int $live = NULL ][, string $hash = NULL ][, string $entityType = 'contact' ][, int|null $hashSize = NULL ]) : string
Parameters
- $entityId : int
- $ts : int = NULL
-
Timestamp that checksum was generated.
- $live : int = NULL
-
Life of this checksum in hours/ 'inf' for infinite.
- $hash : string = NULL
-
Contact hash, if sent, prevents a query in inner loop.
- $entityType : string = 'contact'
- $hashSize : int|null = NULL
Tags
Return values
string —(Underscore separated: $cs, $ts, $live )
getAddressShareContactNames()
Get the list of contact name give address associated array.
public
static getAddressShareContactNames(array<string|int, mixed> $addresses) : array<string|int, mixed>
Parameters
- $addresses : array<string|int, mixed>
-
Associated array of.
Return values
array<string|int, mixed> —associated array of contact names
getImage()
Given a contact type or sub_type(s), generate markup for the contact type icon.
public
static getImage(string $contactTypes[, bool $urlOnly = FALSE ][, int $contactId = NULL ][, bool $addProfileOverlay = TRUE ][, string $contactUrl = NULL ]) : string
Parameters
- $contactTypes : string
-
Contact type.
- $urlOnly : bool = FALSE
-
If we need to return only image url.
- $contactId : int = NULL
-
Contact id.
- $addProfileOverlay : bool = TRUE
-
If profile overlay class should be added.
- $contactUrl : string = NULL
-
URL to the contact page. Defaults to civicrm/contact/view
Tags
Return values
stringgetTokensRequiredForContactGreetings()
Get the tokens that will need to be resolved to populate the contact's greetings.
public
static getTokensRequiredForContactGreetings(array<string|int, mixed> $contactParams) : array<string|int, mixed>
Parameters
- $contactParams : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of tokens. The ALL ke
isContactId()
Determine if a contact ID is real/valid.
public
static isContactId(int $contactId) : bool
Parameters
- $contactId : int
-
The hypothetical contact ID
Tags
Return values
boolprocessSharedAddress()
Function handles shared contact address processing.
public
static processSharedAddress(array<string|int, mixed> &$address) : mixed
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 more efficient.
Parameters
- $address : array<string|int, mixed>
-
This is associated array which contains submitted form values.
setCurrentEmployer()
Set current employer id and organization name.
public
static setCurrentEmployer(array<string|int, mixed> $currentEmployerParams) : mixed
Parameters
- $currentEmployerParams : array<string|int, mixed>
-
Associated array of contact id and its employer id.
updateCurrentEmployer()
Update cached current employer name.
public
static updateCurrentEmployer(int $organizationId) : mixed
Parameters
- $organizationId : int
-
Current employer id.
updateGreeting()
public
static updateGreeting(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
Tags
validChecksum()
Make sure the checksum is valid for the passed in contactID.
public
static validChecksum(int $contactID, string $inputCheck) : bool
Parameters
- $contactID : int
- $inputCheck : string
-
Checksum to match against.
Tags
Return values
bool —true if valid, else false
currentEmployerRelatedMembership()
Create related memberships for current employer.
private
static currentEmployerRelatedMembership(int $contactID, int $employerID, array<string|int, mixed> $relationshipParams[, bool $duplicate = FALSE ][, int $previousEmployerID = NULL ]) : mixed
Parameters
- $contactID : int
-
Contact id of the individual.
- $employerID : int
-
Contact id of the organization.
- $relationshipParams : array<string|int, mixed>
-
Relationship params.
- $duplicate : bool = FALSE
-
Are we triggered existing relationship.
- $previousEmployerID : int = NULL