From b58770ea7f5841d2b2e8b697aa4d897eeebdd337 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Wed, 25 Mar 2015 09:17:46 +0100 Subject: [PATCH] added support for autocomplete select and entityref, converted contact_source, employer_id and external_identifier to use AddField --- CRM/Contact/Form/Edit/Individual.php | 9 +++------ CRM/Core/Form.php | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index 36c4266409..32613f0be2 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -108,9 +108,8 @@ class CRM_Contact_Form_Edit_Individual { 'api' => array('params' => array('contact_type' => 'Organization')), 'create' => TRUE, ); - $form->addEntityRef('employer_id', ts('Current Employer'), $props); - $attributes['source']['class'] = 'big'; - $form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes)); + $form->addField('employer_id', $props); + $form->addField('contact_source', array('class' => 'big')); } if (!$inlineEditMode) { @@ -126,9 +125,7 @@ class CRM_Contact_Form_Edit_Individual { $form->assign('checkSimilar', $checkSimilar); //External Identifier Element - $form->add('text', 'external_identifier', ts('External ID'), - CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'), FALSE - ); + $form->addField('external_identifier', $attributes['external_identifier'] + array('label' => 'External ID')); $form->addRule('external_identifier', ts('External ID already exists in Database.'), diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 967c30154e..29ecb9b824 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1226,7 +1226,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page { //case 'Select Date': //TODO: Add date formats //TODO: Add javascript template for dates. - // case 'Radio': case 'Select': if (empty($props['multiple'])) { @@ -1241,7 +1240,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page { //case 'File': //case 'RichTextEditor': //TODO: Add javascript template for wysiwyg. - //case 'Autocomplete-Select': + case 'Autocomplete-Select': + case 'EntityRef': + $this->addEntityRef($name, $label, $props); + break; + // Check datatypes of fields // case 'Int': //case 'Float': -- 2.25.1