From a523e31080309bc75e72a32a6de65d343ecbd8ea Mon Sep 17 00:00:00 2001 From: colemanw Date: Sun, 1 Oct 2023 22:41:44 -0400 Subject: [PATCH] ContactSummary - Remove old relationships tab --- CRM/Contact/BAO/Relationship.php | 11 +---- CRM/Contact/Page/AJAX.php | 2 +- CRM/Contact/Page/View/Relationship.php | 20 +-------- CRM/Contact/Page/View/Summary.php | 7 ---- CRM/Contact/Page/View/UserDashBoard.php | 5 ++- CRM/Core/xml/Menu/Contact.xml | 1 + .../CRM/Contact/Page/View/Relationship.tpl | 41 ++----------------- .../Contact/Page/View/RelationshipPerm.tpl | 9 ---- templates/CRM/Contact/Page/View/Summary.js | 6 +++ 9 files changed, 18 insertions(+), 84 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 6405520474..dacab11fcf 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -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 [ diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 99181e9276..3c9f17e001 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -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'); diff --git a/CRM/Contact/Page/View/Relationship.php b/CRM/Contact/Page/View/Relationship.php index f0d6e4d804..0b0bb7eb8c 100644 --- a/CRM/Contact/Page/View/Relationship.php +++ b/CRM/Contact/Page/View/Relationship.php @@ -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 diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index e690767acc..f138745723 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -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'), diff --git a/CRM/Contact/Page/View/UserDashBoard.php b/CRM/Contact/Page/View/UserDashBoard.php index c93b161213..5ac3aa23bc 100644 --- a/CRM/Contact/Page/View/UserDashBoard.php +++ b/CRM/Contact/Page/View/UserDashBoard.php @@ -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; diff --git a/CRM/Core/xml/Menu/Contact.xml b/CRM/Core/xml/Menu/Contact.xml index adae098257..5de7c28143 100644 --- a/CRM/Core/xml/Menu/Contact.xml +++ b/CRM/Core/xml/Menu/Contact.xml @@ -371,6 +371,7 @@ CRM_Contact_Form_Task_SMS send SMS + civicrm/ajax/contactrelationships CRM_Contact_Page_AJAX::getContactRelationships diff --git a/templates/CRM/Contact/Page/View/Relationship.tpl b/templates/CRM/Contact/Page/View/Relationship.tpl index 0cf2aee939..85284373a5 100644 --- a/templates/CRM/Contact/Page/View/Relationship.tpl +++ b/templates/CRM/Contact/Page/View/Relationship.tpl @@ -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} -
- {if $permission EQ 'edit'} - - {/if} - - {* display current relationships *} -

{ts}Current Relationships{/ts}

-
- {ts}Permissioned Relationships: {/ts} - {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 afterText=true} -
- {include file="CRM/Contact/Page/View/RelationshipSelector.tpl" context="current"} - -
- {* display past relationships *} -

{ts}Inactive Relationships{/ts}

-
{ts}These relationships are Disabled OR have a past End Date.{/ts}
- {include file="CRM/Contact/Page/View/RelationshipSelector.tpl" context="past"} -
- - {include file="CRM/common/enableDisableApi.tpl"} - {literal} - - {/literal} -{/if} {* close of custom data else*} +{/if} diff --git a/templates/CRM/Contact/Page/View/RelationshipPerm.tpl b/templates/CRM/Contact/Page/View/RelationshipPerm.tpl index 709b0265c8..04c6dfdb83 100644 --- a/templates/CRM/Contact/Page/View/RelationshipPerm.tpl +++ b/templates/CRM/Contact/Page/View/RelationshipPerm.tpl @@ -39,12 +39,3 @@ {ts 1=$permDisplayName 2=$otherDisplayName}%1 can view information about %2.{/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} diff --git a/templates/CRM/Contact/Page/View/Summary.js b/templates/CRM/Contact/Page/View/Summary.js index e07de3e7f0..a5faa0821a 100644 --- a/templates/CRM/Contact/Page/View/Summary.js +++ b/templates/CRM/Contact/Page/View/Summary.js @@ -403,6 +403,12 @@ } } + // 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); }); -- 2.25.1