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

CRM-21672 fix intra-rc regression, fatal when deleting participants #11538

Merged
merged 1 commit into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 20 additions & 0 deletions CRM/Core/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2388,4 +2388,24 @@ public function getCurrency($submittedValues = array()) {
return $currency;
}

/**
* Is the form in view or edit mode.
*
* The 'addField' function relies on the form action being one of a set list
* of actions. Checking for these allows for an early return.
*
* @return bool
*/
protected function isFormInViewOrEditMode() {
return in_array($this->_action, [
CRM_Core_Action::UPDATE,
CRM_Core_Action::ADD,
CRM_Core_Action::VIEW,
CRM_Core_Action::BROWSE,
CRM_Core_Action::BASIC,
CRM_Core_Action::ADVANCED,
CRM_Core_Action::PREVIEW,
]);
}

}
3 changes: 3 additions & 0 deletions CRM/Core/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ public function getDefaultContext() {
* Add generic fields that specify the contact.
*/
protected function addContactSearchFields() {
if (!$this->isFormInViewOrEditMode()) {
return;
}
$this->addSortNameField();

$this->_group = CRM_Core_PseudoConstant::nestedGroup();
Expand Down