IDEMPIERE-2229 CSV export/import not working on tables with ad_ref_list / integrate patch from Claudemir Todo Bom (allgood)

* improve exporter not taking into account customized fields shown in grid when displaygrid=N
* improve the importer to allow zero ID for tables having record ID=0
* FileImportAction showing tip instead of message
This commit is contained in:
Carlos Ruiz 2015-02-02 18:37:33 -05:00
parent bfc00ae6a8
commit a75477d81d
3 changed files with 16 additions and 17 deletions

View File

@ -463,11 +463,10 @@ public class GridTabCSVExporter implements IGridTabExporter
if (DisplayType.isLookup(column.getAD_Reference_ID())) {
// resolve to identifier - search for value first, if not search for name - if not use the ID
String foreignTable = column.getReferenceTableName();
if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable))) {
if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))) {
MTable fTable = MTable.get(Env.getCtx(), foreignTable);
// Hardcoded / do not check for Value on AD_Org, AD_User and AD_Ref_List, must use name for these two tables
if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))
&& fTable.getColumn("Value") != null) {
if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) {
name.append("[Value]"); // fully qualified
} else if (fTable.getColumn("Name") != null) {
name.append("[Name]");
@ -540,17 +539,17 @@ public class GridTabCSVExporter implements IGridTabExporter
int AD_Field_ID = Integer.parseInt(fieldIdStr);
for (GridField gridField : tmpFields)
{
if ( gridField.isVirtualColumn()
|| gridField.isEncrypted()
|| gridField.isEncryptedColumn()
|| !(gridField.isDisplayed() || gridField.isDisplayedGrid()))
continue;
if (gridField.getAD_Field_ID() == AD_Field_ID)
{
if (!gridField.isReadOnly() && gridField.isDisplayedGrid() && !(DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID()))
fieldList.add(gridField);
if (gridField.getAD_Field_ID() == AD_Field_ID) {
if ( gridField.isVirtualColumn()
|| gridField.isEncrypted()
|| gridField.isEncryptedColumn()
|| !(gridField.isDisplayed() || gridField.isDisplayedGrid())
|| gridField.isReadOnly()
|| (DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID())
)
continue;
fieldList.add(gridField);
break;
}
}

View File

@ -866,7 +866,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if(value == null)
continue;
if(columnName.endsWith("_ID") && "0".equals(value))
if (columnName.endsWith("_ID") && "0".equals(value) && ! MTable.isZeroIDTable(gridTab.getTableName()))
continue;
boolean isKeyColumn= columnName.indexOf("/") > 0;

View File

@ -185,13 +185,13 @@ public class FileImportAction implements EventListener<Event>
Row row = new Row();
rows.appendChild(row);
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType")));
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType", true)));
row.appendChild(cboType);
cboType.setHflex("1");
row = new Row();
rows.appendChild(row);
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "Charset", false) + ": "));
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "Charset", true) + ": "));
fCharset.setMold("select");
fCharset.setRows(0);
fCharset.setTooltiptext(Msg.getMsg(Env.getCtx(), "Charset", false));