Skip to content
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

CiviEvent - Error registering participants via search task #19125

Merged
merged 4 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CRM/Event/Form/Task/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ protected function assignUrlPath() {

//set ajax path, this used for custom data building
$this->assign('urlPath', 'civicrm/contact/view/participant');
$this->assign('urlPathVar', "_qf_Participant_display=true&qfKey={$this->controller->_key}");

$key = CRM_Core_Key::get('CRM_Event_Form_Participant', TRUE);
$this->assign('participantQfKey', $key);
$this->assign('participantAction', CRM_Core_Action::ADD);
$this->assign('urlPathVar', "_qf_Participant_display=true");
}

}
2 changes: 1 addition & 1 deletion CRM/Event/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function edit() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Event_Form_Participant',
'Create Participation',
$this->_action, FALSE, FALSE, TRUE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of this TRUE has caused the 500 console error that I added it to avoid to come back. The other symptom is the fees not loading.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. I was seeing the opposite - even with ignoreKey=TRUE here (PR-branch without df80fba), the AJAX call replied 500 and the fees subform didn't render. With df80fba (with a valid key -- and with ignoreKey=FALSE), the AJAX call and the subform worked.

I wonder if there might be some subtle difference in the pageflows or use-cases that we're trying?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@totten maybe - I have a good idea of a better fix - but we need to get 'something' out - to be honest I can't understand how the key would be rejected if ignoreKey is false

I am doing a basic search & then selecting some contacts & choosing register participants

I did test that on the pr test site & it failed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, my procedure is very similar, ie

  • Open advanced search
  • Search for all contacts (no criteria)
  • Check the first "Individual" in the demo data ("Adams, Heidi")
  • In the task list, choose to register
  • For the event, choose any of the three demo events (eg "Rain-forest Cup")

@eileenmcnaughton I can reproduce the error that appears on the test site. (Incidentally, I'm doing this on a different workstaiton/build.) Notably, in both test site and local, the 500 error is not related to qfKey. It's about "getFieldValue failed" (which curiously arose before but had seemed transitory). Here's a backtrace.

Screen Shot 2020-12-07 at 9 22 41 PM

The thing is... to my reading, it's basically saying that the event-registration form's preProcess() is applying a mismatched security check. (It's trying to use a contactId and CRM_Contact_Page_View::checkUserPermission() -- but in the context of a search-task, it doesn't make sense to use a singular contactId for assessing permissions on a bulk action.)

I've pushed up another patch which fixes this symptom for me, but it definitely needs some more eyes to see if it's faithful to contract/permissioning of this route/controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@totten given that

  1. the person who has reported this has applied the patch in the 5.32 branch & says it is working and
  2. we are pretty clear none of this is the final fix

I'm inclined to merge what that person merged & work on the right fix in master

Copy link
Member

@totten totten Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The report on 5.32 PR actually pointed to the same problem raised here (just a diff part of the manifestation -- the HTTP 500 error you noted above is the same "getFieldValue required" error he observed) - I think they just didn't realize that the screen was misbehaving (because it's a misbehavior of omission; because the immediate error-message is hidden in AJAX console; and the UI-level error message is delayed). So the revision they tested wasn't working.

Added some more comments over there to try to distinguish 3 issues floating around here.

To my testing, the current revision of this branch addresses all 3.

$this->_action
);

$controller->setEmbedded(TRUE);
Expand Down
4 changes: 3 additions & 1 deletion templates/CRM/Event/Form/Task/Register.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{include file="CRM/Event/Form/Participant.tpl"}
{crmScope qfKey=$participantQfKey action=$participantAction}
{include file="CRM/Event/Form/Participant.tpl"}
{/crmScope}