Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Nov 29, 2017
1 parent 038ddda commit dc0adf1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
71 changes: 38 additions & 33 deletions CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,45 +420,51 @@ public static function getCaseActivityCountQuery($type = 'upcoming', $userID, $c
* @return string
*/
public static function getCaseActivityQuery($type = 'upcoming', $userID, $condition = NULL, $limit = NULL, $order = NULL) {
$query = "SELECT
civicrm_case.id as case_id,
civicrm_case.subject as case_subject,
civicrm_contact.id as contact_id,
civicrm_contact.sort_name as sort_name,
civicrm_phone.phone as phone,
civicrm_contact.contact_type as contact_type,
civicrm_contact.contact_sub_type as contact_sub_type,
t_act.activity_type_id,
c_type.title as case_type,
civicrm_case.case_type_id as case_type_id,
cov_status.label as case_status,
cov_status.label as case_status_name,
t_act.status_id,
civicrm_case.start_date as case_start_date,
case_relation_type.label_b_a as case_role, ";
$selectClauses = array(
'civicrm_case.id as case_id',
'civicrm_case.subject as case_subject',
'civicrm_contact.id as contact_id',
'civicrm_contact.sort_name as sort_name',
'civicrm_phone.phone as phone',
'civicrm_contact.contact_type as contact_type',
'civicrm_contact.contact_sub_type as contact_sub_type',
't_act.activity_type_id',
'c_type.title as case_type',
'civicrm_case.case_type_id as case_type_id',
'cov_status.label as case_status',
'cov_status.label as case_status_name',
't_act.status_id',
'civicrm_case.start_date as case_start_date',
'case_relation_type.label_b_a as case_role',
);

if ($type == 'upcoming') {
$query .= "
t_act.desired_date as case_scheduled_activity_date,
t_act.id as case_scheduled_activity_id,
t_act.act_type_name as case_scheduled_activity_type_name,
t_act.act_type AS case_scheduled_activity_type ";
$selectClauses = array_merge($selectClauses, array(
't_act.desired_date as case_scheduled_activity_date',
't_act.id as case_scheduled_activity_id',
't_act.act_type_name as case_scheduled_activity_type_name',
't_act.act_type AS case_scheduled_activity_type',
));
}
elseif ($type == 'recent') {
$query .= "
t_act.desired_date as case_recent_activity_date,
t_act.id as case_recent_activity_id,
t_act.act_type_name as case_recent_activity_type_name,
t_act.act_type AS case_recent_activity_type ";
$selectClauses = array_merge($selectClauses, array(
't_act.desired_date as case_recent_activity_date',
't_act.id as case_recent_activity_id',
't_act.act_type_name as case_recent_activity_type_name',
't_act.act_type AS case_recent_activity_type',
));
}
elseif ($type == 'any') {
$query .= "
t_act.desired_date as case_activity_date,
t_act.id as case_activity_id,
t_act.act_type_name as case_activity_type_name,
t_act.act_type AS case_activity_type ";
$selectClauses = array_merge($selectClauses, array(
't_act.desired_date as case_activity_date',
't_act.id as case_activity_id',
't_act.act_type_name as case_activity_type_name',
't_act.act_type AS case_activity_type',
));
}

$query = CRM_Contact_BAO_Query::appendAnyValueToSelect($selectClauses, 'case_id');

$query .= " FROM civicrm_case
INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id
INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id ";
Expand Down Expand Up @@ -1593,8 +1599,7 @@ public static function getNextScheduledActivity($cases, $type = 'upcoming') {
$caseID = implode(',', $cases['case_id']);
$contactID = implode(',', $cases['contact_id']);

$condition = "
AND civicrm_case_contact.contact_id IN( {$contactID} )
$condition = " civicrm_case_contact.contact_id IN( {$contactID} )
AND civicrm_case.id IN( {$caseID})
AND civicrm_case.is_deleted = {$cases['case_deleted']}";

Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Case/Page/DashboardSelector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*}
{capture assign=expandIconURL}<img src="{$config->resourceBase}i/TreePlus.gif" alt="{ts}open section{/ts}"/>{/capture}
{strip}
<table class="case-selector-{$list} crm-ajax-table">
<table class="case-selector-{$list} crm-ajax-table" data-page-length='10'>
<thead>
<tr>
<th data-data="activity_list" data-orderable="false" class="crm-case-activity_list"></th>
Expand Down

0 comments on commit dc0adf1

Please sign in to comment.