Documentation

CRM_Member_ActionMapping extends MappingBase
in package

This defines the scheduled-reminder functionality for CiviMember memberships. It allows one to target reminders based on join date or end date, with additional filtering based on membership-type.

Table of Contents

Constants

MEMBERSHIP_TYPE_MAPPING_ID  = 4
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.

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
prepareMembershipPermissionsFilter()  : CRM_Utils_SQL_Select
Filter out the memberships that are inherited from a contact that the recipient cannot edit.

Constants

MEMBERSHIP_TYPE_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 MEMBERSHIP_TYPE_MAPPING_ID = 4

Methods

applies()

public final applies(string $entity, string $action) : bool
Parameters
$entity : string
$action : string
Return values
bool

checkAccess()

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
bool

createQuery()

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
see
RecipientBuilder
Return values
CRM_Utils_SQL_Select

getDateFields()

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
string

getEntityName()

Main entity name e.g. `Activity`

public getEntityName() : string
Return values
string

getId()

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|int

getLabel()

Label of this mapping type as shown in the "Entity" dropdown-select on the form.

public getLabel() : string
Return values
string

getLimitToOptions()

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
string

getRecipientListing()

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>

sendToAdditional()

Determine whether a schedule based on this mapping should send to additional contacts.

public sendToAdditional(mixed $entityId) : bool
Parameters
$entityId : mixed
Return values
bool

        
On this page

Search results