IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) (#2042)

- Fix issue with 2Pack reported by Hiep
This commit is contained in:
Carlos Ruiz 2023-10-07 03:28:18 +02:00 committed by GitHub
parent 64b9415ded
commit e1202b37e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -13,6 +13,7 @@ import org.compiere.model.I_AD_Org;
import org.compiere.model.MArchive; import org.compiere.model.MArchive;
import org.compiere.model.MAttachment; import org.compiere.model.MAttachment;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MColumn;
import org.compiere.model.MImage; import org.compiere.model.MImage;
import org.compiere.model.MStorageProvider; import org.compiere.model.MStorageProvider;
import org.compiere.model.MTable; import org.compiere.model.MTable;
@ -270,6 +271,7 @@ public class PoExporter {
} }
int displayType = info.getColumnDisplayType(i); int displayType = info.getColumnDisplayType(i);
String trxName = ctx.trx == null ? null : ctx.trx.getTrxName();
if (DisplayType.YesNo == displayType) { if (DisplayType.YesNo == displayType) {
add(columnName, false, new AttributesImpl()); add(columnName, false, new AttributesImpl());
} else if (DisplayType.TableDir == displayType || DisplayType.ID == displayType) { } else if (DisplayType.TableDir == displayType || DisplayType.ID == displayType) {
@ -277,17 +279,18 @@ public class PoExporter {
if (("Record_ID".equalsIgnoreCase(columnName) || "Record_UU".equalsIgnoreCase(columnName)) && po.get_ColumnIndex("AD_Table_ID") >= 0) { if (("Record_ID".equalsIgnoreCase(columnName) || "Record_UU".equalsIgnoreCase(columnName)) && po.get_ColumnIndex("AD_Table_ID") >= 0) {
int AD_Table_ID = po.get_ValueAsInt("AD_Table_ID"); int AD_Table_ID = po.get_ValueAsInt("AD_Table_ID");
if (AD_Table_ID > 0) if (AD_Table_ID > 0)
tableName = MTable.get(ctx.ctx, AD_Table_ID, ctx.trx.getTrxName()).getTableName(); tableName = MTable.get(ctx.ctx, AD_Table_ID, trxName).getTableName();
} else if (po.get_TableName().equals("AD_TreeNode") && columnName.equals("Parent_ID")) { } else if (po.get_TableName().equals("AD_TreeNode") && columnName.equals("Parent_ID")) {
int AD_Tree_ID = po.get_ValueAsInt("AD_Tree_ID"); int AD_Tree_ID = po.get_ValueAsInt("AD_Tree_ID");
MTree tree = new MTree(ctx.ctx, AD_Tree_ID, ctx.trx.getTrxName()); MTree tree = new MTree(ctx.ctx, AD_Tree_ID, trxName);
tableName = tree.getSourceTableName(true); tableName = tree.getSourceTableName(true);
} else if (po.get_TableName().equals("AD_TreeNode") && columnName.equals("Node_ID")) { } else if (po.get_TableName().equals("AD_TreeNode") && columnName.equals("Node_ID")) {
int AD_Tree_ID = po.get_ValueAsInt("AD_Tree_ID"); int AD_Tree_ID = po.get_ValueAsInt("AD_Tree_ID");
MTree tree = new MTree(ctx.ctx, AD_Tree_ID, ctx.trx.getTrxName()); MTree tree = new MTree(ctx.ctx, AD_Tree_ID, trxName);
tableName = tree.getSourceTableName(true); tableName = tree.getSourceTableName(true);
} else { } else {
tableName = columnName.substring(0, columnName.length() - 3); MColumn column = MColumn.get(ctx.ctx, info.getTableName(), columnName, trxName);
tableName = column.getReferenceTableName();
} }
addTableReference(columnName, tableName, new AttributesImpl()); addTableReference(columnName, tableName, new AttributesImpl());
} else if (DisplayType.isList(displayType)) { } else if (DisplayType.isList(displayType)) {
@ -297,7 +300,7 @@ public class PoExporter {
if (("Record_ID".equalsIgnoreCase(columnName) || "Record_UU".equalsIgnoreCase(columnName)) && po.get_ColumnIndex("AD_Table_ID") >= 0) { if (("Record_ID".equalsIgnoreCase(columnName) || "Record_UU".equalsIgnoreCase(columnName)) && po.get_ColumnIndex("AD_Table_ID") >= 0) {
int AD_Table_ID = po.get_ValueAsInt("AD_Table_ID"); int AD_Table_ID = po.get_ValueAsInt("AD_Table_ID");
if (AD_Table_ID > 0) if (AD_Table_ID > 0)
tableName = MTable.get(ctx.ctx, AD_Table_ID, ctx.trx.getTrxName()).getTableName(); tableName = MTable.get(ctx.ctx, AD_Table_ID, trxName).getTableName();
} else if (info.getColumnLookup(i) != null){ } else if (info.getColumnLookup(i) != null){
String lookupColumn = info.getColumnLookup(i).getColumnName(); String lookupColumn = info.getColumnLookup(i).getColumnName();
tableName = lookupColumn.substring(0, lookupColumn.indexOf(".")); tableName = lookupColumn.substring(0, lookupColumn.indexOf("."));