I have successfully added a custom enum field to address group (both billing and shipping to both accounts and AOS_Quotes).
The steps were these:
- Added /custom/Extension/modules/Accounts/Ext/Vardefs/campos_address_custom.php and /custom/Extension/modules/AOS_Quotes/Ext/Vardefs/sugarfield_AOS_Quotes_address_custom.php
with the following content:
$dictionary['Account']['fields']['billing_address_comuna']['type'] = 'enum';
$dictionary['Account']['fields']['billing_address_comuna']['options'] = 'comunas_dom';
$dictionary['Account']['fields']['shipping_address_comuna']['type'] = 'enum';
$dictionary['Account']['fields']['shipping_address_comuna']['options'] = 'comunas_dom';
$dictionary['Account']['fields']['billing_address_state']['type'] = 'enum';
$dictionary['Account']['fields']['billing_address_state']['options'] = 'comunas_dom';
$dictionary['Account']['fields']['shipping_address_state']['type'] = 'enum';
$dictionary['Account']['fields']['shipping_address_state']['options'] = 'comunas_dom';
$dictionary['Account']['fields']['billing_address_country']['type'] = 'enum';
$dictionary['Account']['fields']['billing_address_country']['options'] = 'countries_dom';
$dictionary['Account']['fields']['shipping_address_country']['type'] = 'enum';
$dictionary['Account']['fields']['shipping_address_country']['options'] = 'countries_dom';
- in /custom/include/language/*.lang.php files added:
$GLOBALS['app_list_strings']['cstm_comuna_list'] = Array (
'' => '',
'LAS CONDES' => 'LAS CONDES',
'PROVIDENCIA' => 'PROVIDENCIA',
'LA REINA' => 'LA REINA', (....etc)
$GLOBALS['app_list_strings']['cstm_states_list'] = Array (
'' => '',
'MAULE' => 'MAULE',
'SANTIAGO METROPOLITANA' => 'SANTIAGO METROPOLITANA', (...etc)
countries_dom is already defined in Suite/Sugar.
- Created a new field class in:
/custom/include/SugarFields/Fields/NuevaAddress
copying files from /include/SugarFields/Fields/Address. These files are basically:
- DetailView.tpl
- EditView.tpl
- SugarFieldAddress.js
- SugarFieldAddress.php
and there is another one that did not see before: en_us.DetailView.tpl and en_us.EditView.tpl
There, in EditView, I changed the “input” to fields by “selects”.
- in /custom/modules/Accounts(and AOS_Quotes/metadata/editviewdefs.php, changed the type of billing_address_street and shipping_address_street from “Address” to “NuevaAddress”.
Everything working normal for both modules, except for the checkbox that made the copy from left to right address. So to the steps, I added a replacement of basically all references from “Address” to “NuevaAddress”, including changes like for example: “class SugarFieldAddress extends SugarFieldBase {” to “class SugarFieldNuevaAddress extends SugarFieldBase {”, renamed files SugarFieldAddress.php and SugarFieldAddress.js to “NuevaAddress”. This solved the copy from left to right issue.
The problem is, that when I am creating a new quotation, the new field “comuna” is not brought from Account to AOS_Quotes.
I have also modified a function called call_back_function, to include billing_address_comuna, did not work.
Hope you have suggestions.