dev/core#715 - Fix delete action on RelationshipType form
authorColeman Watts <coleman@civicrm.org>
Tue, 12 Feb 2019 17:08:48 +0000 (12:08 -0500)
committerColeman Watts <coleman@civicrm.org>
Wed, 13 Feb 2019 00:07:31 +0000 (19:07 -0500)
CRM/Core/Form.php
CRM/Core/Form/EntityFormTrait.php

index e8633e69d3157715301c07bffc0862c36b63dfa9..7f225f4c6f6be29869bafceff5c45cf6dcfe8f00 100644 (file)
@@ -1329,6 +1329,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     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.');
   }
index 102393d4b569762bb2de0642910f4248b382159b..6693f88dfafe341bf3554f854c0edf7c5d6240d8 100644 (file)
@@ -250,6 +250,10 @@ trait CRM_Core_Form_EntityFormTrait {
         // 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();