From: monishdeb Date: Sat, 28 Jun 2014 19:30:04 +0000 (+0530) Subject: CRM-14701 fixes - Form data not retained subsequent to contribution page on behalf... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8d7965a385fc1fad0586c816b7bcd8d0bc18321a;p=civicrm-core.git CRM-14701 fixes - Form data not retained subsequent to contribution page on behalf of fix https://issues.civicrm.org/jira/browse/CRM-14701 --- diff --git a/CRM/Contribute/Form/Contribution/OnBehalfOf.php b/CRM/Contribute/Form/Contribution/OnBehalfOf.php index 38bd4653e6..abc6331eac 100644 --- a/CRM/Contribute/Form/Contribution/OnBehalfOf.php +++ b/CRM/Contribute/Form/Contribution/OnBehalfOf.php @@ -73,7 +73,7 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { 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)) { @@ -93,6 +93,11 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { } $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) { @@ -192,4 +197,3 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { $form->addElement('hidden', 'hidden_onbehalf_profile', 1); } } - diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index cc4d771128..fbd78867b2 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -193,7 +193,17 @@ function setOrgName( ) { } -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({