From a75477d81db1591e3fa4f4ac18f29b9dd53c9966 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 2 Feb 2015 18:37:33 -0500 Subject: [PATCH] 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 --- .../adempiere/impexp/GridTabCSVExporter.java | 27 +++++++++---------- .../adempiere/impexp/GridTabCSVImporter.java | 2 +- .../webui/panel/action/FileImportAction.java | 4 +-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index 86b86425bc..d0bf8d3c8c 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -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; } } diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 04c0deb397..5314bbdb48 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -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; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java index 5ebfb85a30..f0ebe7ccef 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java @@ -185,13 +185,13 @@ public class FileImportAction implements EventListener 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));