Merge with 80ead73d634dda9df09ab5b3ee3abf03f56eaece

This commit is contained in:
Heng Sin Low 2012-10-16 06:51:17 +08:00
commit 6deac69c8e
12 changed files with 111 additions and 22 deletions

View File

@ -0,0 +1,27 @@
-- Oct 15, 2012 6:21:27 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Load balancing instance name','U','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Oct 15, 2012 6:21:27 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200182 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 15, 2012 6:22:04 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'U','N','N','N',0,'N',40,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Load balancing instance name','Server Name','Y',100,TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0)
;
-- Oct 15, 2012 6:22:04 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200613 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 15, 2012 6:22:45 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
ALTER TABLE AD_Session ADD ServerName NVARCHAR2(40) DEFAULT NULL
;
SELECT register_migration_script('934_IDEMPIERE-389.sql') FROM dual
;

View File

@ -0,0 +1,27 @@
-- Oct 15, 2012 6:21:27 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Load balancing instance name','U','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Oct 15, 2012 6:21:27 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200182 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 15, 2012 6:22:04 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'U','N','N','N',0,'N',40,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Load balancing instance name','Server Name','Y',100,TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0)
;
-- Oct 15, 2012 6:22:04 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200613 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 15, 2012 6:22:45 PM IST
-- IDEMPIERE-389 Adding server name on AD_Session
ALTER TABLE AD_Session ADD COLUMN ServerName VARCHAR(40) DEFAULT NULL
;
SELECT register_migration_script('934_IDEMPIERE-389.sql') FROM dual
;

View File

@ -180,6 +180,15 @@ public interface I_AD_Session
*/
public String getRemote_Host();
/** Column name ServerName */
public static final String COLUMNNAME_ServerName = "ServerName";
/** Set Server name */
public void setServerName (String ServerName);
/** Get Server name */
public String getServerName();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";

View File

