From e1da88ad8f3277f6f54a830255063b8d9c7353c2 Mon Sep 17 00:00:00 2001 From: Elliott Eggleston Date: Fri, 2 Feb 2024 10:52:07 -0500 Subject: [PATCH] Make Case menu link in relationship tab conditional Only add the link when CiviCase is enabled dev/core#4960 --- ...arch_Contact_Summary_Relationships.mgd.php | 129 +++++++++--------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php b/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php index 822209aa1b..fb94f75c91 100644 --- a/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php +++ b/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php @@ -9,12 +9,76 @@ $joins = [ ['far_contact_id', '=', 'RelationshipCache_Contact_far_contact_id_01.id'], ], ]; +$links = [ + [ + 'entity' => 'Relationship', + 'action' => 'view', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-external-link', + 'text' => ts('View Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'entity' => 'Relationship', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => ts('Update Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'task' => 'disable', + 'entity' => 'Relationship', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-toggle-off', + 'text' => ts('Disable Relationship'), + 'style' => 'default', + 'path' => '', + 'action' => '', + 'condition' => [ + 'is_active', + '=', + TRUE, + ], + ], + [ + 'entity' => 'Relationship', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => ts('Delete Relationship'), + 'style' => 'danger', + 'path' => '', + 'task' => '', + 'condition' => [], + ], +]; if ($civiCaseEnabled) { $joins[] = [ 'Case AS RelationshipCache_Case_case_id_01', 'LEFT', ['case_id', '=', 'RelationshipCache_Case_case_id_01.id'], ]; + $links[] = [ + 'entity' => 'Case', + 'action' => 'view', + 'join' => 'RelationshipCache_Case_case_id_01', + 'target' => '', + 'icon' => 'fa-folder-open', + 'text' => ts('Manage Case'), + 'style' => 'default', + 'condition' => [], + ]; } return [ @@ -185,70 +249,7 @@ return [ 'style' => 'default', 'size' => 'btn-xs', 'icon' => 'fa-bars', - 'links' => [ - [ - 'entity' => 'Relationship', - 'action' => 'view', - 'join' => '', - 'target' => 'crm-popup', - 'icon' => 'fa-external-link', - 'text' => ts('View Relationship'), - 'style' => 'default', - 'path' => '', - 'task' => '', - 'condition' => [], - ], - [ - 'entity' => 'Relationship', - 'action' => 'update', - 'join' => '', - 'target' => 'crm-popup', - 'icon' => 'fa-pencil', - 'text' => ts('Update Relationship'), - 'style' => 'default', - 'path' => '', - 'task' => '', - 'condition' => [], - ], - [ - 'task' => 'disable', - 'entity' => 'Relationship', - 'join' => '', - 'target' => 'crm-popup', - 'icon' => 'fa-toggle-off', - 'text' => ts('Disable Relationship'), - 'style' => 'default', - 'path' => '', - 'action' => '', - 'condition' => [ - 'is_active', - '=', - TRUE, - ], - ], - [ - 'entity' => 'Relationship', - 'action' => 'delete', - 'join' => '', - 'target' => 'crm-popup', - 'icon' => 'fa-trash', - 'text' => ts('Delete Relationship'), - 'style' => 'danger', - 'path' => '', - 'task' => '', - 'condition' => [], - ], - [ - 'entity' => 'Case', - 'action' => 'view', - 'join' => 'RelationshipCache_Case_case_id_01', - 'target' => '', - 'icon' => 'fa-folder-open', - 'text' => ts('Manage Case'), - 'style' => 'default', - 'condition' => [], - ], - ], + 'links' => $links, 'type' => 'menu', 'alignment' => 'text-right', ], -- 2.25.1