class CRM_Contact_BAO_Query

This is the heart of the search query building mechanism.

Constants

NO_RETURN_PROPERTIES

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_CONTACTS

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_CONTRIBUTE

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_MEMBER

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_EVENT

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_CONTACTSRELATED

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_GRANT

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_PLEDGEBANK

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_PLEDGE

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_CASE

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_ACTIVITY

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_CAMPAIGN

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_MAILING

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

MODE_ALL

The various search modes.

As of February 2017, entries not present for 4, 32, 64, 1024.

MODE_ALL seems to be out of sync with the available constants; if this is intentionally excluding MODE_MAILING then that may bear documenting?

Likewise if there's reason for the missing modes (4, 32, 64 etc).

SEARCH_OPERATOR_AND

Constants for search operators

SEARCH_OPERATOR_OR

Constants for search operators

Properties

static array $_defaultReturnProperties The default set of return properties.
static array $_defaultHierReturnProperties The default set of hier return properties.
array $_params The set of input params.
$_cfIDs
$_paramLookup
$_sort
array $_returnProperties The set of output params
array $_select The select clause
array $_element The name of the elements that are in the select clause used to extract the values.
array $_tables The tables involved in the query.
array $_whereTables The table involved in the where clause.
array $_where Array of WHERE clause components.
string $_whereClause The WHERE clause as a string.
string $_permissionWhereClause Additional WHERE clause for permissions.
string $_fromClause The from string
string $_permissionFromClause Additional permission from clause
string $_simpleFromClause The from clause for the simple select and alphabetical select
array $_having The having values
array $_qill The english language version of the query
array $_fields All the fields that could potentially be involved in this query
protected array $legacyHackedFields Fields hacked for legacy reasons.
array $_options The cache to translate the option values into labels.
$_search Are we in search mode.
bool $_skipPermission Should we skip permission checking.
bool $_skipDeleteClause Should we skip adding of delete clause.
bool $_strict Are we in strict mode (use equality over LIKE)
string $_operator What operator to use to group the clauses.
$_mode
bool $_primaryLocation Should we only search on primary location.
bool $_includeContactIds Are contact ids part of the query.
bool $_smartGroupCache Should we use the smart group cache.
string $_displayRelationshipType Should we display contacts with a specific relationship type.
Object $_customQuery Reference to the query object for custom values.
bool $_useDistinct Should we enable the distinct clause, used if we are including more than one group
bool $_useGroupBy Should we just display one contact record
static array $_relType The relationship type direction
static array $_activityRole The activity role
static array $_considerCompActivities Consider the component activity type during activity search.
static array $_withContactActivitiesOnly Consider with contact activities only, during activity search.
string $_distinctComponentClause Use distinct component clause for component searches
$_rowCountClause
string $_groupByComponentClause Use groupBy component clause for component searches
static array $_openedPanes Track open panes, useful in advance search
array $_locationSpecificCustomFields For search builder - which custom fields are location-dependent
static array $_dependencies The tables which have a dependency on location and/or address
static array $_locationSpecificFields List of location specific fields.
protected array $_rangeCache Remember if we handle either end of a number or date range so we can skip the other
protected bool $_relationshipValuesAdded Set to true when $this->relationship is run to avoid adding twice.
static string $_relationshipTempTable Set to the name of the temp table if one has been created.
$_pseudoConstantsSelect
$_groupUniqueKey
$_groupKeys

Methods

__construct(array $params = NULL, array $returnProperties = NULL, array $fields = NULL, bool $includeContactIds = FALSE, bool $strict = FALSE, bool|int $mode = 1, bool $skipPermission = FALSE, bool $searchDescendentGroups = TRUE, bool $smartGroupCache = TRUE, null $displayRelationshipType = NULL, string $operator = 'AND', string $apiEntity = NULL, bool|null $primaryLocationOnly = NULL)

Class constructor which also does all the work.

initialize(string $apiEntity = NULL)

Function which actually does all the work for the constructor.

buildParamsLookup()

Function for same purpose as convertFormValues.

addSpecialFields($apiEntity)

Some composite fields do not appear in the fields array hack to make them part of the query.

selectClause(string $apiEntity = NULL)

Given a list of conditions in params and a list of desired return Properties generate the required select and from clauses. Note that since the where clause introduces new tables, the initial attempt also retrieves all variables used in the params list

addHierarchicalElements()

If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.

addMultipleElements()

If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.

array
query(bool $count = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, bool $onlyDeleted = FALSE)

Generate the query based on what type of query we need.

mixed
getWhereValues(string $name, mixed $grouping)

Get where values from the parameters.

static 
fixDateValues(bool $relative, string $from, string $to)

Fix date values.

static array
convertFormValues(array $formValues, int $wildcard = 0, bool $useEquals = FALSE, string $apiEntity = NULL, array $entityReferenceFields = [])

Convert values from form-appropriate to query-object appropriate.

static 
legacyConvertFormValues(string $id, array|int $values)

Function to support legacy format for groups and tags.

static array|null
fixWhereValues(int $id, array $values, int $wildcard = 0, bool $useEquals = FALSE, string $apiEntity = NULL)

Fix values from query from/to something no-one cared enough to document.

whereClauseSingle(array $values, bool $isForcePrimaryOnly = FALSE)

Get the where clause for a single field.

string
whereClause(bool $isForcePrimaryEmailOnly = NULL)

Given a list of conditions in params generate the required where clause.

restWhere(array $values)

Generate where clause for any parameters not already handled.

static array
getLocationTableName($where, $locType)

No description

array
store(CRM_Core_DAO $dao)

Given a result dao, extract the values and return that array

array
tables()

Getter for tables array.

array
whereTables()

Sometimes used to create the from clause, but, not reliably, set this AND set tables.

