diff --git a/base/src/org/compiere/acct/Doc.java b/base/src/org/compiere/acct/Doc.java index 4a6dc5d054..2e655d0d76 100644 --- a/base/src/org/compiere/acct/Doc.java +++ b/base/src/org/compiere/acct/Doc.java @@ -28,7 +28,6 @@ import java.util.Iterator; import java.util.Properties; import java.util.logging.Level; -import org.compiere.db.CConnection; import org.compiere.model.MAccount; import org.compiere.model.MAcctSchema; import org.compiere.model.MAllocationHdr; @@ -57,7 +56,6 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; -import org.compiere.util.Ini; import org.compiere.util.Msg; import org.compiere.util.Trx; @@ -375,7 +373,7 @@ public abstract class Doc * @param defaultDocumentType default document type or null * @param trxName trx */ - Doc (MAcctSchema[] ass, Class clazz, ResultSet rs, String defaultDocumentType, String trxName) + Doc (MAcctSchema[] ass, Class clazz, ResultSet rs, String defaultDocumentType, String trxName) { p_Status = STATUS_Error; m_ass = ass; @@ -386,7 +384,7 @@ public abstract class Doc className = className.substring(className.lastIndexOf('.')+1); try { - Constructor constructor = clazz.getConstructor(new Class[]{Properties.class, ResultSet.class, String.class}); + Constructor constructor = clazz.getConstructor(new Class[]{Properties.class, ResultSet.class, String.class}); p_po = (PO)constructor.newInstance(new Object[]{m_ctx, rs, trxName}); } catch (Exception e) @@ -566,12 +564,7 @@ public abstract class Doc sql.append(" AND (Processing='N' OR Processing IS NULL)"); if (!repost) sql.append(" AND Posted='N'"); - // Set transaction to lock record - String trxName = null; // outside trx - if (Ini.isClient() && CConnection.isServerEmbedded()) - trxName = getTrxName(); // within trx if server embedded in client - // - if (DB.executeUpdate(sql.toString(), trxName) == 1) + if (DB.executeUpdate(sql.toString(), null) == 1) // outside trx log.info("Locked: " + get_TableName() + "_ID=" + get_ID()); else { diff --git a/base/src/org/compiere/db/CConnection.java b/base/src/org/compiere/db/CConnection.java index 7aefa3175d..690365119e 100644 --- a/base/src/org/compiere/db/CConnection.java +++ b/base/src/org/compiere/db/CConnection.java @@ -1604,9 +1604,7 @@ public class CConnection implements Serializable, Cloneable * @return true if server is embedded in process */ public static boolean isServerEmbedded() { - // defaults to true - it can be disabled passing this parameter to the JVM - // -Dorg.adempiere.server.embedded=false - return ! "false".equalsIgnoreCase(System.getProperty(SERVER_EMBEDDED)); + return "true".equalsIgnoreCase(System.getProperty(SERVER_EMBEDDED)); } public void setAppServerCredential(String principal, String credential) diff --git a/base/src/org/compiere/model/MFactAcct.java b/base/src/org/compiere/model/MFactAcct.java index 7f0bf6329d..5c0873d5bf 100644 --- a/base/src/org/compiere/model/MFactAcct.java +++ b/base/src/org/compiere/model/MFactAcct.java @@ -39,7 +39,7 @@ public class MFactAcct extends X_Fact_Acct /** * */ - private static final long serialVersionUID = -5110168625445057323L; + private static final long serialVersionUID = 5251847162314796574L; /** * Delete Accounting @@ -134,20 +134,5 @@ public class MFactAcct extends X_Fact_Acct acct.save(); return acct; } // getMAccount - - /** - * Check if there are already accounting facts for the document - * @param AD_Table_ID table - * @param Record_ID record - * @param trxName transaction - * @return true/false meaning if there are records or not - * @throws DBException on database exception - */ - public static boolean thereAreFacts(int AD_Table_ID, int Record_ID, String trxName) throws DBException - { - final String sql = "SELECT 1 FROM Fact_Acct WHERE AD_Table_ID=? AND Record_ID=?"; - int one = DB.getSQLValue(trxName, sql, new Object[]{AD_Table_ID, Record_ID}); - return (one == 1); - } } // MFactAcct diff --git a/base/src/org/compiere/process/DocumentEngine.java b/base/src/org/compiere/process/DocumentEngine.java index 321711b429..f067e10603 100644 --- a/base/src/org/compiere/process/DocumentEngine.java +++ b/base/src/org/compiere/process/DocumentEngine.java @@ -285,9 +285,8 @@ public class DocumentEngine implements DocAction return false; } status = completeIt(); - if (m_document != null - && ( (Ini.isClient() && CConnection.isServerEmbedded()) - || !Ini.isClient())) // Post Immediate if on Server or embedded server + if (m_document != null + && !Ini.isClient()) // Post Immediate if on Server { MClient client = MClient.get(m_document.getCtx(), m_document.getAD_Client_ID()); if (STATUS_Completed.equals(status) && client.isPostImmediate()) @@ -465,13 +464,10 @@ public class DocumentEngine implements DocAction Server server = CConnection.get().getServer(); if (server != null) { - String trxName = null; - if (Ini.isClient() && CConnection.isServerEmbedded()) - trxName = m_document.get_TrxName(); String error = server.postImmediate(Env.getRemoteCallCtx(Env.getCtx()), m_document.getAD_Client_ID(), m_document.get_Table_ID(), m_document.get_ID(), - true, trxName); + true, null); m_document.get_Logger().config("Server: " + error == null ? "OK" : error); return error == null; } diff --git a/base/src/org/compiere/wf/MWFActivity.java b/base/src/org/compiere/wf/MWFActivity.java index 37ddcc7255..25552f1b9b 100644 --- a/base/src/org/compiere/wf/MWFActivity.java +++ b/base/src/org/compiere/wf/MWFActivity.java @@ -38,7 +38,6 @@ import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MColumn; import org.compiere.model.MConversionRate; -import org.compiere.model.MFactAcct; import org.compiere.model.MMailText; import org.compiere.model.MNote; import org.compiere.model.MOrg; @@ -58,9 +57,9 @@ import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; import org.compiere.process.StateEngine; +import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; -import org.compiere.util.Ini; import org.compiere.util.Msg; import org.compiere.util.Trace; import org.compiere.util.Trx; @@ -79,7 +78,8 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable /** * */ - private static final long serialVersionUID = 1584816335412184476L; + private static final long serialVersionUID = 2104882570953130237L; + /** * Get Activities for table/record @@ -1504,11 +1504,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable */ private void postImmediate() { - String trxName = null; - if (Ini.isClient() && CConnection.isServerEmbedded()) - trxName = m_postImmediate.get_TrxName(); - if (MFactAcct.thereAreFacts(m_postImmediate.get_Table_ID(), m_postImmediate.get_ID(), trxName)) - return; // the document was already posted in DocumentEngine.processIt if (CConnection.get().isAppsServerOK(false)) { try @@ -1519,7 +1514,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable String error = server.postImmediate(Env.getRemoteCallCtx(Env.getCtx()), m_postImmediate.getAD_Client_ID(), m_postImmediate.get_Table_ID(), m_postImmediate.get_ID(), - true, trxName); + true, null); m_postImmediate.get_Logger().config("Server: " + error == null ? "OK" : error); return; } diff --git a/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java b/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java index 7c1086ce42..542aa233d7 100644 --- a/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java +++ b/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java @@ -31,7 +31,6 @@ import javax.ejb.Stateless; import org.adempiere.util.ProcessUtil; import org.compiere.Adempiere; import org.compiere.acct.Doc; -import org.compiere.db.CConnection; import org.compiere.interfaces.Server; import org.compiere.interfaces.ServerLocal; import org.compiere.interfaces.ServerRemote; @@ -44,7 +43,6 @@ import org.compiere.util.CLogger; import org.compiere.util.CacheMgt; import org.compiere.util.EMail; import org.compiere.util.Env; -import org.compiere.util.Ini; /** * Adempiere Server Bean. @@ -99,9 +97,7 @@ public class ServerBean implements ServerRemote, ServerLocal m_postCount++; MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(ctx, AD_Client_ID); - if (! (Ini.isClient() && CConnection.isServerEmbedded())) - trxName = null; - return Doc.postImmediate(ass, AD_Table_ID, Record_ID, force, trxName); + return Doc.postImmediate(ass, AD_Table_ID, Record_ID, force, null); } // postImmediate /*************************************************************************