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#715 - Fix delete action on RelationshipType form #13590

Merged
merged 1 commit into from
Feb 13, 2019
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
3 changes: 3 additions & 0 deletions CRM/Core/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,9 @@ protected function getApiAction() {
if ($action & (CRM_Core_Action::VIEW + CRM_Core_Action::BROWSE + CRM_Core_Action::BASIC + CRM_Core_Action::ADVANCED + CRM_Core_Action::PREVIEW)) {
return 'get';
}
if ($action & (CRM_Core_Action::DELETE)) {
return 'delete';
}
// If you get this exception try adding more cases above.
throw new Exception("Cannot determine api action for " . get_class($this) . '.' . 'CRM_Core_Action "' . CRM_Core_Action::description($action) . '" not recognized.');
}
Expand Down
4 changes: 4 additions & 0 deletions CRM/Core/Form/EntityFormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ protected function setEntityFieldsMetadata() {
// We can't load this field using metadata
continue;
}
if ($field != 'id' && $this->isDeleteContext()) {
// Delete forms don't generally present any fields to edit
continue;
}
// Resolve action.
if (empty($props['action'])) {
$props['action'] = $this->getApiAction();
Expand Down