ContactSummary - Remove old relationships tab
authorcolemanw <coleman@civicrm.org>
Mon, 2 Oct 2023 02:41:44 +0000 (22:41 -0400)
committercolemanw <coleman@civicrm.org>
Wed, 4 Oct 2023 00:52:21 +0000 (20:52 -0400)
CRM/Contact/BAO/Relationship.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Page/View/Relationship.php
CRM/Contact/Page/View/Summary.php
CRM/Contact/Page/View/UserDashBoard.php
CRM/Core/xml/Menu/Contact.xml
templates/CRM/Contact/Page/View/Relationship.tpl
templates/CRM/Contact/Page/View/RelationshipPerm.tpl
templates/CRM/Contact/Page/View/Summary.js

index 6405520474f77eacfaaaaa8600bf7595a3a8e884..dacab11fcf581363146b3a10fba1682acdb9bb22 100644 (file)
@@ -1807,14 +1807,7 @@ AND cc.sort_name LIKE '%$name%'";
   }
 
   /**
-   * Wrapper for contact relationship selector.
-   *
-   * @param array $params
-   *   Associated array for params record id.
-   *
-   * @return array
-   *   associated array of contact relationships
-   * @throws \Exception
+   * DELETEME only-used-by-user-dashboard
    */
   public static function getContactRelationshipSelector(&$params) {
     // format the params
@@ -1957,7 +1950,7 @@ AND cc.sort_name LIKE '%$name%'";
   }
 
   /**
-   * @return array
+   * DELETEME only-used-by-user-dashboard
    */
   public static function getColumnHeaders() {
     return [
index 99181e9276a9a768e43889639afe29ccc2caf4a1..3c9f17e00145d7dda7f717ce9ac20a5651d9abfb 100644 (file)
@@ -979,7 +979,7 @@ LIMIT {$offset}, {$rowCount}
   }
 
   /**
-   * Retrieve contact relationships.
+   * DELETEME only-used-by-user-dashboard
    */
   public static function getContactRelationships() {
     $contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
index f0d6e4d804f3febb130bb063f11d650420c9fb06..0b0bb7eb8cfb551adb8529e633bc962e5d1e916b 100644 (file)
@@ -139,19 +139,6 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page {
     );
   }
 
-  /**
-   * called when action is browse.
-   *
-   */
-  public function browse() {
-    // do nothing :) we are using datatable for rendering relationship selectors
-    $columnHeaders = CRM_Contact_BAO_Relationship::getColumnHeaders();
-    $selector = NULL;
-    $contactRelationships = [];
-    CRM_Utils_Hook::searchColumns('relationship.columns', $columnHeaders, $contactRelationships, $selector);
-    $this->assign('columnHeaders', $columnHeaders);
-  }
-
   /**
    * called when action is update or new.
    *
@@ -215,11 +202,6 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page {
       $this->edit();
     }
 
-    // if this is called from case view, suppress browse relationships form
-    else {
-      $this->browse();
-    }
-
     return parent::run();
   }
 
@@ -245,7 +227,7 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page {
   }
 
   /**
-   * Get action links.
+   * DELETEME only-used-by-user-dashboard
    *
    * @return array
    *   (reference) of action links
index e690767acc6080b6782c26ee7c52becb5f10fc5c..f1387457232c5e4dc52c7c4eaed2b7ff59134e3c 100644 (file)
@@ -304,13 +304,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
         'weight' => 70,
         'icon' => 'crm-i fa-tasks',
       ],
-      [
-        'id' => 'rel',
-        'title' => ts('Relationships'),
-        'class' => 'livePage',
-        'weight' => 80,
-        'icon' => 'crm-i fa-handshake-o',
-      ],
       [
         'id' => 'group',
         'title' => ts('Groups'),
index c93b161213f37a2b5f606ab07e8578d3d7a6d07d..5ac3aa23bced07f126d3e0f235fad5e3535fee3e 100644 (file)
@@ -126,7 +126,10 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
       }
     }
 
-    // CRM-16512 - Hide related contact table if user lacks permission to view self
+    // Relationship section
+    // FIXME - this used to share code with the contact summary "Relationships" tab
+    // now that tab has been switched to use SearchKit, and this ought to be switched as well;
+    // then remove all code commented with "DELETEME only-used-by-user-dashboard"
     if (!empty($dashboardOptions['Permissioned Orgs']) && CRM_Core_Permission::check('view my contact')) {
       $columnHeaders = CRM_Contact_BAO_Relationship::getColumnHeaders();
       $contactRelationships = $selector = NULL;
index adae098257bde7bf4bbdd29e6e8d343ab22dbd00..5de7c28143649f2ed5b385cb69aca823ecb41b23 100644 (file)
   <page_callback>CRM_Contact_Form_Task_SMS</page_callback>
   <access_arguments>send SMS</access_arguments>
 </item>
+  <!-- DELETEME only-used-by-user-dashboard -->
   <item>
     <path>civicrm/ajax/contactrelationships</path>
     <page_callback>CRM_Contact_Page_AJAX::getContactRelationships</page_callback>
index 0cf2aee9397e566fdfbc0fd80983234966f7fbb2..85284373a5cf257667654a17b92f627e073340ee 100644 (file)
@@ -7,44 +7,9 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
 *}
-{* Relationship tab within View Contact - browse, and view relationships for a contact *}
+{* Overloaded template for viewing, editing and deleting a relationship *}
 {if $action eq 4} {* action = view *}
   {include file="CRM/Contact/Page/View/ViewRelationship.tpl"}
-{elseif $action neq 16} {* add, update *}
+{else} {* add, update, delete *}
   {include file="CRM/Contact/Form/Relationship.tpl"}
-{else}
-  <div id="contact-summary-relationship-tab" class="view-content">
-    {if $permission EQ 'edit'}
-      <div class="action-link">
-        {crmButton accesskey="N"  p='civicrm/contact/view/rel' q="cid=`$contactId`&action=add&reset=1" icon="plus-circle"}{ts}Add Relationship{/ts}{/crmButton}
-      </div>
-    {/if}
-
-    {* display current relationships *}
-    <h3>{ts}Current Relationships{/ts}</h3>
-    <div id="permission-legend" class="help">
-      <span class="crm-label">{ts}Permissioned Relationships: {/ts}</span>
-      {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 afterText=true}
-    </div>
-    {include file="CRM/Contact/Page/View/RelationshipSelector.tpl" context="current"}
-
-    <div class="spacer"></div>
-    {* display past relationships *}
-    <h3 class="font-red">{ts}Inactive Relationships{/ts}</h3>
-    <div class="help">{ts}These relationships are Disabled OR have a past End Date.{/ts}</div>
-    {include file="CRM/Contact/Page/View/RelationshipSelector.tpl" context="past"}
-  </div>
-
-  {include file="CRM/common/enableDisableApi.tpl"}
-  {literal}
-  <script type="text/javascript">
-    CRM.$(function($) {
-      // Changing relationships may affect related members and contributions. Ensure they are refreshed.
-      $('#contact-summary-relationship-tab').on('crmPopupFormSuccess', function() {
-        CRM.tabHeader.resetTab('#tab_contribute');
-        CRM.tabHeader.resetTab('#tab_member');
-      });
-    });
-  </script>
-  {/literal}
-{/if} {* close of custom data else*}
+{/if}
index 709b0265c84f7757e8083d24dc173c2477f70bba..04c6dfdb8326acb5baa46e9a7947b500974261cf 100644 (file)
 {ts 1=$permDisplayName 2=$otherDisplayName}<strong>%1</strong> can view information about <strong>%2</strong>.{/ts}
 {/if}
 {/if}
-
-{* Used for legend on relationships tab *}
-{if $afterText}
-{if $permType eq 1}
-{ts}This contact can be edited by the other.{/ts}
-{else}
-{ts}This contact can be viewed by the other.{/ts}
-{/if}
-{/if}
index e07de3e7f016edb5c0608c6e912bd139a9b7d63b..a5faa0821a2b460567d70c63cc545875f573e400 100644 (file)
       }
     }
 
+    // Changing relationships may affect related members and contributions. Ensure they are refreshed.
+    $('#contact-rel').on('crmPopupFormSuccess', function() {
+      CRM.tabHeader.resetTab('#tab_contribute');
+      CRM.tabHeader.resetTab('#tab_member');
+    });
+
     onResize();
     $(window).resize(onResize);
   });