X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FActivity%2FTokens.php;h=bfcb4e76e5c03edf283fac22b71be66848517593;hb=9ae8e0ffd7804b1e7f52b6955dbc954e1b57ea42;hp=1eb294330273b477d39307f26dad90f4568145de;hpb=a732a37587f313e0d183914fca2bde8dbc9b385c;p=civicrm-core.git diff --git a/CRM/Activity/Tokens.php b/CRM/Activity/Tokens.php index 1eb2943302..bfcb4e76e5 100644 --- a/CRM/Activity/Tokens.php +++ b/CRM/Activity/Tokens.php @@ -84,6 +84,7 @@ class CRM_Activity_Tokens extends AbstractTokenSubscriber { // Multiple revisions of the activity. // Q: Could we simplify & move the extra AND clauses into `where(...)`? $e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0'); + $e->query->select('e.id AS tokenContext_' . $this->getEntityContextSchema()); } /** @@ -91,9 +92,7 @@ class CRM_Activity_Tokens extends AbstractTokenSubscriber { */ public function prefetch(TokenValueEvent $e) { // Find all the entity IDs - $entityIds - = $e->getTokenProcessor()->getContextValues('actionSearchResult', 'entityID') - + $e->getTokenProcessor()->getContextValues($this->getEntityContextSchema()); + $entityIds = $e->getTokenProcessor()->getContextValues($this->getEntityContextSchema()); if (!$entityIds) { return NULL; @@ -125,7 +124,18 @@ class CRM_Activity_Tokens extends AbstractTokenSubscriber { } /** - * @inheritDoc + * Evaluate the content of a single token. + * + * @param \Civi\Token\TokenRow $row + * The record for which we want token values. + * @param string $entity + * The name of the token entity. + * @param string $field + * The name of the token field. + * @param mixed $prefetch + * Any data that was returned by the prefetch(). + * + * @throws \CRM_Core_Exception */ public function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL) { // maps token name to api field @@ -133,8 +143,7 @@ class CRM_Activity_Tokens extends AbstractTokenSubscriber { 'activity_id' => 'id', ]; - // Get ActivityID either from actionSearchResult (for scheduled reminders) if exists - $activityId = $row->context['actionSearchResult']->entityID ?? $row->context[$this->getEntityContextSchema()]; + $activityId = $row->context[$this->getEntityContextSchema()]; $activity = $prefetch['activity'][$activityId];