Skip to content

Commit

Permalink
Merge pull request #29200 from ejegg/conditionalCaseLink
Browse files Browse the repository at this point in the history
dev/core#4960 Make Case menu link in relationship tab conditional
  • Loading branch information
colemanw authored Feb 3, 2024
2 parents b125ab2 + e1da88a commit b35dd0d
Showing 1 changed file with 65 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,76 @@
['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 [
Expand Down Expand Up @@ -185,70 +249,7 @@
'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',
],
Expand Down

0 comments on commit b35dd0d

Please sign in to comment.