@ -148,6 +148,7 @@ public class MSession extends X_AD_Session
public MSession (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession, String trxName)
{
this (ctx, 0, trxName);
setServerName(Ini.getProperties().getProperty("ServerName"));
if (Remote_Addr != null)
setRemote_Addr(Remote_Addr);
if (Remote_Host != null)
@ -172,6 +173,7 @@ public class MSession extends X_AD_Session
try
{
InetAddress lh = InetAddress.getLocalHost();
setServerName(Ini.getProperties().getProperty("ServerName"));
setRemote_Addr(lh.getHostAddress());
setRemote_Host(lh.getHostName());
setDescription(Adempiere.MAIN_VERSION + "_"

View File

@ -220,6 +220,20 @@ public class X_AD_Session extends PO implements I_AD_Session, I_Persistent
return (String)get_Value(COLUMNNAME_Remote_Host);
}
/** Set Server name.
@param ServerName Server name */
public void setServerName (String ServerName)
{
set_Value (COLUMNNAME_ServerName, ServerName);
}
/** Get Server name.
@return Server name */
public String getServerName ()
{
return (String)get_Value(COLUMNNAME_ServerName);
}
/** Set Web Session.
@param WebSession
Web Session ID

View File

@ -141,6 +141,9 @@ public final class Ini implements Serializable
/** Role */
public static final String P_ROLE = "Role";
private static final String DEFAULT_ROLE = "";
/**Server Name */
public static final String P_SERVERNAME = "ServerName";
private static final String DEFAULT_SERVERNAME = "";
/** Client Name */
public static final String P_CLIENT = "Client";
private static final String DEFAULT_CLIENT = "";
@ -196,7 +199,7 @@ public final class Ini implements Serializable
P_ADEMPIERESYS, P_LOGMIGRATIONSCRIPT, P_SHOW_ACCT, P_SHOW_TRL,
P_SHOW_ADVANCED, P_CACHE_WINDOW,
P_CONTEXT, P_TEMP_DIR,
P_ROLE, P_CLIENT, P_ORG, P_PRINTER, P_WAREHOUSE, P_TODAY,
P_ROLE, P_SERVERNAME, P_CLIENT, P_ORG, P_PRINTER, P_WAREHOUSE, P_TODAY,
P_PRINTPREVIEW,
P_VALIDATE_CONNECTION_ON_STARTUP,
P_SINGLE_INSTANCE_PER_WINDOW,
@ -214,7 +217,7 @@ public final class Ini implements Serializable
DEFAULT_ADEMPIERESYS?"Y":"N", DEFAULT_LOGMIGRATIONSCRIPT?"Y":"N", DEFAULT_SHOW_ACCT?"Y":"N", DEFAULT_SHOW_TRL?"Y":"N",
DEFAULT_SHOW_ADVANCED?"Y":"N", DEFAULT_CACHE_WINDOW?"Y":"N",
DEFAULT_CONTEXT, DEFAULT_TEMP_DIR,
DEFAULT_ROLE, DEFAULT_CLIENT, DEFAULT_ORG, DEFAULT_PRINTER, DEFAULT_WAREHOUSE, DEFAULT_TODAY.toString(),
DEFAULT_ROLE, DEFAULT_SERVERNAME, DEFAULT_CLIENT, DEFAULT_ORG, DEFAULT_PRINTER, DEFAULT_WAREHOUSE, DEFAULT_TODAY.toString(),
DEFAULT_PRINTPREVIEW?"Y":"N",
DEFAULT_VALIDATE_CONNECTION_ON_STARTUP?"Y":"N",
DEFAULT_SINGLE_INSTANCE_PER_WINDOW?"Y":"N",

View File

@ -154,6 +154,9 @@ public class WebLogin
*/
public boolean action() throws IOException, ServletException
{
//remote Address
String remoteIP = m_request.getHeader("X-Forwarded-For");
remoteIP = remoteIP!=null ? remoteIP : m_request.getRemoteAddr();
// Mode
if (getMode() == null)
{
@ -228,7 +231,7 @@ public class WebLogin
if (m_forward==null || m_forward.equals(getLogin_RelURL ()))
m_forward = "/index.jsp";
// Create Session with User ID
MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
MSession cSession = MSession.get (m_ctx, remoteIP,
m_request.getRemoteHost(), m_session.getId());
if (cSession != null)
cSession.setWebStoreSession(true);
@ -275,7 +278,7 @@ public class WebLogin
// Create / set session
if (m_wu.isLoggedIn())
{
MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
MSession cSession = MSession.get (m_ctx, remoteIP,
m_request.getRemoteHost(), m_session.getId());
if (cSession != null)
cSession.setWebStoreSession(true);
@ -312,7 +315,7 @@ public class WebLogin
{
m_session.setAttribute (WebInfo.NAME, new WebInfo (m_ctx, m_wu));
// Create / set session
MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
MSession cSession = MSession.get (m_ctx, remoteIP,
m_request.getRemoteHost(), m_session.getId());
if (cSession != null)
cSession.setWebStoreSession(true);
@ -380,7 +383,7 @@ public class WebLogin
return false;
}
MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(), m_request.getRemoteHost(), m_session.getId());
MSession cSession = MSession.get (m_ctx, remoteIP, m_request.getRemoteHost(), m_session.getId());
if (cSession != null)
cSession.setWebStoreSession(true);

View File

@ -157,7 +157,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
/**************************************************************************
* Process Online (sales only) - if approved - exit
*/
private void processOnline()
public void processOnline()
{
ValueNamePair vp = (ValueNamePair)kTypeCombo.getSelectedItem();
String CCType = vp.getValue();

View File

@ -202,10 +202,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
// Create adempiere Session - user id in ctx
Session currSess = Executions.getCurrent().getDesktop().getSession();
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
String x_Forward_IP = Executions.getCurrent().getHeader("X-Forwarded-For");
MSession mSession = MSession.get (ctx, x_Forward_IP!=null ? x_Forward_IP : currSess.getRemoteAddr(),
currSess.getRemoteHost(), httpSess.getId() );
MSession mSession = MSession.get (ctx, currSess.getRemoteAddr(),
currSess.getRemoteHost(), httpSess.getId() );
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
//enable full interface, relook into this when doing preference

View File

@ -155,14 +155,6 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
}
public void runProcessOnline() {
try {
processOnline();
} finally {
window.unlockUI();
}
}
@Override
public boolean checkMandatory() {
@ -186,10 +178,8 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
return true;
}
/**************************************************************************
* Process Online (sales only) - if approved - exit
*/
private void processOnline()
@Override
public void processOnline()
{
log.config("");
if (!checkMandatory())

View File

@ -95,6 +95,14 @@ public class WPaymentFormWindow extends Window implements EventListener<Event>,
} // actionPerformed
public void runProcessOnline() {
try {
paymentForm.processOnline();
} finally {
unlockUI();
}
}
public void unlockUI() {
if (!m_isLocked) return;

View File

@ -275,6 +275,11 @@ public abstract class PaymentForm implements IPaymentForm {
return retValue;
} // getInvoiceID
public void processOnline()
{
}
public GridTab getGridTab()
{
return m_mTab;