Add RelationshipType searchkit mgd files and update paths
authorDamilare Adedoyin <dadedoyin@wikimedia.org>
Wed, 12 Oct 2022 13:43:35 +0000 (14:43 +0100)
committercividev <damilare182@gmail.com>
Fri, 14 Oct 2022 09:50:47 +0000 (02:50 -0700)
CRM/Admin/Form/RelationshipType.php
CRM/Admin/Page/RelationshipType.php
CRM/Contact/DAO/RelationshipType.php
CRM/Core/xml/Menu/Admin.xml
contributor-key.yml
ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.html [new file with mode: 0644]
ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.json [new file with mode: 0644]
ext/civicrm_admin_ui/managed/SavedSearch_Administer_Relationship_Types.mgd.php [new file with mode: 0644]
xml/schema/Contact/RelationshipType.xml

index ea8bf121351d6cb7ccbb4f1d545dd13bfa591081..43914d6a72fbb2a0ffc1abb5e3a909d025582a9a 100644 (file)
@@ -41,6 +41,13 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
    */
   protected $entityFields = [];
 
+  public function preProcess(): void {
+    CRM_Utils_Request::retrieve('action', 'String', $this);
+    CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
+    $this->set('BAOName', 'CRM_Contact_BAO_RelationshipType');
+    parent::preProcess();
+  }
+
   /**
    * Set entity fields to be assigned to the form.
    */
