-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-21598 - Case Activity issues with custom Completed Status Type #11456
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) { | |
} | ||
|
||
$actTypes = array_flip(\CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name')); | ||
$actStatuses = array_flip(\CRM_Core_PseudoConstant::activityStatus('name')); | ||
$actStatuses = array_flip(\CRM_Activity_BAO_Activity::getStatusesByType(\CRM_Activity_BAO_Activity::COMPLETED)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this function do and does it also need to respond to CANCELLED activities? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function calls the next activity in sequence when the current activity is set to I'm not really sure if it makes sense to create next activity when the present activity is CANCELLED. But, this was not the case before this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, can you add what you just said about what the function does into the docblock for future reference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 👍 |
||
|
||
$actIndex = $analyzer->getActivityIndex(array('activity_type_id', 'status_id')); | ||
|
||
|
@@ -59,7 +59,7 @@ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) { | |
$this->createActivity($analyzer, $actTypeXML); | ||
return; | ||
} | ||
elseif (empty($actIndex[$actTypeId][$actStatuses['Completed']])) { | ||
elseif (!in_array(key($actIndex[$actTypeId]), $actStatuses)) { | ||
// Haven't gotten past this step yet! | ||
return; | ||
} | ||
|
@@ -68,7 +68,7 @@ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) { | |
//CRM-17452 - Close the case only if all the activities are complete | ||
$activities = $analyzer->getActivities(); | ||
foreach ($activities as $activity) { | ||
if ($activity['status_id'] != $actStatuses['Completed']) { | ||
if (!in_array($activity['status_id'], $actStatuses)) { | ||
return; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jitendrapurohit why are you merging these 2 arrays? I think just the statusesByType should provide the needed information, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem so. 'Left Message', 'Unreachable' and 'Not Required' belongs to activity statuses of type
INCOMPLETE
and 'Cancelled' is of typeCANCELLED
.But the current flow doesn't want to display them in red color if they have an overdue date(see comment in L1042). statusesByType will only return the completed activity status.
We can use the following API if we intend to use only one variable -
But seems it'll not be a good change w.r.t readability than the current one?