IDEMPIERE-3218 Cross-tenant error when importing web service security records / fix problem when importing attachments because of Record_ID column
This commit is contained in:
parent
90b40ac9ec
commit
817cd5fd65
|
@ -806,6 +806,12 @@ public class MColumn extends X_AD_Column
|
|||
foreignTable = rt.getAD_Table().getTableName();
|
||||
}
|
||||
}
|
||||
} else if (DisplayType.Button == refid) {
|
||||
// C_BPartner.AD_OrgBP_ID and C_Project.C_ProjectType_ID are defined as buttons
|
||||
if ("AD_OrgBP_ID".equalsIgnoreCase(getColumnName()))
|
||||
foreignTable = "AD_Org";
|
||||
else if ("C_ProjectType_ID".equalsIgnoreCase(getColumnName()))
|
||||
foreignTable = "C_ProjectType";
|
||||
} else if (DisplayType.List == refid || DisplayType.Payment == refid) {
|
||||
foreignTable = "AD_Ref_List";
|
||||
} else if (DisplayType.Location == refid) {
|
||||
|
|
|
@ -183,11 +183,25 @@ public class PoFiller{
|
|||
}
|
||||
if (po.get_ColumnIndex(columnName) >= 0) {
|
||||
MColumn col = MColumn.get(ctx.ctx, po.get_TableName(), columnName);
|
||||
MTable foreignTable = null;
|
||||
String refTableName = col.getReferenceTableName();
|
||||
if (id > 0) {
|
||||
MTable foreignTable = MTable.get(Env.getCtx(), refTableName);
|
||||
if (refTableName != null) {
|
||||
foreignTable = MTable.get(Env.getCtx(), refTableName);
|
||||
} else {
|
||||
if ("Record_ID".equalsIgnoreCase(columnName)) {
|
||||
// special case - get the foreign table using column AD_Table_ID
|
||||
int idxTableID = po.get_ColumnIndex("AD_Table_ID");
|
||||
if (idxTableID >= 0) {
|
||||
int tableID = po.get_ValueAsInt(idxTableID);
|
||||
foreignTable = MTable.get(Env.getCtx(), tableID);
|
||||
refTableName = foreignTable.getTableName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id > 0 && refTableName != null) {
|
||||
if (foreignTable != null) {
|
||||
PO subPo = foreignTable.getPO(id, po.get_TrxName());
|
||||
if (subPo.getAD_Client_ID() != Env.getAD_Client_ID(ctx.ctx)) {
|
||||
if (subPo != null && subPo.getAD_Client_ID() != Env.getAD_Client_ID(ctx.ctx)) {
|
||||
String accessLevel = foreignTable.getAccessLevel();
|
||||
if ((MTable.ACCESSLEVEL_All.equals(accessLevel)
|
||||
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|
||||
|
@ -195,6 +209,7 @@ public class PoFiller{
|
|||
subPo.getAD_Client_ID() != 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (po.get_ValueAsInt(columnName) != id) {
|
||||
po.set_ValueNoCheck(columnName, id);
|
||||
|
|
Loading…
Reference in New Issue