if (!empty($form->_membershipContactID) && $contactID != $form->_membershipContactID) {
// renewal case - membership being renewed may or may not be for organization
if (!empty($form->_employers) && array_key_exists($form->_membershipContactID, $form->_employers)) {
- // if _membershipContactID belongs to employers list, we can say:
+ // if _membershipContactID belongs to employers list, we can say:
$form->_relatedOrganizationFound = TRUE;
}
} else if (!empty($form->_employers)) {
}
$locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', $args, FALSE, NULL, FALSE);
$form->assign('locDataURL', $locDataURL);
+
+ if (!empty($form->_submitValues['onbehalf'])) {
+ $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']);
+ $form->assign('submittedOnBehalfInfo', json_encode($form->_submitValues['onbehalf']));
+ }
}
if ($form->_values['is_for_organization'] != 2) {
$form->addElement('hidden', 'hidden_onbehalf_profile', 1);
}
}
-
}
-function setLocationDetails(contactID) {
+function setLocationDetails(contactID , reset) {
+ var submittedCID = {/literal}"{$submittedOnBehalf}"{literal};
+ var submittedOnBehalfInfo = {/literal}'{$submittedOnBehalfInfo}'{literal};
+ submittedOnBehalfInfo = cj.parseJSON(submittedOnBehalfInfo);
+ if (submittedCID == contactID) {
+ cj.each(submittedOnBehalfInfo, function(key, value) {
+ cj('#onbehalf_' + key ).val(value);
+ });
+ return;
+ }
+
resetValues();
var locationUrl = {/literal}"{$locDataURL}"{literal} + contactID + "&ufId=" + {/literal}"{$profileId}"{literal};
cj.ajax({