Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
da8e9790
Commit
da8e9790
authored
2 years ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
Remove token case_id handling
parent
c318f0dd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Activity/Tokens.php
+0
-27
0 additions, 27 deletions
CRM/Activity/Tokens.php
tests/phpunit/CRM/Activity/Form/Task/PDFLetterCommonTest.php
+1
-1
1 addition, 1 deletion
tests/phpunit/CRM/Activity/Form/Task/PDFLetterCommonTest.php
with
1 addition
and
28 deletions
CRM/Activity/Tokens.php
+
0
−
27
View file @
da8e9790
...
...
@@ -81,38 +81,11 @@ class CRM_Activity_Tokens extends CRM_Core_EntityTokens {
parent
::
evaluateToken
(
$row
,
$entity
,
$realField
,
$prefetch
);
$row
->
format
(
'text/plain'
)
->
tokens
(
$entity
,
$field
,
$row
->
tokens
[
'activity'
][
$realField
]);
}
elseif
(
$field
===
'case_id'
)
{
// An activity can be linked to multiple cases so case_id is always an array.
// We just return the first case ID for the token.
// this weird hack might exist because apiv3 is weird &
$caseID
=
CRM_Core_DAO
::
singleValueQuery
(
'SELECT case_id FROM civicrm_case_activity WHERE activity_id = %1 LIMIT 1'
,
[
1
=>
[
$activityId
,
'Integer'
]]);
$row
->
tokens
(
$entity
,
$field
,
$caseID
??
''
);
}
else
{
parent
::
evaluateToken
(
$row
,
$entity
,
$field
,
$prefetch
);
}
}
/**
* Get tokens that are special or calculated for this entity.
*
* @return array|array[]
*/
protected
function
getBespokeTokens
():
array
{
$tokens
=
[];
if
(
CRM_Core_Component
::
isEnabled
(
'CiviCase'
))
{
$tokens
[
'case_id'
]
=
[
'title'
=>
ts
(
'Activity Case ID'
),
'name'
=>
'case_id'
,
'type'
=>
'calculated'
,
'options'
=>
NULL
,
'data_type'
=>
'Integer'
,
'audience'
=>
'user'
,
];
}
return
$tokens
;
}
/**
* Get fields historically not advertised for tokens.
*
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Activity/Form/Task/PDFLetterCommonTest.php
+
1
−
1
View file @
da8e9790
...
...
@@ -78,7 +78,7 @@ class CRM_Activity_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
'{activity.activity_type_id:label}'
=>
'Activity Type'
,
'{activity.status_id:label}'
=>
'Activity Status'
,
'{activity.campaign_id:label}'
=>
'Campaign'
,
'{activity.case_id}'
=>
'
Activity
Case ID'
,
'{activity.case_id}'
=>
'Case ID'
,
];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment