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

dev/core#272 : Fatal Error (Regression) on PCP pages associated with Events #12532

Merged
merged 1 commit into from
Jul 23, 2018

Conversation

monishdeb
Copy link
Member

@monishdeb monishdeb commented Jul 22, 2018

Overview

There is regression found in Event's PCP as:
image
Regression is caused by https://github.com/civicrm/civicrm-core/pull/12056/files#diff-20d61aa96c8fdcd879d2b760f13ccc74R456

Before

Fatal error on Event's page

After

Fixed the error.

Technical Details

Here addField('pcp_personel_note', ...) expects $form->_action which is not allotted to CRM/Event/Form/Registration/Register.php. This patch assigned a default action to its parent class like we do for all other Civi forms. Alternatively we can provide the 'action' parameter i.e.

- $page->addField('pcp_personal_note', array('entity' => 'ContributionSoft', 'context' => 'create', 'style' => 'height: 3em; width: 40em;'));
+ $page->addField('pcp_personal_note', array('entity' => 'ContributionSoft', 'context' => 'create', 'action' => 'create', 'style' => 'height: 3em; width: 40em;'));

But ideally we should always ensure that a form has action to render form elements for intended purpose.

Comments

ping @eileenmcnaughton @KarinG

@civibot
Copy link

civibot bot commented Jul 22, 2018

(Standard links)

@@ -196,7 +196,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
*/
public function preProcess() {
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
Copy link
Contributor

Choose a reason for hiding this comment

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

i feel like this should probably be changed to alphanumeric.

Copy link
Member Author

@monishdeb monishdeb Jul 22, 2018

Choose a reason for hiding this comment

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

You mean:
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, CRM_Core_Action::ADD) ?

I did a grep on CRM codebase and all such occurrences I passing string value as default. Do

$ grep -irn --color "CRM_Utils_Request::retrieve('action'" CRM

Copy link
Contributor

Choose a reason for hiding this comment

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

i mean $this->_action = CRM_Utils_Request::retrieve('action', 'Alphanumeric', $this, FALSE, 'add')

Copy link
Member Author

@monishdeb monishdeb Jul 22, 2018

Choose a reason for hiding this comment

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

Oh ok. I think it would be best to have:

$this->_action = CRM_Utils_Request::retrieve('action', 'Alphanumeric', $this, FALSE, CRM_Core_Action::ADD);

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep happy with that 👍 just figure Alphanumeric is bit more strict than string

@KarinG
Copy link
Contributor

KarinG commented Jul 22, 2018

Link to my GitLab reporting the issue: https://lab.civicrm.org/dev/core/issues/272

@KarinG
Copy link
Contributor

KarinG commented Jul 22, 2018

Thanks @monishdeb and @seamuslee001 - I will try/test that in production today once it passes tests

@seamuslee001
Copy link
Contributor

@civicrm-builder re test this please

@eileenmcnaughton
Copy link
Contributor

5.4 version merged & there is a plan to do a 5.3.2 - merging

@eileenmcnaughton eileenmcnaughton merged commit 4c2ec1f into civicrm:5.3 Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants