Skip to content

Commit

Permalink
Merge pull request #885 from compucorp/MAE-966-fix-contact-activity
Browse files Browse the repository at this point in the history
MAE-966: Resolve issue with recording case activity on contact page
  • Loading branch information
olayiwola-compucorp authored Nov 29, 2022
2 parents c3f7530 + 8ceb9e5 commit bad1eec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CRM/Civicase/Hook/ValidateForm/SaveActivityDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function run($formName, array &$fields, array &$files, CRM_Core_Form &$fo
return;
}

if (!array_key_exists($form->getButtonName('refresh'), $fields['buttons'])) {
if (empty($fields['buttons']) || !array_key_exists($form->getButtonName('refresh'), $fields['buttons'])) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion api/v3/Activity/Getdayswithactivities.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function _join_to_case(CRM_Utils_SQL_Select $query, $value) {
function _get_case_ids(array $caseParams) {
$results = civicrm_api3('Case', 'getcaselist', array_merge([
'return' => 'id',
'options' => [limit => 0],
'options' => ['limit' => 0],
], $caseParams))['values'];

return array_column($results, 'id');
Expand Down
6 changes: 3 additions & 3 deletions api/v3/Activity/Getmonthswithactivities.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function civicrm_api3_activity_Getmonthswithactivities(array $params) {
$grouped_activity_dates = [];

foreach ($activities as $activity) {
list($activity_year, $activity_month) = explode('-', $activity['activity_date_time']);
[$activity_year, $activity_month] = explode('-', $activity['activity_date_time']);

$activity_group_index = -1;
foreach ($grouped_activity_dates as $key => $val) {
Expand Down Expand Up @@ -119,7 +119,7 @@ function get_records_from_activity_get_api(array $params) {
$sort = explode(', ', $options['sort']);

foreach ($sort as $index => &$sortString) {
list($sortField, $dir) = array_pad(explode(' ', $sortString), 2, 'ASC');
[$sortField, $dir] = array_pad(explode(' ', $sortString), 2, 'ASC');
if ($sortField == 'is_overdue') {
$incomplete = implode(',', array_keys(CRM_Activity_BAO_Activity::getStatusesByType(CRM_Activity_BAO_Activity::INCOMPLETE)));
$sql->orderBy("IF((a.activity_date_time >= NOW() OR a.status_id NOT IN ($incomplete)), 0, 1) $dir", NULL, $index);
Expand All @@ -134,5 +134,5 @@ function get_records_from_activity_get_api(array $params) {
$params['return'] = array_keys($options['return']);
}

return _civicrm_api3_basic_get(CRM_Activity_BAO_Activity, $params, FALSE, 'Activity', $sql);
return _civicrm_api3_basic_get('CRM_Activity_BAO_Activity', $params, FALSE, 'Activity', $sql);
}

0 comments on commit bad1eec

Please sign in to comment.