}
// if onbehalf-of-organization
if (!empty($this->_params['hidden_onbehalf_profile'])) {
- if (!empty($this->_params['org_option']) && !empty($this->_params['organization_id'])) {
+ // CRM-15182
+ if (empty($this->_params['org_option']) && empty($this->_params['organization_id'])) {
if (!empty($this->_params['onbehalfof_id'])) {
$this->_params['organization_id'] = $this->_params['onbehalfof_id'];
}
+ else {
+ $this->_params['organization_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_params['onbehalf']['organization_name'], 'id', 'display_name');
+ }
}
$this->_params['organization_name'] = $this->_params['onbehalf']['organization_name'];
$form->assign('locDataURL', $locDataURL);
if (!empty($form->_submitValues['onbehalf'])) {
- $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']);
+ if (!empty($form->_submitValues['onbehalfof_id'])) {
+ $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']);
+ }
$form->assign('submittedOnBehalfInfo', json_encode($form->_submitValues['onbehalf']));
}
}