From bbdf7a929abdf5c26b2e0413391e5d6addf5a507 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Thu, 4 Jul 2024 14:28:15 +0800 Subject: [PATCH] refs #41054, show folloup activity under view activity --- CRM/Activity/BAO/Query.php | 5 +++++ CRM/Activity/Page/Tab.php | 19 +++++++++++++++++++ CRM/Contact/BAO/Query.php | 1 + templates/CRM/Activity/Form/Activity.tpl | 17 ++++++++++++++++- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index 81b749e3c..e82b79b3a 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -310,6 +310,11 @@ static function whereClauseSingle(&$values, &$query) { $query->_qill[$grouping][] = ts('Activity Tag %1', array(1 => $op)) . ' ' . CRM_Utils_Array::implode(' ' . ts('OR') . ' ', $names); $query->_tables['civicrm_activity_tag'] = $query->_whereTables['civicrm_activity_tag'] = 1; break; + + case 'parent_id': + $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.parent_id", $op, $value, "Integer"); + $query->_qill[$grouping][] = ts('Task Parent') . ' = ' . $value; + break; } } diff --git a/CRM/Activity/Page/Tab.php b/CRM/Activity/Page/Tab.php index d55ac273e..f83e8d63a 100644 --- a/CRM/Activity/Page/Tab.php +++ b/CRM/Activity/Page/Tab.php @@ -247,6 +247,25 @@ function run() { if (in_array($activityTypeId, array($emailTypeValue, $letterTypeValue, $SMSTypeValue))) { return; } + + // add children activity search result + if ($this->_action & CRM_Core_Action::VIEW) { + $sortID = NULL; + $filter = array( + 'parent_id' => $this->_id, + ); + $queryParams = CRM_Contact_BAO_Query::convertFormValues($filter); + $selector = new CRM_Activity_Selector_Search($queryParams, $this->_action); + $controller2 = new CRM_Core_Selector_Controller($selector, + $this->get(CRM_Utils_Pager::PAGE_ID), + $sortID, + CRM_Core_Action::VIEW, + $this, + CRM_Core_Selector_Controller::TRANSFER + ); + $controller2->setEmbedded(TRUE); + $controller2->run(); + } } elseif ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::DETACH)) { $this->delete(); diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e1c897958..16439a350 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1482,6 +1482,7 @@ function whereClauseSingle(&$values) { case 'activity_engagement_level': case 'activity_id': case 'activity_record_id': + case 'parent_id': CRM_Activity_BAO_Query::whereClauseSingle($values, $this); return; diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index af74111f2..63452af6c 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -254,10 +254,24 @@ {/if} + {if $rows && $action eq 4} + + +
+
+
{ts}Followup Activity{/ts} +
+
+ {include file="CRM/Activity/Form/Selector.tpl} +
{*accordion-body*} +
+ + + {/if} {if $action eq 4 AND $currentAttachmentURL} {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *} - {else if $action eq 1 OR $action eq 2} + {elseif $action eq 1 OR $action eq 2} {include file="CRM/Form/attachment.tpl"} @@ -343,6 +357,7 @@
{ts}Delete{/ts}
{/if} {/if} + {include file="CRM/common/formButtons.tpl" location="bottom"}