-
-
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
dev/core#348 Participant tokens on scheduled reminders #21666
Conversation
(Standard links)
|
08af4a9
to
b60f0e4
Compare
@eileenmcnaughton I will try to test. Since you mention the need for an upgrade script, what kind of functionality could I best test first? |
$e->query->select('ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone'); | ||
$e->query->join('participant_stuff', " | ||
!casMailingJoinType civicrm_event ev ON e.event_id = ev.id | ||
!casMailingJoinType civicrm_option_group og ON og.name = 'event_type' |
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.
Look - an unindexed join!
9b17e30
to
e65bf88
Compare
@magnolia61 I added the upgrade script just now & woohoo it's passing tests - the upgrade script just replaces a few tokens with name changes - |
e65bf88
to
e80f226
Compare
Thank you Eileen for this PR! First results: participant core and custom tokens work in scheduled reminders. Yeah! I have not been able to get participant custom dates working though. I will continue to test and update my findings here. |
@magnolia61 by custom dates you mean
OR
|
The later: register date works fine. It's the custom ones indeed. I just double checked and the date fields that fail have no time field. I added time to one of those (through the gui) and the token starts working. |
Also |
@magnolia61 is that a typo?
should be
I think - which would render the label not the integer |
@magnolia61 can you log a gitlab for the custom date fields & add the label 'sig:token' - I think it will be broader than participant tokens so it should be tracked & fixed but non-blocking on this PR |
I checked and the typo is only here in the issue. I used the proper token in the email. X {participant.status_id:label} but also X {participant.role_id:label} |
https://lab.civicrm.org/dev/core/-/issues/2878 (but I could not add the sig:token label) |
@magnolia61 I just test - like this It correctly put in the right label syntax And that WAS rendered as 'Registered' for me - it took a bit of doing because first I tried to use the 'also include' but of course they don't have participant records |
@agileware-justin Fyi - I am lucky to have @magnolia61 helping with testing here but this is the participant tokens |
I can check this |
ahhh, found it. For some reason a snug into the token in html |
@magnolia61 so this passes your testing now? |
@eileenmcnaughton yep! |
@seamuslee001 @colemanw see ^^ test cover is good |
To specify: I only tested participant core and custom tokens. |
@magnolia61 yes the event tokens are refactored too (contact tokens should be unchanged but more testing = more better) |
'updateActionScheduleToken', 'event.fee_amount', 'participant.fee_amount', $rev | ||
); | ||
$this->addTask('Replace event type token in action schedule', | ||
'updateActionScheduleToken', 'event.event_type_id', 'participant.event_type_id:label', $rev |
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.
I am not sure why event type should move from event to participant entity as is is a static value that belongs to the event (but maybe I just don;t get it)
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.
@magnolia61 I think you're right, #21738
Testing the event core tokens I found that the reminder choke on the {event.description} field When I run the scheduled reminder from civicrm/admin/job It's just the description field. And fails whether the field is empty or not. |
@magnolia61 I just tested My reminder looks like And I got this 'sent' |
I will try to test different combinations for the {event.description} |
I couldnt't get event custom tokens to work |
I re-downloaded civicrm master and applied this pr again and somehow the {event.description} token does work now. |
@magnolia61 thanks for that - maybe you can test again once the rc is cut so that you double check what the final release |
I just double checked the event custom ones and they also work now! |
Can confirm the Event and Participant tokens are working. However, I did note this weird issue:
Update 6/10 - Apparently this was indeed a bug, #21740 |
Why are there now tokens called "Machine Name: ...". What is the reasoning there for this label? Can this be changed because we're going to have a pretty hard time explaining to end users what this is supposed to mean. And have you noticed that there are now three tokens to refer to the Participant Role? Do we really need the Participant Role ID token? One thing I have noticed in this token listing is that end users do find it very confusing to scroll through a long list of tokens which are totally not relevant for the current context, eg. case in point, if you are creating an Event Reminder, why list tokens that are not related at all to that context. Don't show tokens for Activity, Membership, Contribution entities. Additionally, some filtering of what tokens are actually useful could be applied. |
@agileware-justin yeah - we are looking at being able to filter by audience in the tokenlist api once sorted - those things are useful when conditionals & such like are in play but not when it isn't - I have a hard stop on the token work for when the rc is cut on Wednesday so depending how well the other PRs I have progress through the system I hope we get to improving the token list functionality |
Thanks all for the thorough reviews. I think all the major issues have been addressed so let's merge this and continue to make improvements. |
Thank you all! 👍 |
thanks for your testing @magnolia61 - If you have the appetite for more I've started on adding participant tokens to pdf letters - #21695 - I haven't gotten test to pass there yet - maybe this time- but once they do that will be the last PR in the 'pdf strand' of this work - still more to do on the 'email strand' |
@magnolia61 if you find further things can you log a new issue in gitlab so we can track them |
thanks! |
Included in CiviCRM 5.43.0 PR: civicrm#21666
Included in CiviCRM 5.43.0 PR: civicrm#21666
Included in CiviCRM 5.43.0 PR: civicrm#21666
Included in CiviCRM 5.43.0 PR: civicrm#21666
Overview
This PR adds support for participant tokens in scheduled reminders
Before
Only event tokens were available. The query to add them was convoluted and had an unindexed join
After
Participant tokens are available...
Technical Details
I followed the domain model for events & cached the accessed events to an array. We know from the fact people never noticed the bad join that this isn't being used for high volume :-) But, it seems unlikely to me that, due to the time based nature of events, people would be sending to thousands of events in one hit and, even if they were, it's not a UI action & anyimpact of a huge array is likely to be in the realm of 'annoying in browser' rather than slows the job down (I doubt that it would slow it down anyway as browser lag is usually from initially building a large array not loading to it as required
Also note that event needs to listen to 'participant' AND 'event' - I put the handling for the former in the participant class.
Now that I've gotten to this point I realise how hard I was working around a function on the abstract subscriber class & I have some ideas for a cleanup to follow on
Comments
@magnolia61 some progress - I've gotten tests to pass locally but need to run through this again in the morning - will see if any thing else fails...
It should be testable - but back out quickly if you hit issues as it could be broken