static string
getWhereClause(array $params, array $fields, array $tables, $whereTables, bool $strict = FALSE)

Generate the where clause (used in match contacts and permissions)

static string
fromClause(array $tables, array $inner = NULL, array $right = NULL, bool $primaryLocation = TRUE, int $mode = 1, string|NULL $apiEntity = NULL)

Create the from clause.

static string
getEntitySpecificJoins(string $name, int $mode, string $side, string $primaryLocation)

Get join statements for the from clause depending on entity type

deletedContacts(array $values)

WHERE / QILL clause for deleted_contacts

contactType($values)

Where / qill clause for contact_type

contactSubType(array $values)

Where / qill clause for contact_sub_type.

includeContactSubTypes($value, $grouping, string $op = 'LIKE')

No description

group($values)

Where / qill clause for groups.

array
getGroupCacheTableKeys()

No description

array
getGroupsFromTypeCriteria($value)

Function translates selection of group type into a list of groups.

string
addGroupContactCache(array $groups, string $tableAlias, string $joinTable = "contact_a", string $op, string $joinColumn = 'id')

Prime smart group cache for smart groups in the search, and join civicrm_group_contact_cache table into the query.

ufUser($values)

Where / qill clause for cms users

tagSearch(array $values)

All tag search specific.

tag(array $values)

Where / qill clause for tag.

notes(array $values)

Where/qill clause for notes

bool
nameNullOrEmptyOp(string $name, $op, $grouping)

No description

sortName(array $values)

Where / qill clause for sort_name

greetings(array $values)

Where/qill clause for greeting fields.

email(array $values, string $isForcePrimaryOnly)

Where / qill clause for email

phone_numeric(array $values)

Where / qill clause for phone number

phone_option_group(array $values)

Where / qill clause for phone type/location

street_address(array $values)

Where / qill clause for street_address.

street_number(array $values)

Where / qill clause for street_unit.

sortByCharacter(array $values)

Where / qill clause for sorting by character.

includeContactIDs()

Where / qill clause for including contact ids.

postalCode(array $values)

Where / qill clause for postal code.

string
locationType(array $values, null $status = NULL)

Where / qill clause for location type.

array|NULL
country($values, bool $fromStateProvince = TRUE)

No description

string
county(array $values, null $status = NULL)

Where / qill clause for county (if present).

string
stateProvince(array $values, null $status = NULL)

Where / qill clause for state/province AND country (if present).

changeLog(array $values)

Where / qill clause for change log.

modifiedDates($values)

No description

demographics($values)

No description

privacy($values)

No description

privacyOptions($values)

No description

preferredCommunication($values)

No description

relationship(array $values)

Where / qill clause for relationship.

addRelationshipPermissionClauses(string $grouping, array $where)

Add relationship permission criteria to where clause.

addRelationshipDateClauses(string $grouping, array $where)

Add start & end date criteria in

addRelationshipActivePeriodClauses(string $grouping, array $where)

Add start & end active period criteria in

static string
getRelationshipActivePeriodClauses($from, $to, $forceTableName)

Get start & end active period criteria

static array
defaultReturnProperties(int $mode = 1)

Default set of return properties.

static string|NULL
getPrimaryCondition(int $value)

Get primary condition for a sql clause.

static string
getQuery(array $params = NULL, array $returnProperties = NULL, bool $count = FALSE)

Wrapper for a simple search query.

static array
apiQuery(array $params = NULL, array $returnProperties = NULL, null $fields = NULL, string $sort = NULL, int $offset = 0, int $row_count = 25, bool $smartGroupCache = TRUE, bool $count = FALSE, bool $skipPermissions = TRUE, int $mode = CRM_Contact_BAO_Query::MODE_CONTACTS, string $apiEntity = NULL, bool|null $primaryLocationOnly = NULL)

These are stub comments as this function needs more explanation - particularly in terms of how it relates to $this->searchQuery and why it replicates rather than calles $this->searchQuery.

static string
getCustomFieldName(string $parameterName)

Get the actual custom field name by stripping off the appended string.

static 
convertCustomRelativeFields(array $formValues, array $params, string $values, string $fieldName)

Convert submitted values for relative custom fields to query object format.

static bool
isCustomDateField($fieldName)

Are we dealing with custom field of type date.

static bool;
isAlreadyProcessedForQueryFormat(mixed $values)

Has this field already been reformatting to Query object syntax.

static 
filterCountryFromValuesIfStateExists(array $formValues)

If the state and country are passed remove state.

static string
appendAnyValueToSelect(array $selectClauses, array $groupBy, string $aggregateFunction = 'ANY_VALUE')

For some special cases, grouping by subset of select fields becomes mandatory.

static 
getGroupByFromOrderBy(string $groupBy, array $orderBys)

For some special cases, where if non-aggregate ORDER BY columns are not present in GROUP BY on full_group_by mode, then append the those missing columns to GROUP BY clause keyword to select fields not present in groupBy

static string
getGroupByFromSelectColumns(array $selectClauses, array $groupBy = NULL)

Include Select columns in groupBy clause.

searchQuery(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, bool $returnQuery = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL, bool $skipOrderAndLimit = FALSE)

Create and query the db for an contact search.

alphabetQuery()

Create and query the db for the list of all first letters used by contacts

getCachedContacts(array $cids, bool $includeContactIds)

Fetch a list of contacts for displaying a search results page

generatePermissionClause(bool $onlyDeleted = FALSE, bool $count = FALSE)

Populate $this->_permissionWhereClause with permission related clause and update other query related properties.

setSkipPermission($val)

No description

array
summaryContribution(null $context = NULL)

No description

appendFinancialTypeWhereAndFromToQueryStrings(string $where, string $from)

Append financial ACL limits to the query from & where clauses, if applicable.

array
qill()

Getter for the qill object.

static array
defaultHierReturnProperties()

