In the WebUI of metasfresh, addresses of business partners can be recorded in the record tab “Location” at the bottom of each entry in the “Business Partner” window.
This system configuration allows you to control which address fields are shown in the address modal overlay.
The following code reference will help you locate the related system configuration entries:
de.metas.ui.web.address.AddressDescriptorFactory#SYSCONFIG_PREFIX
The SQL to find the sysconfig
entries is:
select name,value from ad_Sysconfig where name like 'de.metas.ui.web.address.AddressDescriptorFactory%.IsDisplay';
The following SQL select statement will return the german translations of the queried address fields:
select e.ad_element_id, ad_language,columnname,e.name,e.printname, etrl.name,etrl.printname from ad_element e
join ad_element_trl etrl on etrl.ad_element_id = e.ad_element_id
where columnname ilike 'address%'
and ad_language='de_DE'
order by ad_language,e.name;
address5
is our new address field, first you need to add a new entry into ad_element
:c_location
:ad_sysconfig
:After that you can run Generate Model
to create the models for the I_C_Location
and X_C_Location
.
Afterwards relocate to de.metas.ui.web.address.AddressDescriptorFactory#createAddressEntityDescriptor
and add this to the function:
addressDescriptor.addField(buildFieldDescriptor(IAddressModel.COLUMNNAME_Address5)
.setValueClass(String.class)
.setWidgetType(DocumentFieldWidgetType.Text)
.setDisplayLogic(getSysConfigDisplayValue(IAddressModel.COLUMNNAME_Address5))
.setDataBinding(new AddressFieldBinding(IAddressModel.COLUMNNAME_Address5, false, I_C_Location::getAddress5, AddressFieldBinding::writeValue_Address4)));
de.metas.ui.web.address.IAddressModel#IAddressModel
and insert this code://@formatter:off
String COLUMNNAME_Address5 = "Address5";
String getAddress5();
void setAddress5(String address);
//@formatter:on