From: Coleman Watts Date: Thu, 1 May 2014 18:40:19 +0000 (-0700) Subject: Contribution Pages - Change employer from autocomplete to select X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ca5bbc711208c8339fd5a1f5825df2fa524c7512;p=civicrm-core.git Contribution Pages - Change employer from autocomplete to select --- diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index ddc6f2907c..90fc183330 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -340,25 +340,6 @@ class CRM_Contact_Page_AJAX { CRM_Utils_System::civiExit(); } - /** - * Function to obtain list of permissioned employer for the given contact-id. - */ - static function getPermissionedEmployer() { - $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer'); - $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String')); - $name = str_replace('*', '%', $name); - - $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name); - - if (!empty($elements)) { - foreach ($elements as $cid => $name) { - echo $element = $name['name'] . "|$cid\n"; - } - } - CRM_Utils_System::civiExit(); - } - - static function groupTree() { $gids = CRM_Utils_Type::escape($_GET['gids'], 'String'); echo CRM_Contact_BAO_GroupNestingCache::json($gids); diff --git a/CRM/Contribute/Form/Contribution/OnBehalfOf.php b/CRM/Contribute/Form/Contribution/OnBehalfOf.php index 9218596500..bde0340157 100644 --- a/CRM/Contribute/Form/Contribution/OnBehalfOf.php +++ b/CRM/Contribute/Form/Contribution/OnBehalfOf.php @@ -84,9 +84,6 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { if ($form->_relatedOrganizationFound) { $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', 'cid=', FALSE, NULL, FALSE); $form->assign('locDataURL', $locDataURL); - - $dataURL = CRM_Utils_System::url('civicrm/ajax/employer', 'cid=' . $contactID, FALSE, NULL, FALSE); - $form->assign('employerDataURL', $dataURL); } if ($form->_values['is_for_organization'] != 2) { @@ -125,7 +122,11 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { if ($contactID && count($form->_employers) >= 1) { $form->add('text', 'organization_id', ts('Select an existing related Organization OR enter a new one')); - $form->add('hidden', 'onbehalfof_id', '', array('id' => 'onbehalfof_id')); + $employers = array(); + foreach ($form->_employers as $id => $vals) { + $employers[$id] = $vals['name']; + } + $form->add('select', 'onbehalfof_id', 'onbehalfof_id', $employers); $orgOptions = array(0 => ts('Select an existing organization'), 1 => ts('Enter a new organization'), diff --git a/CRM/Contribute/xml/Menu/Contribute.xml b/CRM/Contribute/xml/Menu/Contribute.xml index 102e4fdbbf..390cd1586f 100644 --- a/CRM/Contribute/xml/Menu/Contribute.xml +++ b/CRM/Contribute/xml/Menu/Contribute.xml @@ -209,11 +209,6 @@ CRM_Core_Page_AJAX_Location::getPermissionedLocation make online contributions - - civicrm/ajax/employer - CRM_Contact_Page_AJAX::getPermissionedEmployer - make online contributions - civicrm/contribute/unsubscribe Cancel Subscription diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index b6ec06bf92..a3661bcea9 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -104,10 +104,10 @@ {else}
{$form.onbehalf.$fieldName.label}
- {$form.onbehalf.$fieldName.html} - {if $fieldName eq 'organization_name'} -
{ts}Start typing the name of an organization that you have saved previously to use it again. Otherwise click "Enter a new organization" above.{/ts}
+ {if $fieldName eq 'organization_name' and !empty($form.onbehalfof_id)} + {$form.onbehalfof_id.html} {/if} + {$form.onbehalf.$fieldName.html} {if !empty($onBehalfOfFields.$fieldName.html_type) && $onBehalfOfFields.$fieldName.html_type eq 'Autocomplete-Select'} {assign var=elementName value=onbehalf[$fieldName]} {include file="CRM/Custom/Form/AutoComplete.tpl" element_name=$elementName} @@ -134,7 +134,6 @@ {if empty($snippet)} {literal}