Fix create relationship for non-english languages and use API4
in the function processOnBehalfOrganization() the typeID of the relationship is determined by a string search for "Employee of". This only works for one language: english. I think it is better to use a constant here (5). My guess is that this ID is correct for over 99% of all installs.
Also I discovered that CRM_Contact_BAO_Relationship::legacyCreateMultiple() and also createMultiple() do not work as expected. As written in the deprecation documentation of legacyCreateMultiple() it should be replaced by a API call - which is easy when we only insert one new relationship.
I prepared a merge request for this.
I am not very experienced, so please take a good look a the changes and feel free to discuss the solution. I tried to change as less code as possible.
best, Martin