-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align most of the tokens in the token processor handling with the legacy handling #19806
Conversation
(Standard links)
|
6103e5c
to
96b201d
Compare
|
||
// FIXME: for some pseudoconstants we get array ( 0 => id, 1 => label ) | ||
if (is_array($value)) { | ||
$value = $value[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line causes an enotice without this cleanup - it was added as part of a fix for https://issues.civicrm.org/jira/browse/CRM-13161 - however, all those greetings and gender fields are now tested & don't appear to have regressed (based on the tests I ran locally) with this change and I don't think the format described is used anymore.
The enotice directly mapped to the token processor having multi-value custom field data
788de7f
to
dab9349
Compare
@eileenmcnaughton Needs rebase |
44b431f
to
37ed8dc
Compare
thanks @mattwire - looks like it included something I was reviewed - removed |
3676b8b
to
9113f16
Compare
I now have a table of the specific impacts which we can link to in the preUpgrade hook - perhaps "CiviCRM has standardised some of the tokens for contact custom fields. If you use these in scheduled reminders or CiviMails or other custom flows then you might need to confirm you are still happy with the output. In general we are switching from outputting the values stored in the database to the display values"
|
For consideration: token values vs token labels. The values make it a lot easier in smarty message templates to use conditionals, as labels can be changed and reworded for custom fields over time. best of both worlds would be to offer both. Maybe with an extra parameter: token:value / token:label Probably not within the scope of this consolidation effort but I though i;d mention it here. |
Switches to defaulting to flexmailer, if enabled. This should be merged in conjunction with civicrm#19806 in order to keep those on the default in consistent state (ie they will already be getting display-rendering for custom fields and that will still be the case if 19806 is merged)
@eileenmcnaughton Brilliant research and brilliant test :) There's a small MC in a test-class, but I don't think it's substantive. I'll give this some |
9113f16
to
5425ccb
Compare
@totten thx - rebased |
|
@totten right those are the same conclusions I drew - other than me not knowing about the raw_token I have communicated this in more than one dev digest and even included the change table - so I think we should merge this and wordsmith up some sort of pre-upgrade hook message to pre-warn people before upgrading |
@eileenmcnaughton I guess there isn't a gitlab issue for this? So maybe the upgrader message should link to the PR for discussion? |
@totten that sounds good - would you be OK to write the message as a follow up PR (I have a feeling you would do so much copy editing you might be better to write it & I can review :-) |
I would link to the actual table here - #19806 (comment) |
That seems like some kind of tennis move. 😉 Yeah, merging, and I'm working on the upgrader. |
Just to cross-reference:
|
Overview
There are 2 ways in the code that tokens can be rendered -
We want to consistently use the token processor - but in order to do so we need to align it as a replacement.
Currently it is not rendering a few fields and presenting the db values, rather than the formatted values of the custom fields.
Before
The 'main' token routine was rendering tokens per the image on the right - the token processor was rendering them per the image on the left.
After
Both render them per the image on the right
The main differences are that the token processor was outputing the data directly from the database but now it is formatting. In addition it was unable to render multiple option values (that is not captured in the screen shot as I had to fix that to get the test to complete.
Technical Details
This revists 2 changes
$value
might hold an array like [0 => 'id', 1 => 'label'] no longer appear to be true -and I've added tests for all fields that are offered upComments
If we merge this it unblocks a lot of code rationalisation but it DOES change token behaviour and we need to warn people. I believe it affects scheduled reminders and CiviMail in some cases.
We probably should just do a pre-upgrade message and warn people.
This is groundwork for #19806