IDEMPIERE-187 Support developer to generate migration script from webui
http://jira.idempiere.com/browse/IDEMPIERE-187
This commit is contained in:
parent
7367d59ef7
commit
3687d3f778
|
@ -39,6 +39,7 @@ import org.compiere.db.Database;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Ini;
|
import org.compiere.util.Ini;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -435,7 +436,13 @@ public abstract class Convert
|
||||||
public static void logMigrationScript(String oraStatement, String pgStatement) {
|
public static void logMigrationScript(String oraStatement, String pgStatement) {
|
||||||
// Check AdempiereSys
|
// Check AdempiereSys
|
||||||
// check property Log migration script
|
// check property Log migration script
|
||||||
boolean logMigrationScript = Ini.isPropertyBool(Ini.P_LOGMIGRATIONSCRIPT);
|
boolean logMigrationScript = false;
|
||||||
|
if (Ini.isClient()) {
|
||||||
|
logMigrationScript = Ini.isPropertyBool(Ini.P_LOGMIGRATIONSCRIPT);
|
||||||
|
} else {
|
||||||
|
String sysProperty = Env.getCtx().getProperty("LogMigrationScript", "N");
|
||||||
|
logMigrationScript = "y".equalsIgnoreCase(sysProperty) || "true".equalsIgnoreCase(sysProperty);
|
||||||
|
}
|
||||||
if (logMigrationScript) {
|
if (logMigrationScript) {
|
||||||
if (dontLog(oraStatement))
|
if (dontLog(oraStatement))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -88,7 +88,17 @@ public class MSequence extends X_AD_Sequence
|
||||||
int retValue = -1;
|
int retValue = -1;
|
||||||
|
|
||||||
// Check AdempiereSys
|
// Check AdempiereSys
|
||||||
boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
boolean adempiereSys = false;
|
||||||
|
if (Ini.isClient())
|
||||||
|
{
|
||||||
|
adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String sysProperty = Env.getCtx().getProperty("AdempiereSys", "N");
|
||||||
|
adempiereSys = "y".equalsIgnoreCase(sysProperty) || "true".equalsIgnoreCase(sysProperty);
|
||||||
|
}
|
||||||
|
|
||||||
if (adempiereSys && AD_Client_ID > 11)
|
if (adempiereSys && AD_Client_ID > 11)
|
||||||
adempiereSys = false;
|
adempiereSys = false;
|
||||||
//
|
//
|
||||||
|
@ -398,7 +408,16 @@ public class MSequence extends X_AD_Sequence
|
||||||
throw new IllegalArgumentException("TableName missing");
|
throw new IllegalArgumentException("TableName missing");
|
||||||
|
|
||||||
// Check AdempiereSys
|
// Check AdempiereSys
|
||||||
boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
boolean adempiereSys = false;
|
||||||
|
if (Ini.isClient())
|
||||||
|
{
|
||||||
|
adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String sysProperty = Env.getCtx().getProperty("AdempiereSys", "N");
|
||||||
|
adempiereSys = "y".equalsIgnoreCase(sysProperty) || "true".equalsIgnoreCase(sysProperty);
|
||||||
|
}
|
||||||
if (adempiereSys && AD_Client_ID > 11)
|
if (adempiereSys && AD_Client_ID > 11)
|
||||||
adempiereSys = false;
|
adempiereSys = false;
|
||||||
//
|
//
|
||||||
|
@ -704,7 +723,16 @@ public class MSequence extends X_AD_Sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check AdempiereSys
|
// Check AdempiereSys
|
||||||
boolean adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
boolean adempiereSys = false;
|
||||||
|
if (Ini.isClient())
|
||||||
|
{
|
||||||
|
adempiereSys = Ini.isPropertyBool(Ini.P_ADEMPIERESYS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String sysProperty = Env.getCtx().getProperty("AdempiereSys", "N");
|
||||||
|
adempiereSys = "y".equalsIgnoreCase(sysProperty) || "true".equalsIgnoreCase(sysProperty);
|
||||||
|
}
|
||||||
if (CLogMgt.isLevel(LOGLEVEL))
|
if (CLogMgt.isLevel(LOGLEVEL))
|
||||||
s_log.log(LOGLEVEL, "DocType_ID=" + C_DocType_ID + " [" + trxName + "]");
|
s_log.log(LOGLEVEL, "DocType_ID=" + C_DocType_ID + " [" + trxName + "]");
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,16 @@ import org.zkoss.zul.Space;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WPreference extends Popup implements EventListener {
|
public class WPreference extends Popup implements EventListener {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -8223456746437563389L;
|
||||||
|
|
||||||
private static final long serialVersionUID = 7163067116469715021L;
|
|
||||||
private WYesNoEditor autoCommit;
|
private WYesNoEditor autoCommit;
|
||||||
private WYesNoEditor autoNew;
|
private WYesNoEditor autoNew;
|
||||||
private WYesNoEditor tabCollapsible;
|
private WYesNoEditor tabCollapsible;
|
||||||
|
private WYesNoEditor adempiereSys;
|
||||||
|
private WYesNoEditor logMigrationScript;
|
||||||
private Listbox tabPlacement;
|
private Listbox tabPlacement;
|
||||||
|
|
||||||
public WPreference() {
|
public WPreference() {
|
||||||
|
@ -88,6 +93,26 @@ public class WPreference extends Popup implements EventListener {
|
||||||
div.appendChild(tabPlacement);
|
div.appendChild(tabPlacement);
|
||||||
this.appendChild(div);
|
this.appendChild(div);
|
||||||
|
|
||||||
|
if (Env.getAD_Client_ID(Env.getCtx()) <= 20 && Env.getAD_User_ID(Env.getCtx()) <= 102) {
|
||||||
|
adempiereSys = new WYesNoEditor("AdempiereSys", Msg.getMsg(Env.getCtx(), "AdempiereSys", true),
|
||||||
|
null, false, false, true);
|
||||||
|
adempiereSys.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AdempiereSys", false));
|
||||||
|
div = new Div();
|
||||||
|
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||||
|
div.appendChild(adempiereSys.getComponent());
|
||||||
|
this.appendChild(div);
|
||||||
|
adempiereSys.setValue(Env.getCtx().getProperty("AdempiereSys"));
|
||||||
|
|
||||||
|
logMigrationScript = new WYesNoEditor("LogMigrationScript", Msg.getMsg(Env.getCtx(), "LogMigrationScript", true),
|
||||||
|
null, false, false, true);
|
||||||
|
logMigrationScript.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "LogMigrationScript", false));
|
||||||
|
div = new Div();
|
||||||
|
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||||
|
div.appendChild(logMigrationScript.getComponent());
|
||||||
|
this.appendChild(div);
|
||||||
|
logMigrationScript.setValue(Env.getCtx().getProperty("LogMigrationScript"));
|
||||||
|
}
|
||||||
|
|
||||||
Separator separator = new Separator();
|
Separator separator = new Separator();
|
||||||
separator.setSpacing("20px");
|
separator.setSpacing("20px");
|
||||||
div = new Div();
|
div = new Div();
|
||||||
|
@ -135,6 +160,12 @@ public class WPreference extends Popup implements EventListener {
|
||||||
Env.setAutoCommit(Env.getCtx(), "y".equalsIgnoreCase(preference.getProperty(UserPreference.P_AUTO_COMMIT)));
|
Env.setAutoCommit(Env.getCtx(), "y".equalsIgnoreCase(preference.getProperty(UserPreference.P_AUTO_COMMIT)));
|
||||||
Env.setAutoNew(Env.getCtx(), "y".equalsIgnoreCase(preference.getProperty(UserPreference.P_AUTO_NEW)));
|
Env.setAutoNew(Env.getCtx(), "y".equalsIgnoreCase(preference.getProperty(UserPreference.P_AUTO_NEW)));
|
||||||
|
|
||||||
|
// Log Migration Script and AdempiereSys are just in-memory preferences, must not be saved
|
||||||
|
if (logMigrationScript != null)
|
||||||
|
Env.getCtx().setProperty("LogMigrationScript", (Boolean)logMigrationScript.getValue() ? "Y" : "N");
|
||||||
|
if (adempiereSys != null)
|
||||||
|
Env.getCtx().setProperty("AdempiereSys", (Boolean)adempiereSys.getValue() ? "Y" : "N");
|
||||||
|
|
||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue