diff --git a/base/src/org/compiere/model/MClient.java b/base/src/org/compiere/model/MClient.java
index 989ee11ac1..731fff32bd 100644
--- a/base/src/org/compiere/model/MClient.java
+++ b/base/src/org/compiere/model/MClient.java
@@ -1,8 +1,8 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
+/******************************************************************************
+ * Product: Adempiere ERP & CRM Smart Business Solution *
+ * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
@@ -12,57 +12,57 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
+ * or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): Teo Sarca *
*****************************************************************************/
package org.compiere.model;
-import java.io.File;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.logging.Level;
-
-import javax.mail.internet.InternetAddress;
-
-import org.compiere.db.CConnection;
-import org.compiere.interfaces.Server;
-import org.compiere.util.CCache;
-import org.compiere.util.DB;
-import org.compiere.util.EMail;
-import org.compiere.util.Env;
-import org.compiere.util.Ini;
-import org.compiere.util.Language;
+import java.io.File;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.logging.Level;
+
+import javax.mail.internet.InternetAddress;
+
+import org.compiere.db.CConnection;
+import org.compiere.interfaces.Server;
+import org.compiere.util.CCache;
+import org.compiere.util.DB;
+import org.compiere.util.EMail;
+import org.compiere.util.Env;
+import org.compiere.util.Ini;
+import org.compiere.util.Language;
/**
* Client Model
*
* @author Jorg Janke
- * @version $Id: MClient.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $
- *
- * @author Carlos Ruiz - globalqss
- * integrate bug fix reported by Teo Sarca
+ * @version $Id: MClient.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $
+ *
+ * @author Carlos Ruiz - globalqss
+ * integrate bug fix reported by Teo Sarca
* [ 1619085 ] Client setup creates duplicate trees
- * @author Teo Sarca, SC ARHIPAC SERVICE SRL
- *
BF [ 1886480 ] Print Format Item Trl not updated even if not multilingual
- * @author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com
- * FR [ 402 ] Mail setup is hardcoded
- * @see https://github.com/adempiere/adempiere/issues/402
+ * @author Teo Sarca, SC ARHIPAC SERVICE SRL
+ * BF [ 1886480 ] Print Format Item Trl not updated even if not multilingual
+ * @author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com
+ * FR [ 402 ] Mail setup is hardcoded
+ * @see https://github.com/adempiere/adempiere/issues/402
*/
public class MClient extends X_AD_Client
{
- /**
- *
- */
- private static final long serialVersionUID = -6482473737885701403L;
-
-
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6482473737885701403L;
+
+
/**
* Get client
* @param ctx context
@@ -87,18 +87,18 @@ public static MClient get (Properties ctx, int AD_Client_ID)
*/
public static MClient[] getAll (Properties ctx)
{
- List list = new Query(ctx,I_AD_Client.Table_Name,null,null)
- .list();
- for(MClient client:list ){
- s_cache.put (new Integer (client.getAD_Client_ID()), client);
+ List list = new Query(ctx,I_AD_Client.Table_Name,null,null)
+ .list();
+ for(MClient client:list ){
+ s_cache.put (new Integer (client.getAD_Client_ID()), client);
}
- MClient[] retValue = new MClient[list.size ()];
- list.toArray (retValue);
- return retValue;
+ MClient[] retValue = new MClient[list.size ()];
+ list.toArray (retValue);
+ return retValue;
} // getAll
-
- /**
- * Get optionally cached client
+
+ /**
+ * Get optionally cached client
* @param ctx context
* @return client
*/
@@ -106,7 +106,7 @@ public static MClient get (Properties ctx)
{
return get (ctx, Env.getAD_Client_ID(ctx));
} // get
-
+
/** Cache */
private static CCache s_cache = new CCache("AD_Client", 3);
@@ -182,37 +182,37 @@ public MClient (Properties ctx, String trxName)
/** New Record */
private boolean m_createNew = false;
/** Client Info Setup Tree for Account */
- private int m_AD_Tree_Account_ID;
+ private int m_AD_Tree_Account_ID;
/**
* Get SMTP Host
* @return SMTP or loaclhost
*/
- public String getSMTPHost() {
- // FR [ 402 ]
- String s = null;
- MEMailConfig eMailConfig = MEMailConfig.get(getCtx(), getAD_EMailConfig_ID());
- if(eMailConfig != null) {
- s = eMailConfig.getSMTPHost();
+ public String getSMTPHost() {
+ // FR [ 402 ]
+ String s = null;
+ MEMailConfig eMailConfig = MEMailConfig.get(getCtx(), getAD_EMailConfig_ID());
+ if(eMailConfig != null) {
+ s = eMailConfig.getSMTPHost();
}
- // Valid null
+ // Valid null
if (s == null)
s = "localhost";
return s;
- } // getSMTPHost
-
- /**
- * Verify if is SMTP Authorization
- * FR [ 402 ]
- * @return
- */
- public boolean isSmtpAuthorization() {
- MEMailConfig eMailConfig = MEMailConfig.get(getCtx(), getAD_EMailConfig_ID());
- if(eMailConfig != null) {
- return eMailConfig.isSmtpAuthorization();
- }
- // Default
- return false;
+ } // getSMTPHost
+
+ /**
+ * Verify if is SMTP Authorization
+ * FR [ 402 ]
+ * @return
+ */
+ public boolean isSmtpAuthorization() {
+ MEMailConfig eMailConfig = MEMailConfig.get(getCtx(), getAD_EMailConfig_ID());
+ if(eMailConfig != null) {
+ return eMailConfig.isSmtpAuthorization();
+ }
+ // Default
+ return false;
}
/**
@@ -314,7 +314,7 @@ public boolean setupClientInfo (String language)
sql = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=120 AND IsActive='Y'";
else
sql = "SELECT l.Value, t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t "
- + "WHERE l.AD_Reference_ID=120 AND l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.IsActive='Y'"
+ + "WHERE l.AD_Reference_ID=120 AND l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.IsActive='Y'"
+ " AND t.AD_Language=" + DB.TO_STRING(language);
// Tree IDs
@@ -330,61 +330,61 @@ public boolean setupClientInfo (String language)
MTree_Base tree = null;
while (rs.next())
{
- String value = rs.getString(1);
- String name = getName() + " " + rs.getString(2);
- //
- if (value.equals(X_AD_Tree.TREETYPE_Organization))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_Org_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_BPartner))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_BPartner_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_Project))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_Project_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_SalesRegion))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_SalesRegion_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_Product))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_Product_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_ElementValue))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- m_AD_Tree_Account_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_Campaign))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_Campaign_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_Activity))
- {
- tree = new MTree_Base (this, name, value);
- success = tree.save();
- AD_Tree_Activity_ID = tree.getAD_Tree_ID();
- }
- else if (value.equals(X_AD_Tree.TREETYPE_Menu)) // No Menu
- success = true;
- else // PC (Product Category), BB (BOM)
- {
+ String value = rs.getString(1);
+ String name = getName() + " " + rs.getString(2);
+ //
+ if (value.equals(X_AD_Tree.TREETYPE_Organization))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_Org_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_BPartner))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_BPartner_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_Project))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_Project_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_SalesRegion))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_SalesRegion_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_Product))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_Product_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_ElementValue))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ m_AD_Tree_Account_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_Campaign))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_Campaign_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_Activity))
+ {
+ tree = new MTree_Base (this, name, value);
+ success = tree.save();
+ AD_Tree_Activity_ID = tree.getAD_Tree_ID();
+ }
+ else if (value.equals(X_AD_Tree.TREETYPE_Menu)) // No Menu
+ success = true;
+ else // PC (Product Category), BB (BOM)
+ {
tree = new MTree_Base (this, name, value);
success = tree.save();
}
@@ -488,14 +488,14 @@ public boolean save ()
public String testEMail()
{
if (getRequestEMail() == null || getRequestEMail().length() == 0)
- return "No Request EMail for " + getName();
- //
- EMail email = createEMail (getRequestEMail(),
- "Adempiere EMail Test",
- "Adempiere EMail Test: " + toString());
- if (email == null)
- return "Could not create EMail: " + getName();
- try
+ return "No Request EMail for " + getName();
+ //
+ EMail email = createEMail (getRequestEMail(),
+ "Adempiere EMail Test",
+ "Adempiere EMail Test: " + toString());
+ if (email == null)
+ return "Could not create EMail: " + getName();
+ try
{
String msg = email.send();
if (EMail.SENT_OK.equals (msg))
@@ -530,38 +530,38 @@ public String testEMail()
public boolean sendEMail (int AD_User_ID,
String subject, String message, File attachment)
{
- Collection attachments = new ArrayList();
- if (attachment != null)
- attachments.add(attachment);
- return sendEMailAttachments(AD_User_ID, subject, message, attachments);
- }
-
- /**
- * Send EMail from Request User - with trace
- * @param AD_User_ID recipient
- * @param subject subject
- * @param message message
- * @param attachment optional collection of attachments
- * @return true if sent
- */
- public boolean sendEMailAttachments (int AD_User_ID,
- String subject, String message, Collection attachments)
- {
- return sendEMailAttachments(AD_User_ID, subject, message, attachments, false);
- }
-
- /**
- * Send EMail from Request User - with trace
- * @param AD_User_ID recipient
- * @param subject subject
- * @param message message
- * @param attachment optional collection of attachments
- * @param html
- * @return true if sent
- */
- public boolean sendEMailAttachments (int AD_User_ID,
- String subject, String message, Collection attachments, boolean html)
- {
+ Collection attachments = new ArrayList();
+ if (attachment != null)
+ attachments.add(attachment);
+ return sendEMailAttachments(AD_User_ID, subject, message, attachments);
+ }
+
+ /**
+ * Send EMail from Request User - with trace
+ * @param AD_User_ID recipient
+ * @param subject subject
+ * @param message message
+ * @param attachment optional collection of attachments
+ * @return true if sent
+ */
+ public boolean sendEMailAttachments (int AD_User_ID,
+ String subject, String message, Collection attachments)
+ {
+ return sendEMailAttachments(AD_User_ID, subject, message, attachments, false);
+ }
+
+ /**
+ * Send EMail from Request User - with trace
+ * @param AD_User_ID recipient
+ * @param subject subject
+ * @param message message
+ * @param attachment optional collection of attachments
+ * @param html
+ * @return true if sent
+ */
+ public boolean sendEMailAttachments (int AD_User_ID,
+ String subject, String message, Collection attachments, boolean html)
+ {
MUser to = MUser.get(getCtx(), AD_User_ID);
String toEMail = to.getEMail();
if (toEMail == null || toEMail.length() == 0)
@@ -583,27 +583,27 @@ public boolean sendEMailAttachments (int AD_User_ID,
return false;
}
} // sendEMail
-
- /**
- * Send EMail from Request User - no trace
- * @param to recipient email address
- * @param subject subject
- * @param message message
- * @param attachment optional attachment
- * @return true if sent
- */
- public boolean sendEMail (String to,
- String subject, String message, File attachment)
- {
- return sendEMail(to, subject, message, attachment, false);
- }
/**
* Send EMail from Request User - no trace
* @param to recipient email address
* @param subject subject
* @param message message
- * @param attachment optional attachment
+ * @param attachment optional attachment
+ * @return true if sent
+ */
+ public boolean sendEMail (String to,
+ String subject, String message, File attachment)
+ {
+ return sendEMail(to, subject, message, attachment, false);
+ }
+
+ /**
+ * Send EMail from Request User - no trace
+ * @param to recipient email address
+ * @param subject subject
+ * @param message message
+ * @param attachment optional attachment
* @param html
* @return true if sent
*/
@@ -638,20 +638,20 @@ public boolean sendEMail (String to,
}
} // sendEMail
- /**
- * Send EMail from User
- * @param from sender
- * @param to recipient
- * @param subject subject
- * @param message message
- * @param attachment optional attachment
- * @return true if sent
- */
- public boolean sendEMail (MUser from, MUser to,
- String subject, String message, File attachment)
- {
- return sendEMail(from, to, subject, message, attachment, false);
- }
+ /**
+ * Send EMail from User
+ * @param from sender
+ * @param to recipient
+ * @param subject subject
+ * @param message message
+ * @param attachment optional attachment
+ * @return true if sent
+ */
+ public boolean sendEMail (MUser from, MUser to,
+ String subject, String message, File attachment)
+ {
+ return sendEMail(from, to, subject, message, attachment, false);
+ }
/**
* Send EMail from User
@@ -666,10 +666,10 @@ public boolean sendEMail (MUser from, MUser to,
public boolean sendEMail (MUser from, MUser to,
String subject, String message, File attachment, boolean isHtml)
{
- EMail email = createEMail(from, to, subject, message, isHtml);
- if (email == null)
- return false;
-
+ EMail email = createEMail(from, to, subject, message, isHtml);
+ if (email == null)
+ return false;
+
if (attachment != null)
email.addAttachment(attachment);
InternetAddress emailFrom = email.getFrom();
@@ -736,25 +736,25 @@ public boolean sendEmailNow(MUser from, MUser to, EMail email)
return false;
}
} // sendEmailNow
-
- /************
- * Create EMail from Request User
- * @param to recipient
- * @param subject sunject
- * @param message nessage
- * @return EMail
- */
- public EMail createEMail (String to,
- String subject, String message)
- {
- return createEMail(to, subject, message, false);
- }
+
+ /************
+ * Create EMail from Request User
+ * @param to recipient
+ * @param subject sunject
+ * @param message nessage
+ * @return EMail
+ */
+ public EMail createEMail (String to,
+ String subject, String message)
+ {
+ return createEMail(to, subject, message, false);
+ }
/************
* Create EMail from Request User
* @param to recipient
* @param subject sunject
- * @param message nessage
+ * @param message nessage
* @param html
* @return EMail
*/
@@ -770,12 +770,12 @@ public EMail createEMail (String to,
EMail email = null;
if (isServerEMail() && Ini.isClient())
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
- { // See ServerBean
- if (html && message != null)
+ { // See ServerBean
+ if (html && message != null)
message = EMail.HTML_MAIL_MARKER + message;
email = server.createEMail(Env.getRemoteCallCtx(getCtx()), getAD_Client_ID(),
to, subject, message);
@@ -787,8 +787,8 @@ public EMail createEMail (String to,
{
log.log(Level.SEVERE, getName() + " - AppsServer error", ex);
}
- }
- // FR [ 402 ]
+ }
+ // FR [ 402 ]
// Constructor is changed
if (email == null)
email = new EMail(this, getAD_EMailConfig_ID(), getRequestEMail(), to, subject, message, html);
@@ -796,27 +796,27 @@ public EMail createEMail (String to,
email.createAuthenticator (getRequestUser(), getRequestUserPW());
return email;
} // createEMail
-
- /**
- * Create EMail from User
- * @param from optional sender
- * @param to recipient
- * @param subject sunject
- * @param message nessage
- * @return EMail
- */
- public EMail createEMail (MUser from, MUser to,
- String subject, String message)
- {
- return createEMail(from, to, subject, message, false);
- }
+
+ /**
+ * Create EMail from User
+ * @param from optional sender
+ * @param to recipient
+ * @param subject sunject
+ * @param message nessage
+ * @return EMail
+ */
+ public EMail createEMail (MUser from, MUser to,
+ String subject, String message)
+ {
+ return createEMail(from, to, subject, message, false);
+ }
/**
* Create EMail from User
* @param from optional sender
* @param to recipient
* @param subject sunject
- * @param message nessage
+ * @param message nessage
* @param html
* @return EMail
*/
@@ -835,27 +835,27 @@ public EMail createEMail (MUser from, MUser to,
}
return createEMail (from, to.getEMail(), subject, message, html);
} // createEMail
-
- /**
- * Create EMail from User
- * @param from optional sender
- * @param to recipient
- * @param subject sunject
- * @param message nessage
- * @return EMail
- */
- public EMail createEMail (MUser from, String to,
- String subject, String message)
- {
- return createEMail(from, to, subject, message, false);
- }
/**
* Create EMail from User
* @param from optional sender
* @param to recipient
* @param subject sunject
- * @param message nessage
+ * @param message nessage
+ * @return EMail
+ */
+ public EMail createEMail (MUser from, String to,
+ String subject, String message)
+ {
+ return createEMail(from, to, subject, message, false);
+ }
+
+ /**
+ * Create EMail from User
+ * @param from optional sender
+ * @param to recipient
+ * @param subject sunject
+ * @param message nessage
* @param html
* @return EMail
*/
@@ -873,7 +873,7 @@ public EMail createEMail (MUser from, String to,
// No From details - Error
if (from.getEMail() == null
|| from.getEMailUser() == null
- || (isSmtpAuthorization() && from.getEMailUserPW() == null) ) // is SMTP authorization and password is null - teo_sarca [ 1723309 ]
+ || (isSmtpAuthorization() && from.getEMailUserPW() == null) ) // is SMTP authorization and password is null - teo_sarca [ 1723309 ]
{
log.warning("From EMail incomplete: " + from + " (" + getName() + ")");
return null;
@@ -882,12 +882,12 @@ public EMail createEMail (MUser from, String to,
EMail email = null;
if (isServerEMail() && Ini.isClient())
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
- { // See ServerBean
- if (html && message != null)
+ { // See ServerBean
+ if (html && message != null)
message = EMail.HTML_MAIL_MARKER + message;
email = server.createEMail(Env.getRemoteCallCtx(getCtx()), getAD_Client_ID(),
from.getAD_User_ID(),
@@ -900,142 +900,142 @@ public EMail createEMail (MUser from, String to,
{
log.log(Level.SEVERE, getName() + " - AppsServer error", ex);
}
- }
- // FR [ 402 ]
+ }
+ // FR [ 402 ]
// Add support to custom user mail
if (email == null)
- email = new EMail (this, from.getAD_EMailConfig_ID(), from.getEMail(), to, subject, message, html);
- // For Custom EMail Server
- if(from.getAD_EMailConfig_ID() != 0) {
- MEMailConfig emailConfig = MEMailConfig.get(getCtx(), from.getAD_EMailConfig_ID());
- if(emailConfig.isSmtpAuthorization()
- || emailConfig.getAuthMechanism().equals(MEMailConfig.AUTHMECHANISM_OAuth))
- email.createAuthenticator (from.getEMailUser(), from.getEMailUserPW());
- } else {
- if (isSmtpAuthorization())
- email.createAuthenticator (from.getEMailUser(), from.getEMailUserPW());
+ email = new EMail (this, from.getAD_EMailConfig_ID(), from.getEMail(), to, subject, message, html);
+ // For Custom EMail Server
+ if(from.getAD_EMailConfig_ID() != 0) {
+ MEMailConfig emailConfig = MEMailConfig.get(getCtx(), from.getAD_EMailConfig_ID());
+ if(emailConfig.isSmtpAuthorization()
+ || emailConfig.getAuthMechanism().equals(MEMailConfig.AUTHMECHANISM_OAuth))
+ email.createAuthenticator (from.getEMailUser(), from.getEMailUserPW());
+ } else {
+ if (isSmtpAuthorization())
+ email.createAuthenticator (from.getEMailUser(), from.getEMailUserPW());
}
return email;
- } // createEMail
-
- /*
- * Is Client Accounting enabled?
- * CLIENT_ACCOUNTING parameter allow the next values
- * D - Disabled (default)
- * Q - Queue (enabled to post by hand - queue documents for posterior processing)
- * I - Immediate (immediate post - allow complete on errors)
- *
- * @return boolean representing if client accounting is enabled and it's on a client
- */
- private static final String CLIENT_ACCOUNTING_DISABLED = "D";
- private static final String CLIENT_ACCOUNTING_QUEUE = "Q";
- private static final String CLIENT_ACCOUNTING_IMMEDIATE = "I";
-
- public static boolean isClientAccounting() {
- String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
- CLIENT_ACCOUNTING_DISABLED, // default
- Env.getAD_Client_ID(Env.getCtx()));
- return (ca.equalsIgnoreCase(CLIENT_ACCOUNTING_IMMEDIATE) || ca.equalsIgnoreCase(CLIENT_ACCOUNTING_QUEUE));
- }
-
- public static boolean isClientAccountingQueue() {
- String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
- CLIENT_ACCOUNTING_DISABLED, // default
- Env.getAD_Client_ID(Env.getCtx()));
- return ca.equalsIgnoreCase(CLIENT_ACCOUNTING_QUEUE);
- }
-
- public static boolean isClientAccountingImmediate() {
- String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
- CLIENT_ACCOUNTING_DISABLED, // default
- Env.getAD_Client_ID(Env.getCtx()));
- return ca.equalsIgnoreCase(CLIENT_ACCOUNTING_IMMEDIATE);
- }
-
- /* 2870483 - SaaS too slow opening windows */
- /** Field Access */
- private ArrayList m_fieldAccess = null;
- /**
- * Define is a field is displayed based on ASP rules
- * @param ad_field_id
- * @return boolean indicating if it's displayed or not
- */
- public boolean isDisplayField(int aDFieldID) {
- if (! isUseASP())
- return true;
-
- if (m_fieldAccess == null)
- {
- m_fieldAccess = new ArrayList(11000);
- String sqlvalidate =
- "SELECT AD_Field_ID "
- + " FROM AD_Field "
- + " WHERE ( AD_Field_ID IN ( "
- // ASP subscribed fields for client
- + " SELECT f.AD_Field_ID "
- + " FROM ASP_Field f, ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl "
- + " WHERE w.ASP_Level_ID = l.ASP_Level_ID "
- + " AND cl.AD_Client_ID = " + getAD_Client_ID()
- + " AND cl.ASP_Level_ID = l.ASP_Level_ID "
- + " AND f.ASP_Tab_ID = t.ASP_Tab_ID "
- + " AND t.ASP_Window_ID = w.ASP_Window_ID "
- + " AND f.IsActive = 'Y' "
- + " AND t.IsActive = 'Y' "
- + " AND w.IsActive = 'Y' "
- + " AND l.IsActive = 'Y' "
- + " AND cl.IsActive = 'Y' "
- + " AND f.ASP_Status = 'S') "
- + " OR AD_Tab_ID IN ( "
- // ASP subscribed fields for client
- + " SELECT t.AD_Tab_ID "
- + " FROM ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl "
- + " WHERE w.ASP_Level_ID = l.ASP_Level_ID "
- + " AND cl.AD_Client_ID = " + getAD_Client_ID()
- + " AND cl.ASP_Level_ID = l.ASP_Level_ID "
- + " AND t.ASP_Window_ID = w.ASP_Window_ID "
- + " AND t.IsActive = 'Y' "
- + " AND w.IsActive = 'Y' "
- + " AND l.IsActive = 'Y' "
- + " AND cl.IsActive = 'Y' "
- + " AND t.AllFields = 'Y' "
- + " AND t.ASP_Status = 'S') "
- + " OR AD_Field_ID IN ( "
- // ASP show exceptions for client
- + " SELECT AD_Field_ID "
- + " FROM ASP_ClientException ce "
- + " WHERE ce.AD_Client_ID = " + getAD_Client_ID()
- + " AND ce.IsActive = 'Y' "
- + " AND ce.AD_Field_ID IS NOT NULL "
- + " AND ce.ASP_Status = 'S') "
- + " ) "
- + " AND AD_Field_ID NOT IN ( "
- // minus ASP hide exceptions for client
- + " SELECT AD_Field_ID "
- + " FROM ASP_ClientException ce "
- + " WHERE ce.AD_Client_ID = " + getAD_Client_ID()
- + " AND ce.IsActive = 'Y' "
- + " AND ce.AD_Field_ID IS NOT NULL "
- + " AND ce.ASP_Status = 'H')"
- + " ORDER BY AD_Field_ID";
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try
- {
- pstmt = DB.prepareStatement(sqlvalidate, get_TrxName());
- rs = pstmt.executeQuery();
- while (rs.next())
- m_fieldAccess.add(rs.getInt(1));
- }
- catch (Exception e)
- {
- log.log(Level.SEVERE, sqlvalidate, e);
- }
- finally
- {
- DB.close(rs, pstmt);
- }
- }
- return (Collections.binarySearch(m_fieldAccess, aDFieldID) > 0);
- }
-
+ } // createEMail
+
+ /*
+ * Is Client Accounting enabled?
+ * CLIENT_ACCOUNTING parameter allow the next values
+ * D - Disabled (default)
+ * Q - Queue (enabled to post by hand - queue documents for posterior processing)
+ * I - Immediate (immediate post - allow complete on errors)
+ *
+ * @return boolean representing if client accounting is enabled and it's on a client
+ */
+ private static final String CLIENT_ACCOUNTING_DISABLED = "D";
+ private static final String CLIENT_ACCOUNTING_QUEUE = "Q";
+ private static final String CLIENT_ACCOUNTING_IMMEDIATE = "I";
+
+ public static boolean isClientAccounting() {
+ String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
+ CLIENT_ACCOUNTING_DISABLED, // default
+ Env.getAD_Client_ID(Env.getCtx()));
+ return (ca.equalsIgnoreCase(CLIENT_ACCOUNTING_IMMEDIATE) || ca.equalsIgnoreCase(CLIENT_ACCOUNTING_QUEUE));
+ }
+
+ public static boolean isClientAccountingQueue() {
+ String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
+ CLIENT_ACCOUNTING_DISABLED, // default
+ Env.getAD_Client_ID(Env.getCtx()));
+ return ca.equalsIgnoreCase(CLIENT_ACCOUNTING_QUEUE);
+ }
+
+ public static boolean isClientAccountingImmediate() {
+ String ca = MSysConfig.getValue("CLIENT_ACCOUNTING",
+ CLIENT_ACCOUNTING_DISABLED, // default
+ Env.getAD_Client_ID(Env.getCtx()));
+ return ca.equalsIgnoreCase(CLIENT_ACCOUNTING_IMMEDIATE);
+ }
+
+ /* 2870483 - SaaS too slow opening windows */
+ /** Field Access */
+ private ArrayList m_fieldAccess = null;
+ /**
+ * Define is a field is displayed based on ASP rules
+ * @param ad_field_id
+ * @return boolean indicating if it's displayed or not
+ */
+ public boolean isDisplayField(int aDFieldID) {
+ if (! isUseASP())
+ return true;
+
+ if (m_fieldAccess == null)
+ {
+ m_fieldAccess = new ArrayList(11000);
+ String sqlvalidate =
+ "SELECT AD_Field_ID "
+ + " FROM AD_Field "
+ + " WHERE ( AD_Field_ID IN ( "
+ // ASP subscribed fields for client
+ + " SELECT f.AD_Field_ID "
+ + " FROM ASP_Field f, ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl "
+ + " WHERE w.ASP_Level_ID = l.ASP_Level_ID "
+ + " AND cl.AD_Client_ID = " + getAD_Client_ID()
+ + " AND cl.ASP_Level_ID = l.ASP_Level_ID "
+ + " AND f.ASP_Tab_ID = t.ASP_Tab_ID "
+ + " AND t.ASP_Window_ID = w.ASP_Window_ID "
+ + " AND f.IsActive = 'Y' "
+ + " AND t.IsActive = 'Y' "
+ + " AND w.IsActive = 'Y' "
+ + " AND l.IsActive = 'Y' "
+ + " AND cl.IsActive = 'Y' "
+ + " AND f.ASP_Status = 'S') "
+ + " OR AD_Tab_ID IN ( "
+ // ASP subscribed fields for client
+ + " SELECT t.AD_Tab_ID "
+ + " FROM ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl "
+ + " WHERE w.ASP_Level_ID = l.ASP_Level_ID "
+ + " AND cl.AD_Client_ID = " + getAD_Client_ID()
+ + " AND cl.ASP_Level_ID = l.ASP_Level_ID "
+ + " AND t.ASP_Window_ID = w.ASP_Window_ID "
+ + " AND t.IsActive = 'Y' "
+ + " AND w.IsActive = 'Y' "
+ + " AND l.IsActive = 'Y' "
+ + " AND cl.IsActive = 'Y' "
+ + " AND t.AllFields = 'Y' "
+ + " AND t.ASP_Status = 'S') "
+ + " OR AD_Field_ID IN ( "
+ // ASP show exceptions for client
+ + " SELECT AD_Field_ID "
+ + " FROM ASP_ClientException ce "
+ + " WHERE ce.AD_Client_ID = " + getAD_Client_ID()
+ + " AND ce.IsActive = 'Y' "
+ + " AND ce.AD_Field_ID IS NOT NULL "
+ + " AND ce.ASP_Status = 'S') "
+ + " ) "
+ + " AND AD_Field_ID NOT IN ( "
+ // minus ASP hide exceptions for client
+ + " SELECT AD_Field_ID "
+ + " FROM ASP_ClientException ce "
+ + " WHERE ce.AD_Client_ID = " + getAD_Client_ID()
+ + " AND ce.IsActive = 'Y' "
+ + " AND ce.AD_Field_ID IS NOT NULL "
+ + " AND ce.ASP_Status = 'H')"
+ + " ORDER BY AD_Field_ID";
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+ try
+ {
+ pstmt = DB.prepareStatement(sqlvalidate, get_TrxName());
+ rs = pstmt.executeQuery();
+ while (rs.next())
+ m_fieldAccess.add(rs.getInt(1));
+ }
+ catch (Exception e)
+ {
+ log.log(Level.SEVERE, sqlvalidate, e);
+ }
+ finally
+ {
+ DB.close(rs, pstmt);
+ }
+ }
+ return (Collections.binarySearch(m_fieldAccess, aDFieldID) > 0);
+ }
+
} // MClient
diff --git a/base/src/org/compiere/model/MStore.java b/base/src/org/compiere/model/MStore.java
index e297739dce..981819a95d 100644
--- a/base/src/org/compiere/model/MStore.java
+++ b/base/src/org/compiere/model/MStore.java
@@ -360,9 +360,9 @@ public EMail createEMail (String to,
MClient client = MClient.get(getCtx(), getAD_Client_ID());
if (client.isServerEMail() && Ini.isClient())
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
email = server.createEMail(Env.getRemoteCallCtx(getCtx()), getAD_Client_ID(),
diff --git a/base/src/org/compiere/process/ServerProcessCtl.java b/base/src/org/compiere/process/ServerProcessCtl.java
index 7a8d6049c2..f113a4a343 100644
--- a/base/src/org/compiere/process/ServerProcessCtl.java
+++ b/base/src/org/compiere/process/ServerProcessCtl.java
@@ -315,9 +315,9 @@ protected boolean startWorkflow (int AD_Workflow_ID)
boolean started = false;
if (isServerProcess)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
processInfo = server.workflow (Env.getRemoteCallCtx(Env.getCtx()), processInfo, AD_Workflow_ID);
@@ -368,9 +368,9 @@ protected boolean startProcess ()
if (isServerProcess && !clientOnly)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{
// See ServerBean
@@ -434,9 +434,9 @@ protected boolean startDBProcess (String ProcedureName)
String trxName = trx != null ? trx.getTrxName() : null;
if (isServerProcess)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
processInfo = server.dbProcess(processInfo, ProcedureName);
diff --git a/client/src/org/compiere/apps/ProcessCtl.java b/client/src/org/compiere/apps/ProcessCtl.java
index 888726ca54..6bebe4e8c8 100644
--- a/client/src/org/compiere/apps/ProcessCtl.java
+++ b/client/src/org/compiere/apps/ProcessCtl.java
@@ -523,9 +523,9 @@ private boolean startWorkflow (int AD_Workflow_ID)
boolean started = false;
if (isServerProcess)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
processInstance = server.workflow (Env.getRemoteCallCtx(Env.getCtx()), processInstance, AD_Workflow_ID);
@@ -576,9 +576,9 @@ private boolean startProcess ()
if (isServerProcess && !clientOnly)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{
// See ServerBean
@@ -641,9 +641,9 @@ private boolean startDBProcess (String ProcedureName)
boolean started = false;
if (isServerProcess)
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
processInstance = server.dbProcess(processInstance, ProcedureName);
diff --git a/serverApps/src/main/servlet/org/compiere/www/WProcessCtl.java b/serverApps/src/main/servlet/org/compiere/www/WProcessCtl.java
index a92fd7a98d..90b39822d4 100644
--- a/serverApps/src/main/servlet/org/compiere/www/WProcessCtl.java
+++ b/serverApps/src/main/servlet/org/compiere/www/WProcessCtl.java
@@ -364,9 +364,9 @@ private boolean startWorkflow (int AD_Workflow_ID)
if (DB.isRemoteProcess())
{
log.info("trying to running on the server");
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
log.info("running on the server");
@@ -411,9 +411,9 @@ private boolean startProcess ()
boolean started = false;
if (DB.isRemoteProcess())
{
- Server server = CConnection.get().getServer();
try
{
+ Server server = CConnection.get().getServer();
if (server != null)
{ // See ServerBean
m_pi = server.process (m_wscctx, m_pi);