Skip to content

Commit

Permalink
refs #41054, show folloup activity under view activity
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Jul 4, 2024
1 parent c8fa470 commit bbdf7a9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CRM/Activity/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
19 changes: 19 additions & 0 deletions CRM/Activity/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 16 additions & 1 deletion templates/CRM/Activity/Form/Activity.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,24 @@
</td>
</tr>
{/if}
{if $rows && $action eq 4}
<tr class="crm-activity-form-block-folowup">
<td colspan="2">
<div class="crm-accordion-wrapper crm-accordion-open">
<div class="crm-accordion-header">
<div class="zmdi crm-accordion-pointer"></div>{ts}Followup Activity{/ts}
</div>
<div class="crm-accordion-body">
{include file="CRM/Activity/Form/Selector.tpl}
</div>{*accordion-body*}
</div>
</td>
</tr>
{/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}
<tr class="crm-activity-form-block-attachment">
<td colspan="2">
{include file="CRM/Form/attachment.tpl"}
Expand Down Expand Up @@ -343,6 +357,7 @@
<a href="{crmURL p='civicrm/contact/view/activity' q=$urlParams}" class="delete button" title="{ts}Delete{/ts}"><span><div class="zmdi zmdi-delete"></div>{ts}Delete{/ts}</span></a>
{/if}
{/if}

{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>

Expand Down

0 comments on commit bbdf7a9

Please sign in to comment.