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())) { if (DisplayType.isLookup(column.getAD_Reference_ID())) {
// resolve to identifier - search for value first, if not search for name - if not use the ID // resolve to identifier - search for value first, if not search for name - if not use the ID
String foreignTable = column.getReferenceTableName(); 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); 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 // 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)) if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) {
&& fTable.getColumn("Value") != null) {
name.append("[Value]"); // fully qualified name.append("[Value]"); // fully qualified
} else if (fTable.getColumn("Name") != null) { } else if (fTable.getColumn("Name") != null) {
name.append("[Name]"); name.append("[Name]");
@ -540,17 +539,17 @@ public class GridTabCSVExporter implements IGridTabExporter
int AD_Field_ID = Integer.parseInt(fieldIdStr); int AD_Field_ID = Integer.parseInt(fieldIdStr);
for (GridField gridField : tmpFields) for (GridField gridField : tmpFields)
{ {
if ( gridField.isVirtualColumn() if (gridField.getAD_Field_ID() == AD_Field_ID) {
|| gridField.isEncrypted() if ( gridField.isVirtualColumn()
|| gridField.isEncryptedColumn() || gridField.isEncrypted()
|| !(gridField.isDisplayed() || gridField.isDisplayedGrid())) || gridField.isEncryptedColumn()
continue; || !(gridField.isDisplayed() || gridField.isDisplayedGrid())
|| gridField.isReadOnly()
if (gridField.getAD_Field_ID() == AD_Field_ID) || (DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID())
{ )
if (!gridField.isReadOnly() && gridField.isDisplayedGrid() && !(DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID())) continue;
fieldList.add(gridField);
fieldList.add(gridField);
break; break;
} }
} }

View File

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

View File

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