diff --git a/org.adempiere.base/src/org/compiere/model/MLocation.java b/org.adempiere.base/src/org/compiere/model/MLocation.java index bc189f1dde..bdc1b1d211 100644 --- a/org.adempiere.base/src/org/compiere/model/MLocation.java +++ b/org.adempiere.base/src/org/compiere/model/MLocation.java @@ -49,7 +49,7 @@ public class MLocation extends X_C_Location implements Comparator /** * */ - private static final long serialVersionUID = 8332515185354248079L; + private static final long serialVersionUID = -2444279957930588863L; // http://jira.idempiere.com/browse/IDEMPIERE-147 public static String LOCATION_MAPS_URL_PREFIX = MSysConfig.getValue(MSysConfig.LOCATION_MAPS_URL_PREFIX); @@ -719,5 +719,14 @@ public class MLocation extends X_C_Location implements Comparator return address.toString().replace(" ", "+"); } + + public static int getFieldLength(String columnName) { + MTable loctable = MTable.get(Env.getCtx(), Table_ID); + MColumn column = loctable.getColumn(columnName); + if (column == null) + return -1; + else + return column.getFieldLength(); + } } // MLocation diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index 43ef6850e8..25b4010f4b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -223,16 +223,21 @@ public class WLocationDialog extends Window implements EventListener txtAddress1 = new Textbox(); txtAddress1.setCols(20); + txtAddress1.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address1)); txtAddress2 = new Textbox(); txtAddress2.setCols(20); + txtAddress2.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address2)); txtAddress3 = new Textbox(); txtAddress3.setCols(20); + txtAddress3.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address3)); txtAddress4 = new Textbox(); txtAddress4.setCols(20); + txtAddress4.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address4)); //autocomplete City txtCity = new WAutoCompleterCity(m_WindowNo); txtCity.setCols(20); + txtCity.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_City)); txtCity.setAutodrop(true); txtCity.setAutocomplete(true); txtCity.addEventListener(Events.ON_CHANGING, this); @@ -240,8 +245,10 @@ public class WLocationDialog extends Window implements EventListener txtPostal = new Textbox(); txtPostal.setCols(20); + txtPostal.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Postal)); txtPostalAdd = new Textbox(); txtPostalAdd.setCols(20); + txtPostalAdd.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Postal_Add)); lstRegion = new Listbox(); lstRegion.setMold("select"); @@ -708,6 +715,7 @@ public class WLocationDialog extends Window implements EventListener m_location.setC_City_ID(txtCity.getC_City_ID()); m_location.setCity(txtCity.getValue()); m_location.setPostal(txtPostal.getValue()); + m_location.setPostal_Add(txtPostalAdd.getValue()); // Country/Region MCountry country = (MCountry)lstCountry.getSelectedItem().getValue(); m_location.setCountry(country);