Skip to content

Commit

Permalink
CRM-21672 fix intra-rc regression, fatal when deleting participants
Browse files Browse the repository at this point in the history
Change-Id: Iccbd17d53f07a93c74ce46e9539d1768019a2532
  • Loading branch information
eileenmcnaughton committed Jan 17, 2018
1 parent 543414a commit 53b2809
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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
*/
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

0 comments on commit 53b2809

Please sign in to comment.