CiviCase Forces Case Status to Resolved (Closed) when all Activities in a Sequence are Complete
Overview
For Cases that use a Sequence, once all activities in the sequence are complete, the Case gets set to a Resolved (aka Closed) status. This is fine. However, after a Case is in the Resolved status, if a user then wishes to change the status to something other than Resolved (like to a custom status), even though CiviCase says it made the change and even creates a status change activity that shows the status was changed, the case remains in Resolved status.
It looks like Civi/CCase/SequenceListener.php is firing after any case status changes are written to the DB, but SequenceListener is not accounting for someone purposefully trying to change the case status. It only looks for all activities being completed and forces the case back to Resolved.
This doesn't seem like correct behavior nor a good user experience. The listener should check to see if the action was a status change action and not fire the API call in that case. I'm not sure how that can be done (not sure what input the listener has), but that's my guess on how to resolve the issue.
Reproduction steps
- Create a Case Type that uses a sequence of activities (doesn't matter how many)
- Create a new Case using that type
- Complete each activity in the sequence and see that the Case automatically changes to Resolved.
- Try to then change the Case Status to something other than Resolved (like In Progress or Ongoing or any custom status).
- See that the Case status remains as Resolved, even though a new case activity says it was changed.
Expected behaviour
The Case should allow a change in Status even if all Activities in a Sequence are completed. That way user can change to a custom status that also reflects completion (we have multiple status that denote completion but for a variety of reasons).