-
-
Notifications
You must be signed in to change notification settings - Fork 825
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#2644 Add Scheduled Communications extension #27081
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
@eileenmcnaughton this is ready for review |
retest this please |
Flushing system caches Warning: Undefined array key "Civi\Core\Container" in /home/homer/buildkit/ Warning: Trying to access array offset on value of type null in /home/homer Warning: Trying to access array offset on value of type null in /home/homer Fatal error: Uncaught Error: Call to a member function getPath() on null in |
retest this please |
cd36052
to
b970ebe
Compare
@eileenmcnaughton I moved the test to a different directory and now it's passing 🤷🏻 |
@@ -402,7 +402,7 @@ protected function prepareStartDateClauses() { | |||
$date = $operator . "(!casDateField, INTERVAL {$actionSchedule->start_action_offset} {$actionSchedule->start_action_unit})"; | |||
$startDateClauses[] = "'!casNow' >= {$date}"; | |||
// This is weird. Waddupwidat? | |||
if ($this->mapping->getEntityTable() == 'civicrm_participant') { | |||
if ($this->getMappingTable() == 'civicrm_participant') { |
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.
Non-blocking but === would be better
@colemanw I gave this a spin & was able to configure & test a Search-kit based scheduled reminders which went OK, and did resolve tokens. Given the scope of this PR is mostly internal to this work & there is a lot of code I'm OK with it being merged as is & building on it - however, I think we need to ensure there are some safeguards in place in the SAME release this goes out in. The minimum version I can think of is
|
b970ebe
to
1164650
Compare
Just checking that the new perm is validated for api calls as well as browser based actions. |
@colemanw as my non-trusted user (has lots of administer but not the magic tier 1 or the new perm) I still see the search (which is fine) - however, I do not expect this user to be able to delete the communication - which they can |
Also, in my testing the orphan scheduled reminder did not go out, but it did block the non-saved search one too & this could be bad. I think this is a high risk area & it would be good to cover the specific scenario of an orphan sk communiction/reminder in a unit test |
I think it might be worth adding a check on the |
Hmm this is tricksy - I'm getting an invalid field 'is_deceased'
My action schedule row sk cash {contribution.financial_type_id:label} ",,yay,1,saved_search,,,,,,,Email,,,,,2023-08-30 05:08:48,2023-08-30 05:08:48,, My search
|
@colemanw perhaps we should also require I think without that the Greens / multisites could get in trouble on this. I'd rather be too strict at first & loosen later. There is also a 'view all custom data' I think that the greens do not give all admin users from memory (@seamuslee001 ?) |
@eileenmcnaughton I think that might be right but I would have thought that the is_deleted error should have been swallowed somewhere along the way |
@seamuslee001 yeah the is_deleted is kinda separate - in that I looked in the code for that reason & then saw the checkPermission FALSE & wondered about the implications of one person configuring & assuming that what they see (their ACL permissions) would be in play but instead someone elses is |
@eileenmcnaughton @JoeMurray I think before going further we should consider the pros and cons of restricting this new permission to only SearchKit communications. The unpermissioned query issue you've identified is endemic to the existing scheduled communications system which this new feature inherits. So for example if you create a (non-SearchKit) scheduled communication for |
@seamuslee001 @johntwyman @andrew-cormick-dockery can you weigh in at all? The issue is
I had suggested that users need 'view all contacts' to configure scheduled reminders because any ACLS that they have are overridden when calculating them (new style or old). If we did that I think we would to both legacy and new style I think @colemanw is suggesting that rather than require that we accept that anyone with 'Schedule Communications' permission can configure them to go to people they don't otherwise have access to - and require this permission for all scheduled reminders. This would probably look like a pre upgrade message saying that people will need to review their permissions and add this new permission to anyone who they want to be able to schedule reminders with some warnings about how it interacts with ACLS. This would probably be pretty clear on the upgrade screen but not that visible to people who might be assigning permisssions in 6 months time In general people having administer civicrm and not view all contacts is a less common config - but one which is used in multisite & it seems like ideally we would tighten the permissions in this scenario with 1 or both of the above. Note the current 'permission rollout' also has the effect of 'hiding' the new feature in the initial release - which I kinda liked as it would mean those who want to play can but most site admins would not be aware of it. |
For us, scheduled reminders are used for two functions: membership and event reminders. We use multisite to constrain people's viewing contacts to Australia's states. But since membership is also state-based, and of course events are generally even more local than that, if scheduled reminders are completely unconstrained in that manner, that doesn't really bother us. I guess the fact that I'm aware of this now might help us avoid problems in the future. If scheduled reminders are going to be expanded to use Search Kit, from our perspective even if it's not ACL constrained it's not going to bother us too much. This is because we've restricted the use of Search Kit to administrators due to the serious performance issues which could come about through a less restrictive regime. But it sounds like you're intending to restrict that function to "view all contacts" in any case, which would be ideal. Only administrators have that function on our system. (For what it's worth, if there's any part of scheduled reminders I'd like to see worked on, it's cleaning up the Manage Schedule Reminder screen! Oh, and if you're working on multiple reminders at a time in multiple tabs, the last one to save doesn't overwrite all the ones you have open!) |
For what it's worth, those issues have all recently been fixed! |
As far as I understand, one of the purposes of this issue is to be able to send the results of a SearchKit by email using Scheduled Reminders like CiviReport does. Since you are discussing ACL, I add another vision that I think would be interesting to contemplate and with which it would not be necessary to think about ACL. Instead of sending the results by email, you can send a customizable message by email with a link to the corresponding SearchKit or Afform of the style: "There are 21 contributions pending to be thanked, please review the report in the following link." What do you think? Could this functionality be considered in this issue? Or should it be addressed in another one? |
@francescbassas sorry no this PR does not do that. This PR allows you to use SearchKit to pick the recipients of the scheduled communication. It does not send search kit reports by email. |
This functionality is needed for SavedSearch-based reminders, which do not have a fixed base-table.
Permits scheduled reminders to be created based on a SavedSearch
Supports sqlEquations and function suffixes within the aggregated array
Unlike DISTINCT which dedupes by the value of a field, UNIQUE will dedupe by the id of the record
1164650
to
ff4b31d
Compare
OK - moving the new feature stuff to an extension means we can merge it knowing only people who choose to play with it will have the feature - allowing us a bit more time to resolve the permissions question. All the core stuff has good test cover |
ff4b31d
to
2245b1b
Compare
e9d2d24
to
7432040
Compare
@eileenmcnaughton I pushed up a bit of error checking to ensure it would delete the reminder when deleting the saved-search, and to make sure it doesn't crash if you disable the extension. |
d23999c
to
7c64e44
Compare
7c64e44
to
5617488
Compare
Overview
Allows Scheduled Reminders to be created from SearchKit with an optional extension.
Before
Only a handful of Scheduled Reminder entities available (Contact, Participant, Member, Activity), with narrowly-restricted criteria.
After
When enabled, the "Scheduled Communications" extension allows any SearchKit search with a date column and a contact id column can be used for scheduled reminders.
Comments
See https://lab.civicrm.org/dev/core/-/issues/2644