Skip to content
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

WIP dev/core#542 - case manager not displayed for closed cases #13144

Closed
wants to merge 1 commit into from

Conversation

jitendrapurohit
Copy link
Contributor

Overview

Fix case manager to be displayed for closed cases.

Before

Closed Cases do not display case manager in Manage Case screen. More Details on the SE post - https://civicrm.stackexchange.com/questions/27215/case-roles-on-closed-cases

After

Case Manager is displayed on Manage Case Screen.

Technical Details

4.7 included the refactoring of case roles via #6806 which added a query to only load active relationship from getCaseRole function. This was made flexible by adding an extra param $activeOnly in #11736. The changes made here uses that variable and load case manager for closed cases.

Comments

Gitlab - https://lab.civicrm.org/dev/core/issues/542

@civibot
Copy link

civibot bot commented Nov 21, 2018

(Standard links)

@civibot civibot bot added the master label Nov 21, 2018
@jitendrapurohit
Copy link
Contributor Author

ping @ray-wright

@ray-wright
Copy link
Contributor

@jitendrapurohit This does work - roles now show up in the roles section of the manage case screen - thanks again!

I failed to include in my original post that this also affects case listings. If you're willing - I'm posting a question on a separate commit that I've tracked it down to.

@colemanw
Copy link
Member

So if I understand correctly, when a case gets closed, case relationships are automatically made inactive? That seems odd to me.

@ray-wright
Copy link
Contributor

@colemanw I'm not sure if it was truly making them inactive - as there are two criteria in that $activeOnly statement (active and end date in the past). I'm assuming the 'end date in the past' was triggering the $activeOnly parameter to fail and the Case Manager to no longer be 'shown' on the manage case screen.

However, I do still have an issue with Case Managers not showing on Case listings when they are inactive - CRM-19890 so if one affects the other or they can both be solved similarly, that would help in referencing closed cases.

@ray-wright
Copy link
Contributor

@jitendrapurohit @colemanw So turns out this is somewhat problematic. With this change, if you try and edit a case role (case manager for instance) to a different contact. The manage case screen will then show both - because it doesn't delete the previous role, it merely expires and disables it. (To note: same with the 'delete' action on a case role, doesn't delete it, just expires and disables.)

I think a better behavior would be to DELETE the previous role (at least for case manager, since that is also displayed as a single contact in case listings) - then this patch would be effective in showing a *single * roles on closed cases.

I understand I now have to hunt down where the functionality is for changing case roles and swap out or add a true delete option - I wanted to point out that this change alone is a little awkward.

@colemanw
Copy link
Member

colemanw commented Jan 22, 2019

@ray-wright @jitendrapurohit to summarize:

  1. When changing case roles from one person to another, the old relationship is given an end date.
  2. When a case is closed, all case relationships are given an end date.
  3. When displaying a case, only non-ended relationships are shown.
  4. Therefore, when viewing a closed case, no roles are shown.

The solution to delete rather than end relationships is not advisable because records will be lost.

Another potential solution would be to make this patch conditional on the case being closed. So open cases will continue to behave as they do now; closed cases will show roles that are ended.

@jitendrapurohit
Copy link
Contributor Author

Thanks @colemanw @ray-wright. This PR acts only on the retrieval part of the process so the 1 & 2 point from the above comment is still working as before. Agree that this change raises a problem for open case as it also gets the inactive relationship while displaying roles on the Manage Case screen.

The change is now modified to display all roles for closed cases as per the above suggestion.

For us, we only wanted managers to be shown for closed cases. So maybe, if the current implementation doesn't satisfy everyone, we could add more filters to load only managers in the roles tab?

@ray-wright
Copy link
Contributor

ray-wright commented Jan 23, 2019

@colemanw @jitendrapurohit now that I've had more time to poke around I do agree that deleting a previous case role - not when you close a case just when you change a role on a case - isn't ideal (but that was the previous behavior before 4.7).

I've actually spent some time on this and have a fuller solution I'd like to present back to the community. The solution I'm proposing would benefit both the manage case screen and case listings and performs logic to show the active case manager or if there isn't one, show the most recently closed case manager. ( I have the code worked out and almost ready to place here.)

@ray-wright
Copy link
Contributor

@jitendrapurohit @colemanw If either of you are around on mattermost, I can share screenshots of my proposal for your thoughts.

@colemanw colemanw changed the title dev/core#542 - case manager not displayed for closed cases WIP dev/core#542 - case manager not displayed for closed cases Jan 23, 2019
@colemanw
Copy link
Member

colemanw commented Feb 1, 2019

Let's close this as #13510 is more recent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants