IDEMPIERE-4639 Cross tenant issues with context help (#522)

This commit is contained in:
Carlos Ruiz 2021-01-12 14:31:40 +01:00 committed by GitHub
parent d96199a2b6
commit 402300a53e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -171,6 +171,7 @@ public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
if (retValue.getAD_Table_ID() == AD_Table_ID
&& retValue.getRecord_ID() == Record_ID
&& retValue.getAD_User_ID() == AD_User_ID
&& retValue.getAD_Client_ID() == Env.getAD_Client_ID(ctx)
&& Env.getAD_Language(ctx).equals(Env.getAD_Language(retValue.getCtx()))
)
{
@ -179,7 +180,7 @@ public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
}
//
MRecentItem retValue = null;
String sql = "SELECT * FROM AD_RecentItem WHERE AD_Table_ID=? AND Record_ID=? AND NVL(AD_User_ID,0)=?";
String sql = "SELECT * FROM AD_RecentItem WHERE AD_Table_ID=? AND Record_ID=? AND NVL(AD_User_ID,0)=? AND AD_Client_ID=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
@ -188,6 +189,7 @@ public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
pstmt.setInt(1, AD_Table_ID);
pstmt.setInt(2, Record_ID);
pstmt.setInt(3, AD_User_ID);
pstmt.setInt(4, Env.getAD_Client_ID(ctx));
rs = pstmt.executeQuery ();
if (rs.next ())
retValue = new MRecentItem (ctx, rs, null);

View File

@ -202,6 +202,9 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
Object[] params = new Object[]{helpTextbox.getValue(), ctxHelpMsg.get_ID(), ctxHelpMsg.getAD_Client_ID(), Env.getAD_Language(Env.getCtx())};
DB.executeUpdateEx(update.toString(), params, trx.getTrxName());
} else {
try {
PO.setCrossTenantSafe();
/* this whole block code is forcefully writing records on System tenant */
MCtxHelpSuggestion suggestion = new MCtxHelpSuggestion(Env.getCtx(), 0, trx.getTrxName());
suggestion.setClientOrg(0, 0);
if (ctxHelpMsg != null) {
@ -261,7 +264,10 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
suggestion.setMsgText(helpTextbox.getValue());
suggestion.setIsSaveAsTenantCustomization(false);
suggestion.saveEx();
suggestion.saveEx();
} finally {
PO.clearCrossTenantSafe();
}
}
this.detach();
}