Default set of return default hier return properties.

dateQueryBuilder(array $values, string $tableName, string $fieldName, string $dbFieldName, string $fieldTitle, bool $appendTimeStamp = TRUE, string $dateFormat = 'YmdHis', string|null $highDBFieldName = NULL)

Build query for a date field.

numberRangeBuilder($values, string $tableName, string $fieldName, string $dbFieldName, $fieldTitle, null $options = NULL)

No description

ageRangeQueryBuilder($values, string $tableName, string $fieldName, string $dbFieldName, $fieldTitle, null $options = NULL)

No description

static string
calcDateFromAge(string $asofDate, int $age, string $type)

Calculate date from age.

static string
buildClause(string $field, string $op, string $value = NULL, string $dataType = NULL)

Given the field name, operator, value & its data type builds the where Clause for the query used for handling 'IS NULL'/'IS NOT NULL' operators

array
openedSearchPanes(bool $reset = FALSE)

No description

setOperator($operator)

No description

string
getOperator()

No description

filterRelatedContacts($from, $where, $having)

No description

static bool
caseImportant($op)

See CRM-19811 for why this is database hurty without apparent benefit.

static bool
componentPresent($returnProperties, $prefix)

No description

optionValueQuery(string $name, string $op, string $value, int $grouping, string $daoName = NULL, array $field, string $label, string $dataType = 'String', bool $useIDsOnly = FALSE)

Builds the necessary structures for all fields that are similar to option value look-ups.

static bool|array
parseSearchBuilderString(string $string, string $dataType = 'Integer')

Check and explode a user defined numeric string into an array this was the protocol used by search builder in the old old days before we had super nice js widgets to do the hard work

array|NULL
convertToPseudoNames(CRM_Core_DAO $dao, bool $return = FALSE, bool $usedForAPI = FALSE)

Convert the pseudo constants id's to their names

array|NULL
includePseudoFieldsJoin(string|array $sort)

Include pseudo fields LEFT JOIN.

static array
buildQillForFieldValue(string $daoName, string $fieldName, mixed $fieldValue, string $op, array $pseudoExtraParam = [], int $type = CRM_Utils_Type::T_STRING)

Build qill for field.

static string
getQillValue(string $daoName, string $name, string $value, string|array $op, string $label)

Get the qill (search description for field) for the specified field.

static string
getWildCardedValue(bool $wildcard, string $op, string $value)

Alter value to reflect wildcard settings.

static 
processSpecialFormValue(array $formValues, array $specialFields, array $changeNames = [])

Process special fields of Search Form in OK (Operator in Key) format

string
prepareOrderBy(string|CRM_Utils_Sort $sort, null $sortOrder)

Parse and assimilate the various sort options.

string
convertGroupIDStringToLabelString(CRM_Core_DAO $dao, string $val)

Convert a string of group IDs to a string of group labels.

setQillAndWhere(string $name, string $op, string|array $value, string $grouping, array $field)

Set the qill and where properties for a field.

string
getSelect()

Get Select Clause.

array
addBasicStatsToSummary(array $summary, string $where, string $from)

Add basic statistics to the summary.

addBasicSoftCreditStatsToStats(array $summary, string $where, string $from)

Add basic soft credit statistics to summary array.

addBasicCancelStatsToSummary(array $summary, string $where, string $from)

Add basic stats about cancelled contributions to the summary.

string
getSearchSQL(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL, bool $skipOrderAndLimit = FALSE)

Create the sql query for an contact search.

array
getSearchSQLParts(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL)

Get the component parts of the search query as an array.

array
getMetadataForField(string $fieldName)

Get the metadata for a given field.

array
getMetadataForRealField(string $fieldName)

Get the metadata for a given field, returning the 'real field' if it is a pseudofield.

addPseudoconstantFieldToSelect(string $name)

If we have a field that is better rendered via the pseudoconstant handled them here.

bool
isPseudoFieldAnFK($fieldSpec)

Is this pseudofield a foreign key constraint.

bool
isARelativeDateField(string $fieldName)

Is the field a relative date field.

array
getFieldSpec(string $fieldName)

Get the specifications for the field, if available.

buildWhereForDate()

No description

bool
isADateRangeField(string $fieldName)

Is the field a relative date field.

buildRelativeDateQuery($values)

No description

bool
buildDateRangeQuery($values)

Build the query for a date field if it is a _high or _low field.

array
addAddressTable(string $tableKey, string $joinCondition)

Add the address table into the query.

string
getGroupStatusClause(int $grouping)

Get the clause for group status.

array
getSelectedGroupStatuses(string $grouping)

Get an array of the statuses that have been selected.

string
getQillForField($name, array|int|string $value, $op)

Get the qill value for the field.

Details

at line 469
__construct(array $params = NULL, array $returnProperties = NULL, array $fields = NULL, bool $includeContactIds = FALSE, bool $strict = FALSE, bool|int $mode = 1, bool $skipPermission = FALSE, bool $searchDescendentGroups = TRUE, bool $smartGroupCache = TRUE, null $displayRelationshipType = NULL, string $operator = 'AND', string $apiEntity = NULL, bool|null $primaryLocationOnly = NULL)

Class constructor which also does all the work.

Parameters

array $params
array $returnProperties
array $fields
bool $includeContactIds
bool $strict
bool|int $mode
  • mode the search is operating on
bool $skipPermission
bool $searchDescendentGroups
bool $smartGroupCache
null $displayRelationshipType
string $operator
string $apiEntity
bool|null $primaryLocationOnly

Exceptions

CRM_Core_Exception

at line 556
initialize(string $apiEntity = NULL)

Function which actually does all the work for the constructor.

Parameters

string $apiEntity The api entity being called. This sort-of duplicates $mode in a confusing way. Probably not by design.

Exceptions

CRM_Core_Exception

at line 632
buildParamsLookup()

Function for same purpose as convertFormValues.

Like convert form values this function exists to pre-Process parameters from the form.

It is unclear why they are different functions & likely relates to advances search versus search builder.

The direction we are going is having the form convert values to a standardised format & moving away from weird & wonderful where clause switches.

Fix and handle contact deletion nicely.

this code is primarily for search builder use case where different clauses can specify if they want deleted.

CRM-11971

at line 700
addSpecialFields($apiEntity)

Some composite fields do not appear in the fields array hack to make them part of the query.

Parameters

$apiEntity The api entity being called. This sort-of duplicates $mode in a confusing way. Probably not by design.

at line 732
selectClause(string $apiEntity = NULL)

Given a list of conditions in params and a list of desired return Properties generate the required select and from clauses. Note that since the where clause introduces new tables, the initial attempt also retrieves all variables used in the params list

Parameters

string $apiEntity The api entity being called. This sort-of duplicates $mode in a confusing way. Probably not by design.

at line 1051
addHierarchicalElements()

If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.

at line 1375
addMultipleElements()

If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.

at line 1410
array query(bool $count = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, bool $onlyDeleted = FALSE)

Generate the query based on what type of query we need.

Parameters

bool $count
bool $sortByChar
bool $groupContacts
bool $onlyDeleted

Return Value

array sql query parts as an array

at line 1540
mixed getWhereValues(string $name, mixed $grouping)

Get where values from the parameters.

Parameters

string $name
mixed $grouping

Return Value

mixed

at line 1558
static fixDateValues(bool $relative, string $from, string $to)

Fix date values.

Parameters

bool $relative
string $from
string $to

at line 1597
static array convertFormValues(array $formValues, int $wildcard = 0, bool $useEquals = FALSE, string $apiEntity = NULL, array $entityReferenceFields = [])

Convert values from form-appropriate to query-object appropriate.

The query object is increasingly supporting the sql-filter syntax which is the most flexible syntax. So, ideally we would convert all fields to look like array( 0 => $fieldName // Set the operator for legacy reasons, but it is ignored 1 => '=' // array in sql filter syntax 2 => array('BETWEEN' => array(1,60), 3 => null 4 => null );

There are some examples of the syntax in https://github.com/civicrm/civicrm-core/tree/master/api/v3/examples/Relationship

More notes at CRM_Core_DAO::createSQLFilter

and a list of supported operators in CRM_Core_DAO

Parameters

array $formValues
int $wildcard
bool $useEquals
string $apiEntity
array $entityReferenceFields Field names of any entity reference fields (which will need reformatting to IN syntax).

Return Value

array

at line 1685
static legacyConvertFormValues(string $id, array|int $values)

Function to support legacy format for groups and tags.

Parameters

string $id
array|int $values

at line 1713
static array|null fixWhereValues(int $id, array $values, int $wildcard = 0, bool $useEquals = FALSE, string $apiEntity = NULL)

Fix values from query from/to something no-one cared enough to document.

Parameters

int $id
array $values
int $wildcard
bool $useEquals
string $apiEntity

Return Value

array|null

at line 1790
whereClauseSingle(array $values, bool $isForcePrimaryOnly = FALSE)

Get the where clause for a single field.

Parameters

array $values
bool $isForcePrimaryOnly

Exceptions

CRM_Core_Exception

at line 2042
string whereClause(bool $isForcePrimaryEmailOnly = NULL)

Given a list of conditions in params generate the required where clause.

Parameters

bool $isForcePrimaryEmailOnly

Return Value

string

Exceptions

CRM_Core_Exception

at line 2122
restWhere(array $values)

Generate where clause for any parameters not already handled.

Parameters

array $values

Exceptions

Exception

at line 2399
static array getLocationTableName($where, $locType)

Parameters

$where
$locType

Return Value

array

Exceptions

Exception

at line 2472
array store(CRM_Core_DAO $dao)

Given a result dao, extract the values and return that array

Parameters

CRM_Core_DAO $dao

Return Value

array values for this query

at line 2517
array tables()

Getter for tables array.

Return Value

array

at line 2532
array whereTables()

Sometimes used to create the from clause, but, not reliably, set this AND set tables.

It's unclear the intent - there is a 'simpleFrom' clause which takes whereTables into account & a fromClause which doesn't.

logic may have eroded?

Return Value

array

at line 2548
static string getWhereClause(array $params, array $fields, array $tables, $whereTables, bool $strict = FALSE)

Generate the where clause (used in match contacts and permissions)

Parameters

array $params
array $fields
array $tables
$whereTables
bool $strict

Return Value

string

Exceptions

CRM_Core_Exception

at line 2586
static string fromClause(array $tables, array $inner = NULL, array $right = NULL, bool $primaryLocation = TRUE, int $mode = 1, string|NULL $apiEntity = NULL)

Create the from clause.

Parameters

array $tables Tables that need to be included in this from clause. If null, return mimimal from clause (i.e. civicrm_contact).
array $inner Tables that should be inner-joined.
array $right Tables that should be right-joined.
bool $primaryLocation Search on primary location. See note below.
int $mode Determines search mode based on bitwise MODE_* constants.
string|NULL $apiEntity Determines search mode based on entity by string.

The $primaryLocation flag only seems to be used when locationType() has been called. This may be a search option exposed, or perhaps it's a "search all details" approach which predates decoupling of location types and primary fields?

Return Value

string the from clause

See also

https://issues.civicrm.org/jira/browse/CRM-19967

at line 2690
static protected string getEntitySpecificJoins(string $name, int $mode, string $side, string $primaryLocation)

Get join statements for the from clause depending on entity type

Parameters

string $name
int $mode
string $side
string $primaryLocation

Return Value

string

at line 2857
deletedContacts(array $values)

WHERE / QILL clause for deleted_contacts

Parameters

array $values

at line 2872
contactType($values)

Where / qill clause for contact_type

Parameters

$values

Exceptions

CRM_Core_Exception

at line 2937
contactSubType(array $values)

Where / qill clause for contact_sub_type.

Parameters

array $values

at line 2949
includeContactSubTypes($value, $grouping, string $op = 'LIKE')

Parameters

$value
$grouping
string $op

Exceptions

CRM_Core_Exception

at line 2990
group($values)

Where / qill clause for groups.

Parameters

$values

Exceptions

CRM_Core_Exception
Exception

at line 3135
array getGroupCacheTableKeys()

Return Value

array

at line 3145
array getGroupsFromTypeCriteria($value)

Function translates selection of group type into a list of groups.

Parameters

$value

Return Value

array

at line 3167
string addGroupContactCache(array $groups, string $tableAlias, string $joinTable = "contact_a", string $op, string $joinColumn = 'id')

Prime smart group cache for smart groups in the search, and join civicrm_group_contact_cache table into the query.

Parameters

array $groups IDs of groups specified in search criteria.
string $tableAlias Alias to use for civicrm_group_contact_cache table.
string $joinTable Table on which to join civicrm_group_contact_cache
string $op SQL comparison operator (NULL, IN, !=, IS NULL, etc.)
string $joinColumn Column in $joinTable on which to join civicrm_group_contact_cache.contact_id

Return Value

string WHERE clause component for smart group criteria.

Exceptions

CRM_Core_Exception

at line 3221
ufUser($values)

Where / qill clause for cms users

Parameters

$values

at line 3244
tagSearch(array $values)

All tag search specific.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3309
tag(array $values)

Where / qill clause for tag.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3400
notes(array $values)

Where/qill clause for notes

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3446
bool nameNullOrEmptyOp(string $name, $op, $grouping)

Parameters

string $name
$op
$grouping

Return Value

bool

at line 3474
sortName(array $values)

Where / qill clause for sort_name

Parameters

array $values

at line 3547
greetings(array $values)

Where/qill clause for greeting fields.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3564
protected email(array $values, string $isForcePrimaryOnly)

Where / qill clause for email

Parameters

array $values
string $isForcePrimaryOnly

Exceptions

CRM_Core_Exception

at line 3611
phone_numeric(array $values)

Where / qill clause for phone number

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3633
phone_option_group(array $values)

Where / qill clause for phone type/location

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3650
street_address(array $values)

Where / qill clause for street_address.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3683
street_number(array $values)

Where / qill clause for street_unit.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3714
sortByCharacter(array $values)

Where / qill clause for sorting by character.

Parameters

array $values

at line 3726
includeContactIDs()

Where / qill clause for including contact ids.

at line 3750
postalCode(array $values)

Where / qill clause for postal code.

Parameters

array $values

Exceptions

CRM_Core_Exception

at line 3799
string locationType(array $values, null $status = NULL)

Where / qill clause for location type.

Parameters

array $values
null $status

Return Value

string

at line 3831
array|NULL country($values, bool $fromStateProvince = TRUE)

Parameters

$values
bool $fromStateProvince

Return Value

array|NULL

Exceptions

CRM_Core_Exception

at line 3879
string county(array $values, null $status = NULL)

Where / qill clause for county (if present).

Parameters

array $values
null $status

Return Value

string

at line 3949
string stateProvince(array $values, null $status = NULL)

Where / qill clause for state/province AND country (if present).

Parameters

array $values
null $status

Return Value

string

Exceptions

CRM_Core_Exception

at line 3980
changeLog(array $values)

Where / qill clause for change log.

Parameters

array $values

at line 4008
modifiedDates($values)

Parameters

$values

Exceptions

CRM_Core_Exception

at line 4033
demographics($values)

Parameters

$values

Exceptions

CRM_Core_Exception

at line 4060
privacy($values)

Parameters

$values

at line 4080
privacyOptions($values)

Parameters

$values

at line 4123
preferredCommunication($values)

Parameters

$values

Exceptions

CRM_Core_Exception

at line 4150
relationship(array $values)

Where / qill clause for relationship.

Parameters

array $values

at line 4354
addRelationshipPermissionClauses(string $grouping, array $where)

Add relationship permission criteria to where clause.

Parameters

string $grouping
array $where Array to add "where" criteria to, in case you are generating a temp table. Not the main query.

at line 4377
addRelationshipDateClauses(string $grouping, array $where)

Add start & end date criteria in

Parameters

string $grouping
array $where = array to add where clauses to, in case you are generating a temp table. not the main query.

at line 4401
addRelationshipActivePeriodClauses(string $grouping, array $where)

Add start & end active period criteria in

Parameters

string $grouping
array $where = array to add where clauses to, in case you are generating a temp table. not the main query.

at line 4436
static string getRelationshipActivePeriodClauses($from, $to, $forceTableName)

Get start & end active period criteria

Parameters

$from
$to
$forceTableName

Return Value

string

at line 4466
static array defaultReturnProperties(int $mode = 1)

Default set of return properties.

Parameters

int $mode

Return Value

array derault return properties

at line 4548
static string|NULL getPrimaryCondition(int $value)

Get primary condition for a sql clause.

Parameters

int $value

Return Value

string|NULL

at line 4566
static string getQuery(array $params = NULL, array $returnProperties = NULL, bool $count = FALSE)

Wrapper for a simple search query.

Parameters

array $params
array $returnProperties
bool $count

Return Value

string

Exceptions

CRM_Core_Exception

at line 4607
static array apiQuery(array $params = NULL, array $returnProperties = NULL, null $fields = NULL, string $sort = NULL, int $offset = 0, int $row_count = 25, bool $smartGroupCache = TRUE, bool $count = FALSE, bool $skipPermissions = TRUE, int $mode = CRM_Contact_BAO_Query::MODE_CONTACTS, string $apiEntity = NULL, bool|null $primaryLocationOnly = NULL)

These are stub comments as this function needs more explanation - particularly in terms of how it relates to $this->searchQuery and why it replicates rather than calles $this->searchQuery.

This function was originally written as a wrapper for the api query but is called from multiple places in the core code directly so the name is misleading. This function does not use the searchQuery function but it is unclear as to whehter that is historical or there is a reason CRM-11290 led to the permissioning action being extracted from searchQuery & shared with this function

Parameters

array $params
array $returnProperties
null $fields
string $sort
int $offset
int $row_count
bool $smartGroupCache ?? update smart group cache?.
bool $count Return count obnly.
bool $skipPermissions Should permissions be ignored or should the logged in user's permissions be applied.
int $mode This basically correlates to the component.
string $apiEntity The api entity being called. This sort-of duplicates $mode in a confusing way. Probably not by design.
bool|null $primaryLocationOnly

Return Value

array

Exceptions

CRM_Core_Exception

at line 4706
static string getCustomFieldName(string $parameterName)

Get the actual custom field name by stripping off the appended string.

The string could be _relative, _from, or _to

Parameters

string $parameterName The name of the parameter submitted to the form. e.g custom_3_relative custom_3_from

Return Value

string

at line 4732
static protected convertCustomRelativeFields(array $formValues, array $params, string $values, string $fieldName)

Convert submitted values for relative custom fields to query object format.

The query will support the sqlOperator format so convert to that format.

Parameters

array $formValues Submitted values.
array $params Converted parameters for the query object.
string $values Submitted value.
string $fieldName Submitted field name. (Matches form field not DB field.)

at line 4785
static bool isCustomDateField($fieldName)

Are we dealing with custom field of type date.

Parameters

$fieldName

Return Value

bool

Exceptions

CiviCRM_API3_Exception

at line 4814
static bool; isAlreadyProcessedForQueryFormat(mixed $values)

Has this field already been reformatting to Query object syntax.

The form layer passed formValues to this function in preProcess & postProcess. Reason unknown. This seems to come with associated double queries & is possibly damaging performance.

However, here we add a tested function to ensure convertFormValues identifies pre-processed fields & returns them as they are.

Parameters

mixed $values Value in formValues for the field.

Return Value

bool;

at line 4834
static filterCountryFromValuesIfStateExists(array $formValues)

If the state and country are passed remove state.

Country is implicit from the state, but including both results in a poor query as there is no combined index on state AND country.

CRM-18125

Parameters

array $formValues

at line 4858
static string appendAnyValueToSelect(array $selectClauses, array $groupBy, string $aggregateFunction = 'ANY_VALUE')

For some special cases, grouping by subset of select fields becomes mandatory.

Hence, full_group_by mode is handled by appending any_value keyword to select fields not present in groupBy

Parameters

array $selectClauses
array $groupBy
  • Columns already included in GROUP By clause.
string $aggregateFunction

Return Value

string

at line 4885
static getGroupByFromOrderBy(string $groupBy, array $orderBys)

For some special cases, where if non-aggregate ORDER BY columns are not present in GROUP BY on full_group_by mode, then append the those missing columns to GROUP BY clause keyword to select fields not present in groupBy

Parameters

string $groupBy
  • GROUP BY clause where missing ORDER BY columns will be appended if not present
array $orderBys
  • ORDER BY sub-clauses

at line 4906
static string getGroupByFromSelectColumns(array $selectClauses, array $groupBy = NULL)

Include Select columns in groupBy clause.

Parameters

array $selectClauses
array $groupBy
  • Columns already included in GROUP By clause.

Return Value

string

at line 4980
CRM_Core_DAO searchQuery(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, bool $returnQuery = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL, bool $skipOrderAndLimit = FALSE)

Create and query the db for an contact search.

Parameters

int $offset The offset for the query.
int $rowCount The number of rows to return.
string|CRM_Utils_Sort $sort The order by string.
bool $count Is this a count only query ?.
bool $includeContactIds Should we include contact ids?.
bool $sortByChar If true returns the distinct array of first characters for search results.
bool $groupContacts If true, return only the contact ids.
bool $returnQuery Should we return the query as a string.
string $additionalWhereClause If the caller wants to further restrict the search (used for components).
null $sortOrder
string $additionalFromClause Should be clause with proper joins, effective to reduce where clause load.
bool $skipOrderAndLimit

Return Value

CRM_Core_DAO

at line 5019
CRM_Core_DAO alphabetQuery()

Create and query the db for the list of all first letters used by contacts

Return Value

CRM_Core_DAO

at line 5039
CRM_Core_DAO getCachedContacts(array $cids, bool $includeContactIds)

Fetch a list of contacts for displaying a search results page

Parameters

array $cids List of contact IDs
bool $includeContactIds

Return Value

CRM_Core_DAO

at line 5090
generatePermissionClause(bool $onlyDeleted = FALSE, bool $count = FALSE)

Populate $this->_permissionWhereClause with permission related clause and update other query related properties.

Function calls ACL permission class and hooks to filter the query appropriately

Note that these 2 params were in the code when extracted from another function and a second round extraction would be to make them properties of the class

Parameters

bool $onlyDeleted Only get deleted contacts.
bool $count Return Count only.

at line 5132
setSkipPermission($val)

Parameters

$val

at line 5142
array summaryContribution(null $context = NULL)

Parameters

null $context

Return Value

array

Exceptions

CRM_Core_Exception

at line 5171
appendFinancialTypeWhereAndFromToQueryStrings(string $where, string $from)

Append financial ACL limits to the query from & where clauses, if applicable.

Parameters

string $where
string $from

at line 5192
array qill()

Getter for the qill object.

Return Value

array

at line 5201
static array defaultHierReturnProperties()

Default set of return default hier return properties.

Return Value

array

at line 5297
dateQueryBuilder(array $values, string $tableName, string $fieldName, string $dbFieldName, string $fieldTitle, bool $appendTimeStamp = TRUE, string $dateFormat = 'YmdHis', string|null $highDBFieldName = NULL)

Build query for a date field.

Parameters

array $values
string $tableName
string $fieldName
string $dbFieldName
string $fieldTitle
bool $appendTimeStamp
string $dateFormat
string|null $highDBFieldName Optional field name for when the 'high' part of the calculation uses a different field than the 'low' part. This is an obscure situation & one we don't want to do more of but supporting them here is the only way for now. Examples are event date & relationship active date -in both cases we are looking for things greater than the start date & less than the end date.

Exceptions

CRM_Core_Exception

at line 5438
numberRangeBuilder($values, string $tableName, string $fieldName, string $dbFieldName, $fieldTitle, null $options = NULL)

Parameters

$values
string $tableName
string $fieldName
string $dbFieldName
$fieldTitle
null $options

at line 5520
ageRangeQueryBuilder($values, string $tableName, string $fieldName, string $dbFieldName, $fieldTitle, null $options = NULL)

Parameters

$values
string $tableName
string $fieldName
string $dbFieldName
$fieldTitle
null $options

at line 5606
static string calcDateFromAge(string $asofDate, int $age, string $type)

Calculate date from age.

Parameters

string $asofDate
int $age
string $type

Return Value

string

Exceptions

Exception

at line 5638
static string buildClause(string $field, string $op, string $value = NULL, string $dataType = NULL)

Given the field name, operator, value & its data type builds the where Clause for the query used for handling 'IS NULL'/'IS NOT NULL' operators

Parameters

string $field Fieldname.
string $op Operator.
string $value Value.
string $dataType Data type of the field.

Return Value

string Where clause for the query.

Exceptions

CRM_Core_Exception

at line 5700
array openedSearchPanes(bool $reset = FALSE)

Parameters

bool $reset

Return Value

array

at line 5734
setOperator($operator)

Parameters

$operator

at line 5745
string getOperator()

Return Value

string

at line 5754
filterRelatedContacts($from, $where, $having)

Parameters

$from
$where
$having

at line 5862
static bool caseImportant($op)

See CRM-19811 for why this is database hurty without apparent benefit.

Parameters

$op

Return Value

bool

at line 5872
static bool componentPresent($returnProperties, $prefix)

Parameters

$returnProperties
$prefix

Return Value

bool

at line 5904
optionValueQuery(string $name, string $op, string $value, int $grouping, string $daoName = NULL, array $field, string $label, string $dataType = 'String', bool $useIDsOnly = FALSE)

Builds the necessary structures for all fields that are similar to option value look-ups.

Parameters

string $name the name of the field.
string $op the sql operator, this function should handle ALL SQL operators.
string $value depends on the operator and who's calling the query builder.
int $grouping the index where to place the where clause.
string $daoName DAO Name.
array $field an array that contains various properties of the field identified by $name.
string $label The label for this field element.
string $dataType The data type for this element.
bool $useIDsOnly

Exceptions

CRM_Core_Exception

at line 5976
static bool|array parseSearchBuilderString(string $string, string $dataType = 'Integer')

Check and explode a user defined numeric string into an array this was the protocol used by search builder in the old old days before we had super nice js widgets to do the hard work

Parameters

string $string
string $dataType The dataType we should check for the values, default integer.

Return Value

bool|array false if string does not match the pattern array of numeric values if string does match the pattern

at line 6015
array|NULL convertToPseudoNames(CRM_Core_DAO $dao, bool $return = FALSE, bool $usedForAPI = FALSE)

Convert the pseudo constants id's to their names

Parameters

CRM_Core_DAO $dao
bool $return
bool $usedForAPI

Return Value

array|NULL

at line 6135
array|NULL includePseudoFieldsJoin(string|array $sort)

Include pseudo fields LEFT JOIN.

Parameters

string|array $sort can be a object or string

Return Value

array|NULL

at line 6195
static array buildQillForFieldValue(string $daoName, string $fieldName, mixed $fieldValue, string $op, array $pseudoExtraParam = [], int $type = CRM_Utils_Type::T_STRING)

Build qill for field.

Qill refers to the query detail visible on the UI.

Parameters

string $daoName
string $fieldName
mixed $fieldValue
string $op
array $pseudoExtraParam
int $type Type of the field per CRM_Utils_Type

Return Value

array

at line 6291
static string getQillValue(string $daoName, string $name, string $value, string|array $op, string $label)

Get the qill (search description for field) for the specified field.

Parameters

string $daoName
string $name
string $value
string|array $op
string $label

Return Value

string

at line 6312
static string getWildCardedValue(bool $wildcard, string $op, string $value)

Alter value to reflect wildcard settings.

The form will have tried to guess whether this is a good field to wildcard but there is also a site-wide setting that specifies whether it is OK to append the wild card to the beginning or only the end of the string

Parameters

bool $wildcard This is a bool made on an assessment 'elsewhere' on whether this is a good field to wildcard.
string $op Generally '=' or 'LIKE'.
string $value The search string.

Return Value

string

at line 6335
static processSpecialFormValue(array $formValues, array $specialFields, array $changeNames = [])

Process special fields of Search Form in OK (Operator in Key) format

Parameters

array $formValues
array $specialFields Special params to be processed
array $changeNames Array of fields whose name should be changed

at line 6380
protected string prepareOrderBy(string|CRM_Utils_Sort $sort, null $sortOrder)

Parse and assimilate the various sort options.

Side-effect: if sorting on a common column from a related table (city, postal_code, email), the related table may be joined automatically.

At time of writing, this code is deeply flawed and should be rewritten. For the moment, it's been extracted to a standalone function.

Parameters

string|CRM_Utils_Sort $sort The order by string.
null $sortOrder Who knows? Hu knows. He who knows Hu knows who.

Return Value

string list(string $orderByClause, string $additionalFromClause).

Exceptions

CRM_Core_Exception

at line 6520
string convertGroupIDStringToLabelString(CRM_Core_DAO $dao, string $val)

Convert a string of group IDs to a string of group labels.

The original string may include duplicates and groups the user does not have permission to see.

Parameters

CRM_Core_DAO $dao
string $val

Return Value

string

at line 6542
setQillAndWhere(string $name, string $op, string|array $value, string $grouping, array $field)

Set the qill and where properties for a field.

This function is intended as a short-term function to encourage refactoring & re-use - but really we should just have less special-casing.

Parameters

string $name
string $op
string|array $value
string $grouping
array $field

Exceptions

CRM_Core_Exception

at line 6597
string getSelect()

Get Select Clause.

Return Value

string

at line 6616
protected array addBasicStatsToSummary(array $summary, string $where, string $from)

Add basic statistics to the summary.

Parameters

array $summary
string $where
string $from

Return Value

array

Exceptions

CRM_Core_Exception

at line 6661
protected addBasicSoftCreditStatsToStats(array $summary, string $where, string $from)

Add basic soft credit statistics to summary array.

Parameters

array $summary
string $where
string $from

Exceptions

CRM_Core_Exception

at line 6701
protected addBasicCancelStatsToSummary(array $summary, string $where, string $from)

Add basic stats about cancelled contributions to the summary.

Parameters

array $summary
string $where
string $from

Exceptions

CRM_Core_Exception

at line 6763
string getSearchSQL(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL, bool $skipOrderAndLimit = FALSE)

Create the sql query for an contact search.

Parameters

int $offset The offset for the query.
int $rowCount The number of rows to return.
string|CRM_Utils_Sort $sort The order by string.
bool $count Is this a count only query ?.
bool $includeContactIds Should we include contact ids?.
bool $sortByChar If true returns the distinct array of first characters for search results.
bool $groupContacts If true, return only the contact ids.
string $additionalWhereClause If the caller wants to further restrict the search (used for components).
null $sortOrder
string $additionalFromClause Should be clause with proper joins, effective to reduce where clause load.
bool $skipOrderAndLimit

Return Value

string

at line 6813
array getSearchSQLParts(int $offset = 0, int $rowCount = 0, string|CRM_Utils_Sort $sort = NULL, bool $count = FALSE, bool $includeContactIds = FALSE, bool $sortByChar = FALSE, bool $groupContacts = FALSE, string $additionalWhereClause = NULL, null $sortOrder = NULL, string $additionalFromClause = NULL)

Get the component parts of the search query as an array.

Parameters

int $offset The offset for the query.
int $rowCount The number of rows to return.
string|CRM_Utils_Sort $sort The order by string.
bool $count Is this a count only query ?.
bool $includeContactIds Should we include contact ids?.
bool $sortByChar If true returns the distinct array of first characters for search results.
bool $groupContacts If true, return only the contact ids.
string $additionalWhereClause If the caller wants to further restrict the search (used for components).
null $sortOrder
string $additionalFromClause Should be clause with proper joins, effective to reduce where clause load.

Return Value

array

Exceptions

CRM_Core_Exception

at line 6919
protected array getMetadataForField(string $fieldName)

Get the metadata for a given field.

Parameters

string $fieldName

Return Value

array

at line 6942
array getMetadataForRealField(string $fieldName)

Get the metadata for a given field, returning the 'real field' if it is a pseudofield.

Parameters

string $fieldName

Return Value

array

at line 6974
protected addPseudoconstantFieldToSelect(string $name)

If we have a field that is better rendered via the pseudoconstant handled them here.

Rather than joining in the additional table we render the option value on output.

Parameters

string $name

at line 7005
protected bool isPseudoFieldAnFK($fieldSpec)

Is this pseudofield a foreign key constraint.

We are trying to cautiously expand our pseudoconstant handling. This check allows us to extend to a narrowly defined type (and then only if the pseudofield is in the fields array which is done for contributions which are mostly handled as pseudoconstants.

Parameters

$fieldSpec

Return Value

bool

at line 7021
protected bool isARelativeDateField(string $fieldName)

Is the field a relative date field.

Parameters

string $fieldName

Return Value

bool

at line 7037
array getFieldSpec(string $fieldName)

Get the specifications for the field, if available.

Parameters

string $fieldName Fieldname as displayed on the form.

Return Value

array

at line 7056
buildWhereForDate()

at line 7067
protected bool isADateRangeField(string $fieldName)

Is the field a relative date field.

Parameters

string $fieldName

Return Value

bool

at line 7077
protected buildRelativeDateQuery($values)

Parameters

$values

at line 7140
bool buildDateRangeQuery($values)

Build the query for a date field if it is a _high or _low field.

Parameters

$values

Return Value

bool

Exceptions

CRM_Core_Exception

at line 7160
protected array addAddressTable(string $tableKey, string $joinCondition)

Add the address table into the query.

Parameters

string $tableKey
string $joinCondition

Return Value

array
  • alias name
    • address join.

at line 7181
protected string getGroupStatusClause(int $grouping)

Get the clause for group status.

Parameters

int $grouping

Return Value

string

at line 7195
protected array getSelectedGroupStatuses(string $grouping)

Get an array of the statuses that have been selected.

Parameters

string $grouping

Return Value

array

Exceptions

CRM_Core_Exception

at line 7222
protected string getQillForField($name, array|int|string $value, $op)

Get the qill value for the field.

Parameters

$name
array|int|string $value
$op

Return Value

string