IDEMPIERE-1389 Size Error in address 1 field

This commit is contained in:
Carlos Ruiz 2013-10-19 08:53:20 -05:00
parent c057d1e7d6
commit 8a8356f753
2 changed files with 18 additions and 1 deletions

View File

@ -49,7 +49,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
/** /**
* *
*/ */
private static final long serialVersionUID = 8332515185354248079L; private static final long serialVersionUID = -2444279957930588863L;
// http://jira.idempiere.com/browse/IDEMPIERE-147 // http://jira.idempiere.com/browse/IDEMPIERE-147
public static String LOCATION_MAPS_URL_PREFIX = MSysConfig.getValue(MSysConfig.LOCATION_MAPS_URL_PREFIX); public static String LOCATION_MAPS_URL_PREFIX = MSysConfig.getValue(MSysConfig.LOCATION_MAPS_URL_PREFIX);
@ -720,4 +720,13 @@ public class MLocation extends X_C_Location implements Comparator<Object>
return address.toString().replace(" ", "+"); 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 } // MLocation

View File

@ -223,16 +223,21 @@ public class WLocationDialog extends Window implements EventListener<Event>
txtAddress1 = new Textbox(); txtAddress1 = new Textbox();
txtAddress1.setCols(20); txtAddress1.setCols(20);
txtAddress1.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address1));
txtAddress2 = new Textbox(); txtAddress2 = new Textbox();
txtAddress2.setCols(20); txtAddress2.setCols(20);
txtAddress2.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address2));
txtAddress3 = new Textbox(); txtAddress3 = new Textbox();
txtAddress3.setCols(20); txtAddress3.setCols(20);
txtAddress3.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address3));
txtAddress4 = new Textbox(); txtAddress4 = new Textbox();
txtAddress4.setCols(20); txtAddress4.setCols(20);
txtAddress4.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address4));
//autocomplete City //autocomplete City
txtCity = new WAutoCompleterCity(m_WindowNo); txtCity = new WAutoCompleterCity(m_WindowNo);
txtCity.setCols(20); txtCity.setCols(20);
txtCity.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_City));
txtCity.setAutodrop(true); txtCity.setAutodrop(true);
txtCity.setAutocomplete(true); txtCity.setAutocomplete(true);
txtCity.addEventListener(Events.ON_CHANGING, this); txtCity.addEventListener(Events.ON_CHANGING, this);
@ -240,8 +245,10 @@ public class WLocationDialog extends Window implements EventListener<Event>
txtPostal = new Textbox(); txtPostal = new Textbox();
txtPostal.setCols(20); txtPostal.setCols(20);
txtPostal.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Postal));
txtPostalAdd = new Textbox(); txtPostalAdd = new Textbox();
txtPostalAdd.setCols(20); txtPostalAdd.setCols(20);
txtPostalAdd.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Postal_Add));
lstRegion = new Listbox(); lstRegion = new Listbox();
lstRegion.setMold("select"); lstRegion.setMold("select");
@ -708,6 +715,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
m_location.setC_City_ID(txtCity.getC_City_ID()); m_location.setC_City_ID(txtCity.getC_City_ID());
m_location.setCity(txtCity.getValue()); m_location.setCity(txtCity.getValue());
m_location.setPostal(txtPostal.getValue()); m_location.setPostal(txtPostal.getValue());
m_location.setPostal_Add(txtPostalAdd.getValue());
// Country/Region // Country/Region
MCountry country = (MCountry)lstCountry.getSelectedItem().getValue(); MCountry country = (MCountry)lstCountry.getSelectedItem().getValue();
m_location.setCountry(country); m_location.setCountry(country);