Deprecate `replaceCaseTokens` in core
Currently all case token handling in core is done using replaceCaseTokens
which is accessed via 2 workflows
- send email
- send pdf
It is also used from outside of core & my intention is to leave that working
I have added tests for the current 'advertised' functionality already and adding a 'basic' Case Token Processor would provide parity for all advertised tokens except that case.status_id
and case.case_type_id
should be mapped to case.case_type_id:label
and case.status_id:label
In addition replaceCaseTokens
supports some 'unadvertised tokens` which might, or might not be used
The process I propose is as follows
-
add support to
replaceCaseTokens
forcase.case_type_id:label
andcase.case_type_id
-
update the advertised tokens
selectValues:caseTokens
to advertise the 2 new-style tokens and not advertise the 'ambiguouse' ones - update the validate function on pdf & email traits to fail validation if one of the deprecated tokens is used
- add Case_Tokens as a basic processor class extending entity tokens - this will add all standard fields from civicrm_case table (with tests) - but any decisions about non-standard fields will be out of scope for this ticket - https://github.com/civicrm/civicrm-core/pull/21383
- Update pdf & email functions to render using the processor (already done for contact tokens so case will be an easy add) https://github.com/civicrm/civicrm-core/pull/21445 and https://github.com/civicrm/civicrm-core/pull/21447
- [-]
add logic so that if there are stillUPDATE - I did some more digging and the only 2 other fields that would have been replaced are{case.x}
tokens in the text for the email & pdf traits, after they have called the general render thereplaceCaseTokens
function is still called - at this point I will add some log out put to indicated that but nothing in the UI - later the UI could be updated.{case.clientId}
and{case.contact_id}
but they would have been replace by an array so would no thave been usable - add deprecated to the replaceCaseTokens comment block but do not add additional 'noise' for now (added in https://github.com/civicrm/civicrm-core/pull/21447)