-
-
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#4232 Afform: Allow manual processing of submission #27107
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
86601f0
to
8fe338c
Compare
289f196
to
7dd0f91
Compare
I'm watching this work with interest, @kurund. Let me know i there's any testing to be done. |
Ready for your review now. Only thing missing is token evaluation in the email. It's bit tricky as we don't have contact. |
@kurund the api_v4_AfformContactUsageTest failures are relevant. |
Thanks, I have fixed the failing test. |
ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php
Outdated
Show resolved
Hide resolved
ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php
Outdated
Show resolved
Hide resolved
7842b60
to
6e951e2
Compare
@kurund thanks for all your work on this! I tried it out and everything looks good except the email token doesn't get processed in the message. Is that still WIP? |
Thank you. Yes, email token is only outstanding and needs to be fixed. It would be good get your thoughts on email token processing. |
I'm making an attempt to implement the email token. I'll post my code. |
I've got the whole flow working on my fork; see this commit. Filling in the framework that @kurund created,
This is all good. However, I think that instead of just having a built-in status-message page as the endpoint of this workflow, we should redirect to the Post-Submit Page specified in the Afform's metadata. Perhaps admins should also be able to specify an Error Page — although we'd need to think through how to pass messages like "your token expired" |
That's great @highfalutin - based on your testing do you think this PR is mergeable & we can iterate on it in future PRs, or do you see any blockers to merging this? @kurund I'm still seeing a test failure which is failing because of the 2 new tokens you added. I'm still not sure it's correct to be adding them as contact tokens since I don't think they expose contact data but rather afform-specific data, right? |
Thanks looks good to me. I have pulled your changes in this branch. I think we can revisit messaging at a later stage.
Yes, they are afform submission specific tokens. I don't think the token are added as contact specific. |
I have made minor fix to generate the verify URL for the frontend. |
As discussed over MM I have moved the token registration to Symphony event. |
'module' => 'afSearchTasks', | ||
'title' => E::ts('Process Submissions'), | ||
'icon' => 'fa-check-square-o', | ||
'uiDialog' => ['templateUrl' => '~/afSearchTasks/afformSubmissionProcessTask.html'], |
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.
@kurund looking at the code in this afformSubmissionProcessTask.html
and the related angular controllers/modules, it looks to me like all it does is make one api call with no user-configurable params. In that case, I think this could all be simplified as an apiBatch
. You could delete the new angular module/js/html and just replace this line with:
'uiDialog' => ['templateUrl' => '~/afSearchTasks/afformSubmissionProcessTask.html'], | |
'apiBatch' => [ | |
'action' => 'process', | |
'params' => NULL, | |
'confirmMsg' => E::ts('Confirm processing %1 %2?'), | |
'runMsg' => E::ts('Processing %1 %2...'), | |
'successMsg' => E::ts('Successfully processed %1 %2.'), | |
'errorMsg' => E::ts('An error occurred while attempting to process %1 %2.'), | |
], |
Hmm, but now that I look at it, it seems the process
action has been added to the Afform entity. The above would assume that the action belongs to the AfformSubmission
entity. Could we move the action over there and convert it to a use AbstractBatchAction
? Then the above would know how to handle it, and an added benefit is that the api would be able to process more than one submission at a time.
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.
process
was added in Afform
entity as it reuses code in Civi\Api4\Action\Afform\AbsctractProcessor
which already handles the saving of submitted data.
Moving it to AfformSubmission
might be bit tricky.
Thoughts?
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.
Perhaps we could leave Afform::process
where it is, but also add an AfformSubmission::changeStatus
action which is the bulk action for processing 1 or more Afforms (and it delegates work to Afform::process
. This way the admin could view submissions, select a bunch of checkboxes and bulk process them (or bulk reject them, which might be useful for spam).
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.
Bulk action is already available and working as expected. So admin can process at entry level or via batch.
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 finally figured out how to do this using chaining:
#31906
re: test failures, I am not sure why submission tokens are evaluated while asserting other component tokens. I am having a weird issue running PHPUnit 9 on local. What's the recommended PHPUnit version? Do you see any test failures on your local? |
@kurund my test configuration in PHPStorm looks like this: |
I'll run some of the tests locally now and see if I can figure it out. |
…user processing the processed submission
32437ed
to
1c865e4
Compare
No worries, thanks for the review.
I have fixed this. There were few changes in the way SK tasks defined.
I have updated the test to unset these special submission tokens. Hopefully now the tests should pass . |
@colemanw @eileenmcnaughton @highfalutin Previously failing tests are passed and the current failure: https://test.civicrm.org/job/CiviCRM-Core-Matrix-PR/7256/BKPROF=dfl,SUITES=mixin,label=bknix-tmp/console is not related. So I guess ready for merge :) |
Go on then @kurund you deserve it! |
thanks @mattwire |
Congratulations on getting this over the finish line, @kurund! And thanks to those who helped. |
This implements following functionality to FB: