IDEMPIERE-4639 Cross tenant issues with context help (#1848)
This commit is contained in:
parent
c05d2cefa9
commit
531aa73ea1
|
@ -113,7 +113,7 @@ public abstract class PO
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1672197562752270736L;
|
||||
private static final long serialVersionUID = -7758079724744033518L;
|
||||
|
||||
/* String key to create a new record based in UUID constructor */
|
||||
public static final String UUID_NEW_RECORD = "";
|
||||
|
@ -2587,6 +2587,21 @@ public abstract class PO
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Value or create new record, used when writing a cross tenant record
|
||||
* @param trxName transaction
|
||||
* @throws AdempiereException
|
||||
* @see #saveEx(String)
|
||||
*/
|
||||
public void saveCrossTenantSafeEx() {
|
||||
try {
|
||||
PO.setCrossTenantSafe();
|
||||
saveEx();
|
||||
} finally {
|
||||
PO.clearCrossTenantSafe();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish Save Process
|
||||
* @param newRecord new
|
||||
|
@ -2704,6 +2719,21 @@ public abstract class PO
|
|||
saveEx();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Value or create new record, used when writing a cross tenant record
|
||||
* @param trxName transaction
|
||||
* @throws AdempiereException
|
||||
* @see #saveEx(String)
|
||||
*/
|
||||
public void saveCrossTenantSafeEx(String trxName) {
|
||||
try {
|
||||
PO.setCrossTenantSafe();
|
||||
saveEx(trxName);
|
||||
} finally {
|
||||
PO.clearCrossTenantSafe();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Value or create new record.
|
||||
* @param trxName transaction
|
||||
|
|
|
@ -209,8 +209,6 @@ 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);
|
||||
|
@ -221,7 +219,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
|||
MCtxHelp ctxHelp = new MCtxHelp(Env.getCtx(), 0, trx.getTrxName());
|
||||
setContextHelpInfo(po, ctxHelp);
|
||||
ctxHelp.setClientOrg(0, 0);
|
||||
ctxHelp.saveEx();
|
||||
ctxHelp.saveCrossTenantSafeEx();
|
||||
|
||||
if (po != null) {
|
||||
if (po.is_Immutable()) {
|
||||
|
@ -229,11 +227,11 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
|||
MTable table = MTable.get(po.get_Table_ID());
|
||||
PO mutablePO = table.getPO(po.get_ID(), trx.getTrxName());
|
||||
mutablePO.set_ValueOfColumn("AD_CtxHelp_ID", ctxHelp.getAD_CtxHelp_ID());
|
||||
mutablePO.saveEx(trx.getTrxName());
|
||||
mutablePO.saveCrossTenantSafeEx(trx.getTrxName());
|
||||
po.load(trx.getTrxName());
|
||||
} else {
|
||||
po.set_ValueOfColumn("AD_CtxHelp_ID", ctxHelp.getAD_CtxHelp_ID());
|
||||
po.saveEx(trx.getTrxName());
|
||||
po.saveCrossTenantSafeEx(trx.getTrxName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +240,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
|||
msg.setAD_CtxHelp_ID(ctxHelp.getAD_CtxHelp_ID());
|
||||
msg.setClientOrg(0, 0);
|
||||
msg.setMsgText(baseContent);
|
||||
msg.saveEx();
|
||||
msg.saveCrossTenantSafeEx();
|
||||
suggestion.setAD_CtxHelpMsg_ID(msg.getAD_CtxHelpMsg_ID());
|
||||
if (!Util.isEmpty(translatedContent) && !Env.isBaseLanguage(Env.getCtx(), I_AD_CtxHelpMsg.Table_Name)) {
|
||||
int id = DB.getSQLValueEx(trx.getTrxName(), "SELECT AD_CtxHelpMsg_ID FROM AD_CtxHelpMsg_Trl WHERE AD_CtxHelpMsg_ID=? AND AD_Client_ID=? " +
|
||||
|
@ -280,10 +278,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
|||
suggestion.setMsgText(helpTextbox.getValue());
|
||||
suggestion.setIsSaveAsTenantCustomization(false);
|
||||
|
||||
suggestion.saveEx();
|
||||
} finally {
|
||||
PO.clearCrossTenantSafe();
|
||||
}
|
||||
suggestion.saveCrossTenantSafeEx();
|
||||
}
|
||||
this.detach();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue