CRM_Contact_ActionMapping
extends MappingBase
in package
This defines the scheduled-reminder functionality for contact entities. It is useful for, e.g., sending a reminder based on birth date, modification date, or other custom dates on the contact record.
Table of Contents
Constants
- CONTACT_MAPPING_ID = 6
- Note: This value is an integer for legacy reasons; but going forward any new action mapping classes should return a string from `getId` instead of using a constant.
Properties
- $contactDateFields : mixed
Methods
- applies() : bool
- checkAccess() : bool
- Check if the user has permission to create a reminder for given `entity_value`.
- createQuery() : CRM_Utils_SQL_Select
- Generate a query to locate recipients who match the given schedule.
- getAlternateRecipients() : array<string|int, mixed>|null
- getBccRecipients() : array<string|int, mixed>|null
- getDateFields() : array<string|int, mixed>
- Get option list for `start_action_date` & `end_date` fields.
- getEntity() : string
- Deprecated ambiguously-named function.
- getEntityName() : string
- Main entity name e.g. `Activity`
- getEntityTable() : string
- Name of the table belonging to the main entity e.g. `civicrm_activity`
- getId() : string|int
- Unique identifier of this mapping type.
- getLabel() : string
- Label of this mapping type as shown in the "Entity" dropdown-select on the form.
- getLimitToOptions() : array<string|int, mixed>
- Get the option list for `limit_to` (non-associative format)
- getName() : string
- Unique name of this mapping type.
- getRecipientListing() : array<string|int, mixed>
- Get option list for `recipient_listing` field.
- getRecipientTypes() : array<string|int, mixed>
- Get option list for `recipient` field.
- getStatusLabels() : array<string|int, mixed>
- Get option list for the `entity_status` field.
- getSubscribedEvents() : array<string|int, mixed>
- getValueLabels() : array<string|int, mixed>
- Get option list for the `entity_value` field.
- modifyApiSpec() : mixed
- modifySpec() : void
- onRegisterActionMappings() : void
- Register this action mapping type with CRM_Core_BAO_ActionSchedule.
- resetOnTriggerDateChange() : bool
- Determine whether a schedule based on this mapping should reset the reminder state if the trigger date changes.
- sendToAdditional() : bool
- Determine whether a schedule based on this mapping should send to additional contacts.
- getFixedRecipients() : array<string|int, mixed>|null
Constants
CONTACT_MAPPING_ID
Note: This value is an integer for legacy reasons; but going forward any new action mapping classes should return a string from `getId` instead of using a constant.
public
mixed
CONTACT_MAPPING_ID
= 6
Properties
$contactDateFields
private
mixed
$contactDateFields
= ['birth_date', 'created_date', 'modified_date']
Methods
applies()
public
final applies(string $entity, string $action) : bool
Parameters
- $entity : string
- $action : string
Return values
boolcheckAccess()
Check if the user has permission to create a reminder for given `entity_value`.
public
checkAccess(array<string|int, mixed> $entityValue) : bool
This function is called by the form to escalate permissions so that less-privileged users can create a reminder for a particular entity even if they do not have 'administer CiviCRM data'.
Return FALSE and the default permission of 'administer CiviCRM data' will be enforced.
Note that entity_value
is a serialized field, so will be passed as an array, even though
more than one value doesn't make sense in the context of embedding the ScheduledReminder form
on a page belonging to a single entity.
Parameters
- $entityValue : array<string|int, mixed>
Return values
boolcreateQuery()
Generate a query to locate recipients who match the given schedule.
public
createQuery(CRM_Core_DAO_ActionSchedule $schedule, string $phase, array<string|int, mixed> $defaultParams) : CRM_Utils_SQL_Select
Parameters
- $schedule : CRM_Core_DAO_ActionSchedule
-
The schedule as configured by the administrator.
- $phase : string
-
See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
- $defaultParams : array<string|int, mixed>
Tags
Return values
CRM_Utils_SQL_SelectgetAlternateRecipients()
public
getAlternateRecipients(CRM_Core_DAO_ActionSchedule $schedule) : array<string|int, mixed>|null
Parameters
- $schedule : CRM_Core_DAO_ActionSchedule
Return values
array<string|int, mixed>|nullgetBccRecipients()
public
getBccRecipients(CRM_Core_DAO_ActionSchedule $schedule) : array<string|int, mixed>|null
Parameters
- $schedule : CRM_Core_DAO_ActionSchedule
Return values
array<string|int, mixed>|nullgetDateFields()
Get option list for `start_action_date` & `end_date` fields.
public
getDateFields([array<string|int, mixed>|null $entityValue = NULL ]) : array<string|int, mixed>
Parameters
- $entityValue : array<string|int, mixed>|null = NULL
-
Selected value(s) of the
entity_value
field.
Return values
array<string|int, mixed>getEntity()
Deprecated ambiguously-named function.
public
getEntity() : string
Return values
stringgetEntityName()
Main entity name e.g. `Activity`
public
getEntityName() : string
Return values
stringgetEntityTable()
Name of the table belonging to the main entity e.g. `civicrm_activity`
public
getEntityTable(CRM_Core_DAO_ActionSchedule $actionSchedule) : string
Parameters
- $actionSchedule : CRM_Core_DAO_ActionSchedule
Return values
stringgetId()
Unique identifier of this mapping type.
public
getId() : string|int
Should return a "machine_name" style string (same output as getName()
)
Note: Some legacy implementations return an int. Don't follow those examples.
Return values
string|intgetLabel()
Label of this mapping type as shown in the "Entity" dropdown-select on the form.
public
getLabel() : string
Return values
stringgetLimitToOptions()
Get the option list for `limit_to` (non-associative format)
public
static getLimitToOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Unique name of this mapping type.
public
getName() : string
Should return a "machine_name" style string (should be the same as getId()
).
Return values
stringgetRecipientListing()
Get option list for `recipient_listing` field.
public
getRecipientListing(mixed $recipientType) : array<string|int, mixed>
Parameters
- $recipientType : mixed
-
Value of
recipient
field
Return values
array<string|int, mixed> —Ex: [1 => 'Attendee', 2 => 'Volunteer', ...].
getRecipientTypes()
Get option list for `recipient` field.
public
static getRecipientTypes() : array<string|int, mixed>
Note: A single schedule may filter on zero or one recipient types. When an admin chooses a value, it's stored in $schedule->recipient.
Return values
array<string|int, mixed> —Ex: ['assignee' => 'Activity Assignee', ...].
getStatusLabels()
Get option list for the `entity_status` field.
public
getStatusLabels(array<string|int, mixed>|null $entityValue) : array<string|int, mixed>
Parameters
- $entityValue : array<string|int, mixed>|null
-
Selected value(s) of the
entity_value
field.
Return values
array<string|int, mixed>getSubscribedEvents()
public
static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getValueLabels()
Get option list for the `entity_value` field.
public
getValueLabels() : array<string|int, mixed>
Return values
array<string|int, mixed>modifyApiSpec()
public
modifyApiSpec(RequestSpec $spec) : mixed
Parameters
- $spec : RequestSpec
modifySpec()
public
final modifySpec(RequestSpec $spec) : void
Parameters
- $spec : RequestSpec
onRegisterActionMappings()
Register this action mapping type with CRM_Core_BAO_ActionSchedule.
public
static onRegisterActionMappings(MappingRegisterEvent $registrations) : void
Parameters
- $registrations : MappingRegisterEvent
resetOnTriggerDateChange()
Determine whether a schedule based on this mapping should reset the reminder state if the trigger date changes.
public
resetOnTriggerDateChange(mixed $schedule) : bool
Parameters
- $schedule : mixed
Return values
boolsendToAdditional()
Determine whether a schedule based on this mapping should send to additional contacts.
public
sendToAdditional(mixed $entityId) : bool
Parameters
- $entityId : mixed
Return values
boolgetFixedRecipients()
protected
getFixedRecipients(CRM_Core_DAO_ActionSchedule $schedule) : array<string|int, mixed>|null
Parameters
- $schedule : CRM_Core_DAO_ActionSchedule