index 3e4cdfb6ed78d6677aadb2f680f28d9c330239f9..312d2942e20593f46e9c3465f2d2f67407ea3855 100644 (file)
@@ -50,13 +50,13 @@ class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic {
       self::$_links = [
         CRM_Core_Action::VIEW => [
           'name' => ts('View'),
-          'url' => 'civicrm/admin/reltype',
+          'url' => 'civicrm/admin/reltype/edit',
           'qs' => 'action=view&id=%%id%%&reset=1',
           'title' => ts('View Relationship Type'),
         ],
         CRM_Core_Action::UPDATE => [
           'name' => ts('Edit'),
-          'url' => 'civicrm/admin/reltype',
+          'url' => 'civicrm/admin/reltype/edit',
           'qs' => 'action=update&id=%%id%%&reset=1',
           'title' => ts('Edit Relationship Type'),
         ],
@@ -72,7 +72,7 @@ class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic {
         ],
         CRM_Core_Action::DELETE => [
           'name' => ts('Delete'),
-          'url' => 'civicrm/admin/reltype',
+          'url' => 'civicrm/admin/reltype/edit',
           'qs' => 'action=delete&id=%%id%%',
           'title' => ts('Delete Reletionship Type'),
         ],
index c5ce8a75cf24876aa56ebbd89aa5d818f4b63098..49d0553728586153f89ea0056945a28b39f91109 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/RelationshipType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:88fd0251d3164ad9917e6ca7eef858fe)
+ * (GenCodeChecksum:48b28ea10ac682ddbd880197d7555e9f)
  */
 
 /**
@@ -30,6 +30,18 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
    */
   public static $_log = TRUE;
 
+  /**
+   * Paths for accessing this entity in the UI.
+   *
+   * @var string[]
+   */
+  protected static $_paths = [
+    'add' => 'civicrm/admin/reltype/edit?action=add&reset=1',
+    'view' => 'civicrm/admin/reltype/edit?action=view&id=[id]&reset=1',
+    'update' => 'civicrm/admin/reltype/edit?action=update&id=[id]&reset=1',
+    'delete' => 'civicrm/admin/reltype/edit?action=delete&id=[id]&reset=1',
+  ];
+
   /**
    * Primary key
    *
index 030b2b03d9743bd3fcd0124e9976fa08ce666b19..c532ede1cc70a470fffdb2c5ed70c672ed3f70d6 100644 (file)
      <adminGroup>Customize Data and Screens</adminGroup>
      <weight>35</weight>
   </item>
+  <item>
+     <path>civicrm/admin/reltype/edit</path>
+     <title>Edit Relationship Type</title>
+     <page_callback>CRM_Admin_Form_RelationshipType</page_callback>
+  </item>
   <item>
      <path>civicrm/admin/options/subtype</path>
      <title>Contact Types</title>
   <item>
      <path>civicrm/admin/options/grant_type</path>
      <title>Grant Types</title>
-     <desc>List of types which can be assigned to Grants. (Enable CiviGrant from Administer > Systme Settings > Enable Components if you want to track grants.)</desc>
+     <desc>List of types which can be assigned to Grants. (Enable CiviGrant from Administer > System Settings > Enable Components if you want to track grants.)</desc>
      <page_callback>CRM_Admin_Page_Options</page_callback>
      <adminGroup>Option Lists</adminGroup>
      <weight>385</weight>
index 33e503a7b94b9b196a3e0edce9c1f21541638102..e3bc50963bf039e12f1113e17c5423d6b2b4db4f 100644 (file)
 - github      : wikimediaWfan 
   name        : Wenjun Fan
   organization: Wikimedia Foundation
+
+- github      : damilare1 
+  name        : Damilare Adedoyin
+  organization: Wikimedia Foundation
diff --git a/ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.html b/ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.html
new file mode 100644 (file)
index 0000000..ba8433a
--- /dev/null
@@ -0,0 +1,13 @@
+<div class="af-container">
+  <div class="af-markup">
+    <div class="help">
+      <p>{{:: ts('Relationship types describe relationships between people, households and organizations. Relationship types labels describe the relationship from the perspective of each of the two entities (e.g. Parent &gt;-&lt; Child, Employer &gt;-&lt; Employee). For some types of relationships, the labels may be the same in both directions (e.g. Spouse &gt;-&lt; Spouse).') }} <a class="crm-doc-link no-popup"
+          href="https://docs.civicrm.org/user/en/latest/organising-your-data/relationships" target="_blank">{{:: ts('(Learn more...)') }}</a></p>
+      <p>{{:: ts('You can define as many additional relationships types as needed to cover the types of relationships you want to track. Once a relationship type is created, you may also define custom fields to extend relationship information for that type from ') }} <a href="civicrm/admin/custom/group?reset=1">{{:: ts('Administer CiviCRM &raquo; Custom Data') }}</a></p>
+    </div>
+  </div>
+</div>
+<div af-fieldset="">
+  <crm-search-display-table search-name="Administer_Relationship_Types"
+    display-name="Administer_Relationship_Types_Table_1"></crm-search-display-table>
+</div>
\ No newline at end of file
diff --git a/ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.json b/ext/civicrm_admin_ui/ang/afsearchRelationshipTypes.aff.json
new file mode 100644 (file)
index 0000000..58bc820
--- /dev/null
@@ -0,0 +1,18 @@
+{
+    "type": "search",
+    "requires": [],
+    "entity_type": null,
+    "join_entity": null,
+    "title": "Relationship Types",
+    "description": "",
+    "is_dashlet": false,
+    "is_public": false,
+    "is_token": false,
+    "contact_summary": null,
+    "icon": "fa-list-alt",
+    "server_route": "civicrm/admin/reltype",
+    "permission": "access CiviCRM",
+    "redirect": null,
+    "create_submission": false,
+    "navigation": null
+}
diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Relationship_Types.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Relationship_Types.mgd.php
new file mode 100644 (file)
index 0000000..66d6316
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+use CRM_CivicrmAdminUi_ExtensionUtil as E;
+
+return [
+  [
+    'name' => 'SavedSearch_Administer_Relationship_Types',
+    'entity' => 'SavedSearch',
+    'cleanup' => 'unused',
+    'update' => 'unmodified',
+    'params' => [
+      'version' => 4,
+      'values' => [
+        'name' => 'Administer_Relationship_Types',
+        'label' => E::ts('Administer Relationship Types'),
+        'form_values' => NULL,
+        'mapping_id' => NULL,
+        'search_custom_id' => NULL,
+        'api_entity' => 'RelationshipType',
+        'api_params' => [
+          'version' => 4,
+          'select' => [
+            'name_a_b',
+            'name_b_a',
+            'contact_type_a:label',
+            'contact_type_b:label',
+            'is_active',
+          ],
+          'orderBy' => [],
+          'where' => [],
+          'groupBy' => [],
+          'join' => [],
+          'having' => [],
+        ],
+        'expires_date' => NULL,
+        'description' => NULL,
+      ],
+    ],
+  ],
+  [
+    'name' => 'SavedSearch_Administer_Relationship_Types_SearchDisplay_Administer_Relationship_Types_Table_1',
+    'entity' => 'SearchDisplay',
+    'cleanup' => 'unused',
+    'update' => 'unmodified',
+    'params' => [
+      'version' => 4,
+      'values' => [
+        'name' => 'Administer_Relationship_Types_Table_1',
+        'label' => E::ts('Administer Relationship Types Table 1'),
+        'saved_search_id.name' => 'Administer_Relationship_Types',
+        'type' => 'table',
+        'settings' => [
+          'actions' => FALSE,
+          'limit' => 50,
+          'classes' => [
+            'table',
+            'table-striped',
+          ],
+          'pager' => [],
+          'placeholder' => 5,
+          'sort' => [],
+          'columns' => [
+            [
+              'type' => 'field',
+              'key' => 'name_a_b',
+              'dataType' => 'String',
+              'label' => E::ts('Relationship A to B'),
+              'sortable' => TRUE,
+              'editable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'name_b_a',
+              'dataType' => 'String',
+              'label' => E::ts('Relationship B to A'),
+              'sortable' => TRUE,
+              'editable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'contact_type_a:label',
+              'dataType' => 'String',
+              'label' => E::ts('Contact Type A'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'contact_type_b:label',
+              'dataType' => 'String',
+              'label' => E::ts('Contact Type B'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'is_active',
+              'dataType' => 'Boolean',
+              'label' => E::ts('Enabled'),
+              'sortable' => TRUE,
+              'editable' => TRUE,
+            ],
+            [
+              'size' => 'btn-sm',
+              'links' => [
+                [
+                  'entity' => 'RelationshipType',
+                  'action' => 'view',
+                  'join' => '',
+                  'target' => 'crm-popup',
+                  'icon' => 'fa-external-link',
+                  'text' => E::ts('View'),
+                  'style' => 'default',
+                  'path' => '',
+                  'condition' => [],
+                ],
+                [
+                  'entity' => 'RelationshipType',
+                  'action' => 'update',
+                  'join' => '',
+                  'target' => 'crm-popup',
+                  'icon' => 'fa-pencil',
+                  'text' => E::ts('Edit'),
+                  'style' => 'default',
+                  'path' => '',
+                  'condition' => [],
+                ],
+                [
+                  'entity' => 'RelationshipType',
+                  'action' => 'delete',
+                  'join' => '',
+                  'target' => 'crm-popup',
+                  'icon' => 'fa-trash',
+                  'text' => E::ts('Delete'),
+                  'style' => 'danger',
+                  'path' => '',
+                  'condition' => [],
+                ],
+              ],
+              'type' => 'buttons',
+              'alignment' => 'text-right',
+            ],
+          ],
+          'addButton' => [
+            'path' => 'civicrm/admin/reltype/edit?action=add&reset=1',
+            'text' => E::ts('Add Relationship Type'),
+            'icon' => 'fa-plus',
+          ],
+          'cssRules' => [
+            [
+              'disabled',
+              'is_active',
+              '=',
+              FALSE,
+            ],
+          ],
+        ],
+        'acl_bypass' => FALSE,
+      ],
+    ],
+  ],
+];
index ba388a83689dbde6366cec21e796a4bdae9adcdf..ead8d6f7bf504c7197e254f92607188dda66e5c4 100644 (file)
@@ -6,6 +6,12 @@
   <name>civicrm_relationship_type</name>
   <comment>Relationship types s/b structured with contact_a as the 'subject/child' contact and contact_b as the 'object/parent' contact (e.g. Individual A is Employee of Org B).</comment>
   <add>1.1</add>
+  <paths>
+    <add>civicrm/admin/reltype/edit?action=add&amp;reset=1</add>
+    <view>civicrm/admin/reltype/edit?action=view&amp;id=[id]&amp;reset=1</view>
+    <update>civicrm/admin/reltype/edit?action=update&amp;id=[id]&amp;reset=1</update>
+    <delete>civicrm/admin/reltype/edit?action=delete&amp;id=[id]&amp;reset=1</delete>
+  </paths>
   <log>true</log>
   <field>
     <name>id</name>