IDEMPIERE-1548 Error import location when no region

This commit is contained in:
Juan David Arboleda 2014-03-19 20:16:56 -05:00
parent 37463c57d4
commit 6e8fbabdfa
1 changed files with 3 additions and 6 deletions

View File

@ -810,9 +810,8 @@ public class GridTabCSVImporter implements IGridTabImporter
if (header.get(i).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID))) if (header.get(i).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID)))
{ {
//without Region or Country any address would be invalid //without Country any address would be invalid
boolean thereIsCountry = false ; boolean thereIsCountry = false ;
boolean thereIsRegion = false;
boolean isEmptyRow = true; boolean isEmptyRow = true;
for(int j= i;j< header.size();j++){ for(int j= i;j< header.size();j++){
if(!header.get(j).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID))) if(!header.get(j).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID)))
@ -826,8 +825,6 @@ public class GridTabCSVImporter implements IGridTabImporter
String columnName = header.get(j); String columnName = header.get(j);
Object value = tmpRow.get(j); Object value = tmpRow.get(j);
if(value!=null){ if(value!=null){
if(columnName.contains("RegionName")||columnName.contains("C_Region_ID"))
thereIsRegion = true;
if(columnName.contains("C_Country_ID")) if(columnName.contains("C_Country_ID"))
thereIsCountry= true; thereIsCountry= true;
}else }else
@ -849,8 +846,8 @@ public class GridTabCSVImporter implements IGridTabImporter
isEmptyRow=false; isEmptyRow=false;
} }
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && (!thereIsRegion || !thereIsCountry)) if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && !thereIsCountry)
return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+(thereIsRegion==true?"Region":"C_Country_ID")+"]"); return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+"C_Country_ID]");
} }
return null; return null;
} }