From 253baf654d7f5bcaf854d07edc4b6d4de8467700 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 25 Feb 2014 10:53:31 -0500 Subject: [PATCH] CRM-13966 - Refactor autocomplete from financial acct form --- CRM/Financial/Form/FinancialAccount.php | 9 +--- .../CRM/Financial/Form/FinancialAccount.tpl | 44 +------------------ 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/CRM/Financial/Form/FinancialAccount.php b/CRM/Financial/Form/FinancialAccount.php index 84d60c285f..923f0e0d3e 100644 --- a/CRM/Financial/Form/FinancialAccount.php +++ b/CRM/Financial/Form/FinancialAccount.php @@ -87,9 +87,6 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { */ public function buildQuickForm( ) { parent::buildQuickForm( ); - $dataURL = CRM_Utils_System::url('civicrm/ajax/rest', - 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1', FALSE, NULL, FALSE); - $this->assign('dataURL', $dataURL); if ($this->_action & CRM_Core_Action::DELETE) { return; @@ -104,8 +101,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { $this->add('text', 'description', ts('Description'), $attributes['description']); $this->add('text', 'accounting_code', ts('Accounting Code'), $attributes['accounting_code']); $elementAccounting = $this->add('text', 'account_type_code', ts('Account Type Code'), $attributes['account_type_code']); - $this->add('text', 'contact_name', ts('Owner'), $attributes['name']); - $this->add('hidden', 'contact_id', '', array('id' => 'contact_id')); + $this->addEntityRef('contact_id', ts('Owner'), array('api' => array('params' => array('contact_type' => 'Organization')), 'create' => TRUE)); $this->add('text', 'tax_rate', ts('Tax Rate'), $attributes['tax_rate']); $this->add('checkbox', 'is_deductible', ts('Tax-Deductible?')); $elementActive = $this->add('checkbox', 'is_active', ts('Enabled?')); @@ -166,7 +162,6 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { $defaults = parent::setDefaultValues(); if ($this->_action & CRM_Core_Action::ADD) { $defaults['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', CRM_Core_Config::domainID(), 'contact_id'); - $defaults['contact_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $defaults['contact_id'], 'sort_name'); } return $defaults; } @@ -196,5 +191,3 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { } } } - - diff --git a/templates/CRM/Financial/Form/FinancialAccount.tpl b/templates/CRM/Financial/Form/FinancialAccount.tpl index 1defdc6d69..e4d06183a9 100644 --- a/templates/CRM/Financial/Form/FinancialAccount.tpl +++ b/templates/CRM/Financial/Form/FinancialAccount.tpl @@ -43,8 +43,8 @@ {$form.description.html} - {$form.contact_name.label} {help id="id-financial-owner" file="CRM/Contact/Form/Contact.hlp"} - {$form.contact_name.html|crmReplace:class:twenty}
+ {$form.contact_id.label} {help id="id-financial-owner" file="CRM/Contact/Form/Contact.hlp"} + {$form.contact_id.html}
{ts}Use this field to indicate the organization that owns this account.{/ts} @@ -96,43 +96,3 @@ {/if}
{include file="CRM/common/formButtons.tpl" location="botttom"}
- -{literal} - -{/literal} -- 2.25.1