-
-
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
dev/core#530 Make a_b relationships available as case roles #13916
Conversation
(Standard links)
|
@alifrumin The test failures look related - https://test.civicrm.org/job/CiviCRM-Core-PR/25405/ |
Thanks @jitendrapurohit, I will look into these |
9c566e9
to
1ae15d3
Compare
Willing to review this. One little note so far: If you use the Print Report button on Manage Case you get duplicate rows in the Roles section. I don't see this on dmaster.demo.civicrm.org. |
Thanks @demeritcowboy I will wait until you have finished your review and then debug the Print Report button on Manage Case. |
Overall it seems to do as described and you've obviously put a lot of work into it!
I should file these below as separate issues since they don't seem related to the PR and I see them on dmaster.demo, but wanted to record them here for the moment in case you or someone else comes across them while testing and might think they are related.
|
I tested it and it fixes the bugs described in #9975 and also the those described on the pr it self and the related git lab issue: https://lab.civicrm.org/dev/core/issues/530. |
Thank you @demeritcowboy, I will take a look at these notes. |
I think I fixed the merge conflicts and the issues @demeritcowboy pointed out under r-run but Jenkins seems to be having difficulty when I go to check the test build I see: |
Jenkins retest this please |
@mlutfy, have you seen this Jenkins error before: https://test.civicrm.org/job/CiviCRM-Core-PR/25692/checkstyleResult/error/ any suggestions welcome. |
@alifrumin you need to rebase this as the CI pipeline cannot apply it cleanly ontop of master |
Thank you @seamuslee001 I will try that. |
@alifrumin I had a ton of trouble the other day and git rebase just kept giving me conflicts. This article kept me from going homicidal: https://stackoverflow.com/a/6103022/8332458 |
cd4a21d
to
4840999
Compare
@alifrumin Sorry I know how much work this is. I'm noticing that with the current default roles defined for case types they are backwards after this PR, so maybe the default config would also need to be changed? For example if you create a new case with the defaults, one of the preassigned roles is "Benefits Specialist". So now when you assign this role to someone, you incorrectly get it assigned as the Client who is the Benefits Specialist of the other person. So the default would need to be changed to "Benefits Specialist is". Even if you don't manually assign anything, the case manager role itself is backwards right after creation. The client ends up being the Homeless Services Coordinator of the logged in user. So again that default config would need to be changed. And then this brings up an upgrade question for people who already have set configs. I'm not trying to block this - honest! I think bidirectional would be a good improvement if it can be done. |
Hey @demeritcowboy, I appreciate your feedback. that's an interesting point. I will noodle on this. |
@demeritcowboy so @alifrumin and I spent a lot of time thinking through this question about default roles. Basically, the situation absent this PR is that relationship types are displayed willy-nilly from different perspectives, and the only thing maintaining any order is the occasionally-enforced assumption that the client is always on the A side of a case role relationship. In dropping that assumption and straightening out the display of case roles, the convention has been that case roles should be described in the UI from the perspective of the client. The problem that you noticed is that the default XML-defined case types describe the roles from the perspective of the non-client. In further testing, it's clear that the same goes for case types that are created in the UI under the current situation. Consequently, we have to face that the case types have the reverse convention that case roles are described in the case type definition from the perspective of the non-client. It really isn't feasible to go around and change everyone's case types during upgrade, especially since some are in XML files. Instead, we've just acquiesced to the fact that a case type is really saying "there's a role with relationship type 123 where the client is on the B side". In the UI for a case, we say the client is "student of" the teacher; in the XML case type definition, for legacy reasons, we say the case type has a "teacher of" the client. The most recent changes Alice committed have made it such that the A-B label in the XML corresponds to the B-A label everywhere else. The translation is done as closely to saving or retrieving the XML as possible. |
Well you two are persistent for sure. Unless you have more to add I think the next step would be to update those 2 style fixes to see if any actual tests fail? |
Test failures are both good signs. The first is this assertion:
The second failure is looking at a list of case role options: civicrm-core/tests/karma/unit/crmCaseTypeSpec.js Lines 353 to 363 in a1e9759
The relationship type options are intentionally swapped. Update the directions to match those here: civicrm-core/ang/crmCaseType.js Lines 288 to 298 in a1e9759
|
25da3cc
to
e1c4fec
Compare
Ah, @demeritcowboy I am able to trigger the code by:
|
@alifrumin Ok thanks I see. So for these odd situations it seems unlikely anybody is relying on it to be Individual, and you can just define the relationship type first or change it after. For reference I was also able to trigger it by "converting" an xml file to managed, i.e. the xml file is for a case type that isn't defined yet in the db, and it has a role that isn't defined in the db as a relationship type. Then
I would expect an api call to CaseType.create with a similar xml definition would also trigger this, which again seems fine. So I am done! |
@colemanw @mattwire @jitendrapurohit @lcdservices this seems to have had a lot of thought & review & appears to be considered mergeable by @demeritcowboy after careful thought. Is someone able to take a final overview on this |
@alifrumin Do you want to edit the title or the overview to indicate parts of it require #14216 ? |
@demeritcowboy, I do not think anything in the pr requires #14216, it makes things cleaner and is a nice to have not a need to have AND its been merged. |
I merged that PR - but as I noted on it dug a little & still think this was done on a 'this seems like better practice' rather than a real reason so I'm happy to merge this reversal.
|
@eileenmcnaughton has anyone expressed interest in doing a second review or is @demeritcowboy review sufficient? |
This is a good & valuable change but is tricky to review because of the complexity and the number of workflows affected. I'll need to carve out some time to test it properly. It also needs rebasing. |
* Get all relationship type labels | ||
* | ||
* TODO: These should probably be names, but under legacy behavior this has | ||
* been labels. |
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.
The "labels instead of names" thing was a design mistake that's haunted us for way too long. Every time a piece of CiviCase gets refactored this problem gets punted as "out of scope" for the issue at hand. I understand that, but jeeze this is a frustrating problem!
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.
At least now there's an explicit ticket for it, even though I'm not a fan of the solution proposed in #14001.
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.
@agh1 @colemanw That PR wasn't intended as a proposed solution for name vs. label - its intention seems to be to just allow changing a relationship label in the UI which happens to be blocked because of name vs label. In https://lab.civicrm.org/dev/core/issues/774#note_14566 I had started on a WIP but put it on hold since it is a bit of work and has a blocker or two.
@colemanw Thank you!! |
b2aacb2
to
320383d
Compare
…s are individuals
…nd commenting why
320383d
to
f34c103
Compare
Rebased @colemanw |
I did a few tests on a blank/demo site. Works as expected. I various variants of case roles / direction. I also tested the newer civicase extension:
So I would say that this is not a blocker, since it affects people who 1) are using this patch and created relationships in the other direction, and 2) migrate from CiviCase-classic to CiviCase-v5. I will open an issue on the civicase-v5 github repo. |
Thank you @alifrumin, @demeritcowboy, @agh1, @colemanw ! |
Overview
This change makes it so users can select b_a relationships AND a_b relationships when creating case roles, before this change only b_a relationships were available when creating case roles.
for more information see: https://lab.civicrm.org/dev/core/issues/530
Before
Before this change users could only create case roles for CiviCRM Cases that were one direction ( b -> a). See screen shot below that shows the "New Case Type" Ui with the options for "add role" open, only the label_b_a's are shown as one can see by checking against the Relationship Type table next to it.
There were several issues with case roles labels that originated from some confusion regarding relationship directions (originally documented in #9975) including:
then after creating a case you see the B-to-A "Parent of" label
after picking the contact, the label becomes the A-to-B "Child of"
yet they all have the B-to-A label, regardless of who the client is for example:
In this example Rebekah is the client, and the case has her as the parent of Kathleen and the child of Carylon. In the send a copy box, she's shown as parent of Carylon and her relationship w/ Kathleen is displayed as her being parent of herself.
After
With this change, when creating a case type users can choose which direction of a relationship type to use, they are no longer required to use b-> a, a<-b relationships are also available.
Additionally, this change fixes resolves the bugs described in the Before section by properly displaying the labels as they are defined in the case type.