From 3fff685f7ce4999f6657814737b0c8420c617987 Mon Sep 17 00:00:00 2001 From: Joseph Lacey Date: Mon, 8 Jun 2015 20:48:32 -0400 Subject: [PATCH] CRM-16353 - Fixing Case Activity count and pager bugs. Added Case Activity View link ---------------------------------------- * CRM-16353: Upgrade datatables integration to use v2 api https://issues.civicrm.org/jira/browse/CRM-16353 --- CRM/Case/BAO/Case.php | 22 ++++++++++++---------- templates/CRM/Case/Form/ActivityTab.tpl | 2 +- templates/CRM/common/l10n.js.tpl | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 05030a9860..9166a1cd16 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1160,6 +1160,9 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c $orderBy = " ORDER BY $sortBy "; } + $page = CRM_Utils_Array::value('page', $params); + $rp = CRM_Utils_Array::value('rp', $params); + if (!$page) { $page = 1; } @@ -1170,12 +1173,9 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c $limit = " LIMIT $start, $rp"; $query = $select . $from . $where . $groupBy . $orderBy . $limit; - $params = array(1 => array($caseID, 'Integer')); + $queryParams = array(1 => array($caseID, 'Integer')); - $dao = CRM_Core_DAO::executeQuery($query, $params); - - $page = CRM_Utils_Array::value('page', $params); - $rp = CRM_Utils_Array::value('rp', $params); + $dao = CRM_Core_DAO::executeQuery($query, $queryParams); $activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE); $activityStatuses = CRM_Core_PseudoConstant::activityStatus(); @@ -1235,8 +1235,10 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c } $caseActivities = array(); + $caseCount = 0; while ($dao->fetch()) { + $caseCount++; $caseActivity = array(); $caseActivityId = $dao->id; @@ -1322,8 +1324,8 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c $url = ""; $css = 'class="action-item crm-hover-button"'; if ($allowView) { - $url = CRM_Utils_System::url('civicrm/case/activity/view', array('cid' => $contactID, 'aid' => $caseActivityId)); - //$subject = '' . $subject . ''; + $viewUrl = CRM_Utils_System::url('civicrm/case/activity/view', array('cid' => $contactID, 'aid' => $caseActivityId)); + $url = '' . ts('View') . ''; } $additionalUrl = "&id={$caseActivityId}"; if (!$dao->deleted) { @@ -1331,7 +1333,7 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c if (!in_array($dao->type, $emailActivityTypeIDs)) { //hide Edit link if activity type is NOT editable (special case activities).CRM-5871 if ($allowEdit) { - $url = '' . ts('Edit') . ' '; + $url .= '' . ts('Edit') . ' '; } } if ($allowDelete) { @@ -1375,8 +1377,8 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c $caseActivitiesDT = array(); $caseActivitiesDT['data'] = $caseActivities; - $caseActivitiesDT['recordsTotal'] = $params['total']; - $caseActivitiesDT['recordsFiltered'] = $params['total']; + $caseActivitiesDT['recordsTotal'] = $caseCount; + $caseActivitiesDT['recordsFiltered'] = $caseCount; return $caseActivitiesDT; } diff --git a/templates/CRM/Case/Form/ActivityTab.tpl b/templates/CRM/Case/Form/ActivityTab.tpl index d7a0da2a36..29398c85cd 100644 --- a/templates/CRM/Case/Form/ActivityTab.tpl +++ b/templates/CRM/Case/Form/ActivityTab.tpl @@ -95,7 +95,7 @@ d.reporter_id = $("select#reporter_id_" + caseId).val(), d.activity_type_id = $("select#activity_type_filter_id_" + caseId).val(), d.activity_date_low = $("#activity_date_low_" + caseId).val(), - d.activity_date_high = $("#activity_date_high_" + caseId).val() + d.activity_date_high = $("#activity_date_high_" + caseId).val(), d.activity_deleted = ($("#activity_deleted_1").prop('checked')) ? 1 : 0; } } diff --git a/templates/CRM/common/l10n.js.tpl b/templates/CRM/common/l10n.js.tpl index 544ceb234b..f5a80f29c6 100644 --- a/templates/CRM/common/l10n.js.tpl +++ b/templates/CRM/common/l10n.js.tpl @@ -60,7 +60,7 @@ "jQueryUI": true, "language": {ldelim} "emptyTable": "{ts escape='js'}None found.{/ts}", - "info": "{ts escape='js' '1=_START_ 2=_END_ 3=_TOTAL_}Showing %1 to %2 of %3 entries{/ts}", + "info": "{ts escape='js' 1=_START_ 2=_END_ 3=_TOTAL_}Showing %1 to %2 of %3 entries{/ts}", "infoEmpty": "{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}", "infoFiltered": "{ts escape='js' 1=_MAX_}(filtered from %1 total entries){/ts}", "infoPostFix": "", -- 2.25.1