Contribution page receipt does not include on behalf of profile information when a contact contributes on behalf of an organization that they are not an employee of
Overview
This is a really really edge case situation. You can configure a contribution page so that you can contribute on behalf of an organization. The list of organizations you can select from is all the organizations you have a permissioned relationship to (regardless of what the relationship type is), however the receipt will not include the on behalf of profile information unless the relationship type is "Employee of". This is an issue for a client of ours that has a membership type that is inherited thru a custom relationship type.
I think that the problem is this code: https://github.com/civicrm/civicrm-core/blob/5.67/CRM/Contribute/BAO/Contribution.php#L2306
I have a patch that deals with this for our clients specific issue but Im not sure its the best fit for core.
Reproduction steps
- Create a Contribution Page where:
- on behalf of is turned on
- receipts are turned on
- A payment processor is available to use (the problem cannot be recreated if you do a pending pay later contribution)
- For your user, create a relationship:
- to an organization
- of any relationship type besides "Employee of"
- that has view/update permissions in both directions.
- If your user has an employer make sure you are selecting an organization that is different than your employer.
- Go to the contribution page on the frond end
- In the on behalf of section, select the organization you have a relationship to that is not thru an "Employee of" relationship (that you created in step 2)
- Make a "live" payment (you can use the dummy payment processor, just don't use the invoice option)
Current behaviour
The receipt does not include the on behalf of profile information.
Expected behaviour
The receipt should include the on behalf of profile information.
Environment information
I am able to replicate this in civicrm 5.67