PCHR-3411: Remove unnecesary relationship types#2554
Conversation
mickadoo
left a comment
There was a problem hiding this comment.
The code looks very nice. However I'm going to leave a comment about this below
|
@reneolivo I'm a bit concerned about deleting these relationship types. Running
On a vanilla CiviCRM site will return 3 rows
And all 3 of them would be deleted by this PR. Maybe that might be fine and they're just reserved for fun, but looking through the code I see places like this, this and this. I tested this out by deleting the relationship types from your PR and then trying to create a new contact in CiviCRM with "Current Employer" set it gave me this: There are also places where this error isn't thrown but it does depend on one of these relationship types. For example this code seems to depend on two relationship types. And indeed after deleting these types, going to "Advanced search", selecting some contacts and choosing "print mailing label" from the actions, and checking "Merge labels for contacts belonging to the same household" I got I'm guessing if I can find these problems in a few minutes there are plenty more that I've missed. If we really don't want to show these in CiviHR it might be a better option to try to hide them. |
mickadoo
left a comment
There was a problem hiding this comment.
Just two codestyle comments
| /** | ||
| * Returns the Ids of the the relationship types to be disabled. | ||
| * | ||
| * @return Array[int] |
There was a problem hiding this comment.
Does the IDE not complain about this? I thought the standard way was to use int[]
There was a problem hiding this comment.
The IDE even makes it pretty (Atom IDE).... I'll change it anyways!
| 'id' => $relationship['id'] | ||
| ]); | ||
| } | ||
| } |
There was a problem hiding this comment.
Unforgivable, no empty line before closing bracked 😁 Did you run civilint on this file?
| /** | ||
| * Returns all the relationships associated with a given type. | ||
| * | ||
| * @param int[] $relationshipTypeId |
There was a problem hiding this comment.
tiny mistake, this is int and not int[]
c348166 to
b3125ec
Compare


Overview
This PR removes relationships type that are not needed by CiviHR. The relationships types are:
Before
{ "is_error": 0, "version": 3, "count": 4, "values": [ { "id": "9", "name_a_b": "Case Coordinator is" }, { "id": "5", "name_a_b": "Employee of" }, { "id": "7", "name_a_b": "Head of Household for" }, { "id": "8", "name_a_b": "Household Member of" } ] }After
{ "is_error": 0, "version": 3, "count": 0, "values": [] }Technical Details
A new upgrader was implemented for HRCore since this is a change that affects all extensions: