Optional On Behalf Organisation not handled correctly
Created by: webmaster-cses-org-uk
If no On Behalf Organisation information is entered, when it is optional to do so, the form is processed as if a null organisation has been entered, erroneously creating an organisation with empty details and overwriting the contact's existing "current employer" field.
This seems to be due to an error on line 530 of CRM/Grant/Form/Grant/Confirm.php:
if (isset($this->_values['onbehalf_profile_id']) && isset($behalfOrganization['organization_name'])) {
Should be:
if (!empty($this->_values['onbehalf_profile_id']) && !empty($behalfOrganization['organization_name'])) {
For consistency with surrounding code and application logic.