From 66aa3a9f6854a8540029d76bc513b6748c7b6c11 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 14 Feb 2014 20:57:00 -0800 Subject: [PATCH] CRM-13929 Refactor current employer field --- CRM/Contact/Form/Edit/Individual.php | 11 +-- .../CRM/Contact/Form/CurrentEmployer.tpl | 81 ------------------- .../CRM/Contact/Form/Edit/Individual.tpl | 7 +- .../CRM/Contact/Form/Inline/ContactInfo.tpl | 9 +-- 4 files changed, 10 insertions(+), 98 deletions(-) delete mode 100644 templates/CRM/Contact/Form/CurrentEmployer.tpl diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index 00c6351e8a..067b7f6de6 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -106,11 +106,12 @@ class CRM_Contact_Form_Edit_Individual { $form->addElement('text', 'job_title', ts('Job Title'), $attributes['job_title'], 'size="30"'); //Current Employer Element - $employerDataURL = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&employee_id=' . $form->_contactId, FALSE, NULL, FALSE); - $form->assign('employerDataURL', $employerDataURL); - - $form->addElement('text', 'current_employer', ts('Current Employer'), ''); - $form->addElement('hidden', 'current_employer_id', '', array('id' => 'current_employer_id')); + $props = array( + '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)); } diff --git a/templates/CRM/Contact/Form/CurrentEmployer.tpl b/templates/CRM/Contact/Form/CurrentEmployer.tpl deleted file mode 100644 index 4eebcb5327..0000000000 --- a/templates/CRM/Contact/Form/CurrentEmployer.tpl +++ /dev/null @@ -1,81 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.4 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} -{* tpl for current employer js *} -{literal} - -{/literal} diff --git a/templates/CRM/Contact/Form/Edit/Individual.tpl b/templates/CRM/Contact/Form/Edit/Individual.tpl index add9e30811..c08c27c20a 100644 --- a/templates/CRM/Contact/Form/Edit/Individual.tpl +++ b/templates/CRM/Contact/Form/Edit/Individual.tpl @@ -120,9 +120,8 @@ cj(function($) { - {$form.current_employer.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}
- {$form.current_employer.html|crmAddClass:twenty} - + {$form.employer_id.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}
+ {$form.employer_id.html} {$form.job_title.label}
@@ -140,5 +139,3 @@ cj(function($) { - -{include file="CRM/Contact/Form/CurrentEmployer.tpl"} diff --git a/templates/CRM/Contact/Form/Inline/ContactInfo.tpl b/templates/CRM/Contact/Form/Inline/ContactInfo.tpl index 04980fc742..233c1f669c 100644 --- a/templates/CRM/Contact/Form/Inline/ContactInfo.tpl +++ b/templates/CRM/Contact/Form/Inline/ContactInfo.tpl @@ -32,10 +32,9 @@
{if $contactType eq 'Individual'}
-
{$form.current_employer.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}
+
{$form.employer_id.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}
- {$form.current_employer.html} - + {$form.employer_id.html|crmAddClass:big}
@@ -63,7 +62,3 @@
- -{if $contactType eq 'Individual'} - {include file="CRM/Contact/Form/CurrentEmployer.tpl"} -{/if} -- 2.25.1