IDEMPIERE-4251 Constant definition for all Env Context (#519)
* IDEMPIERE-4251 Constant definition for all Env Context replace "#Date" with Env.DATE * IDEMPIERE-4251 Constant definition for all Env Context replace "#.." with constant at Env * IDEMPIERE-4251 Constant definition for all Env Context Merge patch from Carlos
This commit is contained in:
parent
e4ee47f92d
commit
d96199a2b6
|
@ -168,7 +168,7 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
mTab.setValue("M_PriceList_ID", ii);
|
mTab.setValue("M_PriceList_ID", ii);
|
||||||
else
|
else
|
||||||
{ // get default PriceList
|
{ // get default PriceList
|
||||||
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
|
int i = Env.getContextAsInt(ctx, Env.M_PRICELIST_ID);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
MPriceList pl = new MPriceList(ctx, i, null);
|
MPriceList pl = new MPriceList(ctx, i, null);
|
||||||
|
@ -484,7 +484,7 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
int AD_Org_ID = Env.getContextAsInt(ctx, WindowNo, "AD_Org_ID");
|
int AD_Org_ID = Env.getContextAsInt(ctx, WindowNo, "AD_Org_ID");
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Org=" + AD_Org_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("Org=" + AD_Org_ID);
|
||||||
|
|
||||||
int M_Warehouse_ID = Env.getContextAsInt(ctx, "#M_Warehouse_ID");
|
int M_Warehouse_ID = Env.getContextAsInt(ctx, Env.M_WAREHOUSE_ID);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Warehouse=" + M_Warehouse_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("Warehouse=" + M_Warehouse_ID);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -313,7 +313,7 @@ public class CalloutInvoiceBatch extends CalloutEngine
|
||||||
int AD_Org_ID = Env.getContextAsInt(ctx, WindowNo, "AD_Org_ID");
|
int AD_Org_ID = Env.getContextAsInt(ctx, WindowNo, "AD_Org_ID");
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Org=" + AD_Org_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("Org=" + AD_Org_ID);
|
||||||
|
|
||||||
int M_Warehouse_ID = Env.getContextAsInt(ctx, "#M_Warehouse_ID");
|
int M_Warehouse_ID = Env.getContextAsInt(ctx, Env.M_WAREHOUSE_ID);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Warehouse=" + M_Warehouse_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("Warehouse=" + M_Warehouse_ID);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -286,7 +286,7 @@ public class CalloutOrder extends CalloutEngine
|
||||||
mTab.setValue("M_PriceList_ID", ii);
|
mTab.setValue("M_PriceList_ID", ii);
|
||||||
else
|
else
|
||||||
{ // get default PriceList
|
{ // get default PriceList
|
||||||
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
|
int i = Env.getContextAsInt(ctx, Env.M_PRICELIST_ID);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
MPriceList pl = new MPriceList(ctx, i, null);
|
MPriceList pl = new MPriceList(ctx, i, null);
|
||||||
|
@ -493,7 +493,7 @@ public class CalloutOrder extends CalloutEngine
|
||||||
mTab.setValue("M_PriceList_ID", ii);
|
mTab.setValue("M_PriceList_ID", ii);
|
||||||
else
|
else
|
||||||
{ // get default PriceList
|
{ // get default PriceList
|
||||||
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
|
int i = Env.getContextAsInt(ctx, Env.M_PRICELIST_ID);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
MPriceList pl = new MPriceList(ctx, i, null);
|
MPriceList pl = new MPriceList(ctx, i, null);
|
||||||
|
|
|
@ -346,7 +346,7 @@ public class CalloutPayment extends CalloutEngine
|
||||||
}
|
}
|
||||||
else if (baseCurrencyRate.signum() == 0)
|
else if (baseCurrencyRate.signum() == 0)
|
||||||
{
|
{
|
||||||
int baseCurrencyId = Env.getContextAsInt(ctx, "$C_Currency_ID");
|
int baseCurrencyId = Env.getContextAsInt(ctx, Env.C_CURRENCY_ID);
|
||||||
Timestamp dateAcct = (Timestamp) mTab.getValue(I_C_Payment.COLUMNNAME_DateAcct);
|
Timestamp dateAcct = (Timestamp) mTab.getValue(I_C_Payment.COLUMNNAME_DateAcct);
|
||||||
baseCurrencyRate = MConversionRate.getRate(C_Currency_ID, baseCurrencyId, dateAcct, C_ConversionType_ID, AD_Client_ID, AD_Org_ID);
|
baseCurrencyRate = MConversionRate.getRate(C_Currency_ID, baseCurrencyId, dateAcct, C_ConversionType_ID, AD_Client_ID, AD_Org_ID);
|
||||||
if (baseCurrencyRate == null)
|
if (baseCurrencyRate == null)
|
||||||
|
@ -592,7 +592,7 @@ public class CalloutPayment extends CalloutEngine
|
||||||
Boolean override = (Boolean)(colName.equals(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate) ? value : mTab.getValue(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate));
|
Boolean override = (Boolean)(colName.equals(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate) ? value : mTab.getValue(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate));
|
||||||
if (override == null)
|
if (override == null)
|
||||||
override = Boolean.FALSE;
|
override = Boolean.FALSE;
|
||||||
int baseCurrencyId = Env.getContextAsInt(ctx, "$C_Currency_ID");
|
int baseCurrencyId = Env.getContextAsInt(ctx, Env.C_CURRENCY_ID);
|
||||||
if (baseCurrencyId == C_Currency_ID) {
|
if (baseCurrencyId == C_Currency_ID) {
|
||||||
mTab.setValue(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate, false);
|
mTab.setValue(I_C_Payment.COLUMNNAME_IsOverrideCurrencyRate, false);
|
||||||
mTab.setValue(I_C_Payment.COLUMNNAME_CurrencyRate, null);
|
mTab.setValue(I_C_Payment.COLUMNNAME_CurrencyRate, null);
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class CalloutTimeExpense extends CalloutEngine
|
||||||
// get values
|
// get values
|
||||||
BigDecimal ExpenseAmt = (BigDecimal)mTab.getValue("ExpenseAmt");
|
BigDecimal ExpenseAmt = (BigDecimal)mTab.getValue("ExpenseAmt");
|
||||||
Integer C_Currency_From_ID = (Integer)mTab.getValue("C_Currency_ID");
|
Integer C_Currency_From_ID = (Integer)mTab.getValue("C_Currency_ID");
|
||||||
int C_Currency_To_ID = Env.getContextAsInt(ctx, "$C_Currency_ID");
|
int C_Currency_To_ID = Env.getContextAsInt(ctx, Env.C_CURRENCY_ID);
|
||||||
Timestamp DateExpense = Env.getContextAsDate(ctx, WindowNo, "DateExpense");
|
Timestamp DateExpense = Env.getContextAsDate(ctx, WindowNo, "DateExpense");
|
||||||
//
|
//
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Amt=" + ExpenseAmt + ", C_Currency_ID=" + C_Currency_From_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("Amt=" + ExpenseAmt + ", C_Currency_ID=" + C_Currency_From_ID);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class ImmediateBankTransfer extends SvrProcess
|
||||||
|
|
||||||
// Login Date
|
// Login Date
|
||||||
if (p_StatementDate == null)
|
if (p_StatementDate == null)
|
||||||
p_StatementDate = Env.getContextAsDate(getCtx(), "#Date");
|
p_StatementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (p_StatementDate == null)
|
if (p_StatementDate == null)
|
||||||
p_StatementDate = new Timestamp(System.currentTimeMillis());
|
p_StatementDate = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class InOutGenerateRMA extends SvrProcess
|
||||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_movementDate = Env.getContextAsDate(getCtx(), "#Date");
|
m_movementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (m_movementDate == null)
|
if (m_movementDate == null)
|
||||||
{
|
{
|
||||||
m_movementDate = new Timestamp(System.currentTimeMillis());
|
m_movementDate = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class InvoiceGenerateRMA extends SvrProcess
|
||||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dateinvoiced = Env.getContextAsDate(getCtx(), "#Date");
|
m_dateinvoiced = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (m_dateinvoiced == null)
|
if (m_dateinvoiced == null)
|
||||||
{
|
{
|
||||||
m_dateinvoiced = new Timestamp(System.currentTimeMillis());
|
m_dateinvoiced = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
|
@ -132,14 +132,14 @@ public class ConvertLead extends SvrProcess {
|
||||||
if ( p_C_Currency_ID > 0 )
|
if ( p_C_Currency_ID > 0 )
|
||||||
op.setC_Currency_ID(p_C_Currency_ID);
|
op.setC_Currency_ID(p_C_Currency_ID);
|
||||||
else
|
else
|
||||||
op.setC_Currency_ID(Env.getContextAsInt(getCtx(), "$C_Currency_ID"));
|
op.setC_Currency_ID(Env.getContextAsInt(getCtx(), Env.C_CURRENCY_ID));
|
||||||
|
|
||||||
if (p_SalesRep_ID > 0 )
|
if (p_SalesRep_ID > 0 )
|
||||||
op.setSalesRep_ID(p_SalesRep_ID);
|
op.setSalesRep_ID(p_SalesRep_ID);
|
||||||
else if ( lead.getSalesRep_ID() > 0 )
|
else if ( lead.getSalesRep_ID() > 0 )
|
||||||
op.setSalesRep_ID(lead.getSalesRep_ID());
|
op.setSalesRep_ID(lead.getSalesRep_ID());
|
||||||
else
|
else
|
||||||
op.setSalesRep_ID(Env.getContextAsInt(getCtx(), "#SalesRep_ID"));
|
op.setSalesRep_ID(Env.getContextAsInt(getCtx(), Env.SALESREP_ID));
|
||||||
|
|
||||||
op.setC_Campaign_ID(lead.getC_Campaign_ID());
|
op.setC_Campaign_ID(lead.getC_Campaign_ID());
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class InOutGenerate extends SvrProcess
|
||||||
|
|
||||||
// juddm - added ability to specify a shipment date from Generate Shipments
|
// juddm - added ability to specify a shipment date from Generate Shipments
|
||||||
if (p_DateShipped == null) {
|
if (p_DateShipped == null) {
|
||||||
m_movementDate = Env.getContextAsDate(getCtx(), "#Date");
|
m_movementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (m_movementDate == null)
|
if (m_movementDate == null)
|
||||||
m_movementDate = new Timestamp(System.currentTimeMillis());
|
m_movementDate = new Timestamp(System.currentTimeMillis());
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class InvoiceGenerate extends SvrProcess
|
||||||
|
|
||||||
// Login Date
|
// Login Date
|
||||||
if (p_DateInvoiced == null)
|
if (p_DateInvoiced == null)
|
||||||
p_DateInvoiced = Env.getContextAsDate(getCtx(), "#Date");
|
p_DateInvoiced = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (p_DateInvoiced == null)
|
if (p_DateInvoiced == null)
|
||||||
p_DateInvoiced = new Timestamp(System.currentTimeMillis());
|
p_DateInvoiced = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class OrderLineCreateProduction extends SvrProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_MovementDate == null)
|
if (p_MovementDate == null)
|
||||||
p_MovementDate = Env.getContextAsDate(getCtx(), "#Date");
|
p_MovementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if ( p_MovementDate==null)
|
if ( p_MovementDate==null)
|
||||||
p_MovementDate = new Timestamp(System.currentTimeMillis());
|
p_MovementDate = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class OrderLineCreateShipment extends SvrProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_MovementDate == null)
|
if (p_MovementDate == null)
|
||||||
p_MovementDate = Env.getContextAsDate(getCtx(), "#Date");
|
p_MovementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if ( p_MovementDate==null)
|
if ( p_MovementDate==null)
|
||||||
p_MovementDate = new Timestamp(System.currentTimeMillis());
|
p_MovementDate = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
|
@ -835,7 +835,7 @@ public class ReplenishReportProduction extends SvrProcess
|
||||||
production.setM_Locator_ID(wh.getDefaultLocator().get_ID());
|
production.setM_Locator_ID(wh.getDefaultLocator().get_ID());
|
||||||
production.setM_Product_ID(replenish.getM_Product_ID());
|
production.setM_Product_ID(replenish.getM_Product_ID());
|
||||||
production.setProductionQty(qty);
|
production.setProductionQty(qty);
|
||||||
production.setMovementDate(Env.getContextAsDate(getCtx(), "#Date"));
|
production.setMovementDate(Env.getContextAsDate(getCtx(), Env.DATE));
|
||||||
production.saveEx();
|
production.saveEx();
|
||||||
|
|
||||||
production.createLines(false);
|
production.createLines(false);
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class ChartBuilder {
|
||||||
hasWhere = true;
|
hasWhere = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Date currentDate = Env.getContextAsDate(Env.getCtx(), "#Date");
|
Date currentDate = Env.getContextAsDate(Env.getCtx(), Env.DATE);
|
||||||
Date startDate = null;
|
Date startDate = null;
|
||||||
Date endDate = null;
|
Date endDate = null;
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
||||||
if (checkChange(r, ra, "SalesRep_ID"))
|
if (checkChange(r, ra, "SalesRep_ID"))
|
||||||
{
|
{
|
||||||
// Sender
|
// Sender
|
||||||
int AD_User_ID = Env.getContextAsInt(r.getCtx(), "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(r.getCtx(), Env.AD_USER_ID);
|
||||||
if (AD_User_ID == 0)
|
if (AD_User_ID == 0)
|
||||||
AD_User_ID = r.getUpdatedBy();
|
AD_User_ID = r.getUpdatedBy();
|
||||||
// Old
|
// Old
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class MatchInvReverse extends SvrProcess {
|
||||||
|
|
||||||
if (inv.isProcessed())
|
if (inv.isProcessed())
|
||||||
{
|
{
|
||||||
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
|
Timestamp reversalDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MatchPOReverse extends SvrProcess {
|
||||||
throw new AdempiereException("@NotFound@ @M_MatchPO_ID@ " + p_M_MatchPO_ID);
|
throw new AdempiereException("@NotFound@ @M_MatchPO_ID@ " + p_M_MatchPO_ID);
|
||||||
if (po.isProcessed())
|
if (po.isProcessed())
|
||||||
{
|
{
|
||||||
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
|
Timestamp reversalDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class MigrateData
|
||||||
String DownloadURL = rs.getString(5);
|
String DownloadURL = rs.getString(5);
|
||||||
//
|
//
|
||||||
Properties ctx = new Properties (Env.getCtx());
|
Properties ctx = new Properties (Env.getCtx());
|
||||||
Env.setContext(ctx, "#AD_Client_ID", AD_Client_ID);
|
Env.setContext(ctx, Env.AD_CLIENT_ID, AD_Client_ID);
|
||||||
Env.setContext(ctx, "AD_Client_ID", AD_Client_ID);
|
Env.setContext(ctx, "AD_Client_ID", AD_Client_ID);
|
||||||
Env.setContext(ctx, "#AD_Org_ID", AD_Org_ID);
|
Env.setContext(ctx, Env.AD_ORG_ID, AD_Org_ID);
|
||||||
Env.setContext(ctx, "AD_Org_ID", AD_Org_ID);
|
Env.setContext(ctx, "AD_Org_ID", AD_Org_ID);
|
||||||
MProductDownload pdl = new MProductDownload(ctx, 0, null);
|
MProductDownload pdl = new MProductDownload(ctx, 0, null);
|
||||||
pdl.setM_Product_ID(M_Product_ID);
|
pdl.setM_Product_ID(M_Product_ID);
|
||||||
|
|
|
@ -346,7 +346,7 @@ public abstract class Doc
|
||||||
p_Status = STATUS_Error;
|
p_Status = STATUS_Error;
|
||||||
m_as = as;
|
m_as = as;
|
||||||
m_ctx = new Properties(m_as.getCtx());
|
m_ctx = new Properties(m_as.getCtx());
|
||||||
m_ctx.setProperty("#AD_Client_ID", String.valueOf(m_as.getAD_Client_ID()));
|
m_ctx.setProperty(Env.AD_CLIENT_ID, String.valueOf(m_as.getAD_Client_ID()));
|
||||||
|
|
||||||
String className = clazz.getName();
|
String className = clazz.getName();
|
||||||
className = className.substring(className.lastIndexOf('.')+1);
|
className = className.substring(className.lastIndexOf('.')+1);
|
||||||
|
|
|
@ -2236,7 +2236,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public void loadLocks()
|
public void loadLocks()
|
||||||
{
|
{
|
||||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), Env.AD_USER_ID);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo + " - AD_User_ID=" + AD_User_ID);
|
if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo + " - AD_User_ID=" + AD_User_ID);
|
||||||
if (!canHaveAttachment())
|
if (!canHaveAttachment())
|
||||||
return;
|
return;
|
||||||
|
@ -2301,7 +2301,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public void lock (Properties ctx, int Record_ID, boolean lock)
|
public void lock (Properties ctx, int Record_ID, boolean lock)
|
||||||
{
|
{
|
||||||
int AD_User_ID = Env.getContextAsInt(ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(ctx, Env.AD_USER_ID);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Lock=" + lock + ", AD_User_ID=" + AD_User_ID
|
if (log.isLoggable(Level.FINE)) log.fine("Lock=" + lock + ", AD_User_ID=" + AD_User_ID
|
||||||
+ ", AD_Table_ID=" + m_vo.AD_Table_ID + ", Record_ID=" + Record_ID);
|
+ ", AD_Table_ID=" + m_vo.AD_Table_ID + ", Record_ID=" + Record_ID);
|
||||||
MPrivateAccess access = MPrivateAccess.get (ctx, AD_User_ID, m_vo.AD_Table_ID, Record_ID);
|
MPrivateAccess access = MPrivateAccess.get (ctx, AD_User_ID, m_vo.AD_Table_ID, Record_ID);
|
||||||
|
|
|
@ -101,9 +101,9 @@ public class GridTabVO implements Evaluatee, Serializable
|
||||||
private static boolean loadTabDetails (GridTabVO vo, ResultSet rs)
|
private static boolean loadTabDetails (GridTabVO vo, ResultSet rs)
|
||||||
{
|
{
|
||||||
MRole role = MRole.getDefault(vo.ctx, false);
|
MRole role = MRole.getDefault(vo.ctx, false);
|
||||||
boolean showTrl = "Y".equals(Env.getContext(vo.ctx, "#ShowTrl"));
|
boolean showTrl = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_TRANSLATION));
|
||||||
boolean showAcct = "Y".equals(Env.getContext(vo.ctx, "#ShowAcct"));
|
boolean showAcct = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_ACCOUNTING));
|
||||||
boolean showAdvanced = "Y".equals(Env.getContext(vo.ctx, "#ShowAdvanced"));
|
boolean showAdvanced = "Y".equals(Env.getContext(vo.ctx, Env.SHOW_ADVANCED));
|
||||||
// CLogger.get().warning("ShowTrl=" + showTrl + ", showAcct=" + showAcct);
|
// CLogger.get().warning("ShowTrl=" + showTrl + ", showAcct=" + showAcct);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1671,7 +1671,7 @@ public class GridTable extends AbstractTableModel
|
||||||
|
|
||||||
// Constants for Created/Updated(By)
|
// Constants for Created/Updated(By)
|
||||||
Timestamp now = new Timestamp(System.currentTimeMillis());
|
Timestamp now = new Timestamp(System.currentTimeMillis());
|
||||||
int user = Env.getContextAsInt(m_ctx, "#AD_User_ID");
|
int user = Env.getContextAsInt(m_ctx, Env.AD_USER_ID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* for every column
|
* for every column
|
||||||
|
|
|
@ -841,7 +841,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getDateAcct();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getDateAcct();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1067,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
||||||
description = Env.parseVariable(description, this, trxName, true);
|
description = Env.parseVariable(description, this, trxName, true);
|
||||||
description = Msg.parseTranslation(getCtx(), description);
|
description = Msg.parseTranslation(getCtx(), description);
|
||||||
} else
|
} else
|
||||||
description = Env.getContext(getCtx(), "#AD_User_Name"); // just to be sure
|
description = Env.getContext(getCtx(), Env.AD_USER_NAME); // just to be sure
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,7 +551,7 @@ public class MAsset extends X_A_Asset
|
||||||
//
|
//
|
||||||
// If date is null, use context #Date
|
// If date is null, use context #Date
|
||||||
if(date == null) {
|
if(date == null) {
|
||||||
date = Env.getContextAsDate(getCtx(), "#Date");
|
date = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class MIFixedAsset extends X_I_FixedAsset
|
||||||
Timestamp dateAcct = getDateAcct();
|
Timestamp dateAcct = getDateAcct();
|
||||||
if (dateAcct == null)
|
if (dateAcct == null)
|
||||||
{
|
{
|
||||||
dateAcct = Env.getContextAsDate(getCtx(), "#Date");
|
dateAcct = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
setDateAcct(dateAcct);
|
setDateAcct(dateAcct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2226,7 +2226,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
protected MInOut reverse(boolean accrual) {
|
protected MInOut reverse(boolean accrual) {
|
||||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getDateAcct();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getDateAcct();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
@ -2496,7 +2496,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
*/
|
*/
|
||||||
public int getC_Currency_ID ()
|
public int getC_Currency_ID ()
|
||||||
{
|
{
|
||||||
return Env.getContextAsInt(getCtx(),"$C_Currency_ID");
|
return Env.getContextAsInt(getCtx(),Env.C_CURRENCY_ID);
|
||||||
} // getC_Currency_ID
|
} // getC_Currency_ID
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -557,7 +557,7 @@ public class MInOutLine extends X_M_InOutLine
|
||||||
}
|
}
|
||||||
// UOM
|
// UOM
|
||||||
if (getC_UOM_ID() == 0)
|
if (getC_UOM_ID() == 0)
|
||||||
setC_UOM_ID (Env.getContextAsInt(getCtx(), "#C_UOM_ID"));
|
setC_UOM_ID (Env.getContextAsInt(getCtx(), Env.C_UOM_ID));
|
||||||
if (getC_UOM_ID() == 0)
|
if (getC_UOM_ID() == 0)
|
||||||
{
|
{
|
||||||
int C_UOM_ID = MUOM.getDefault_UOM_ID(getCtx());
|
int C_UOM_ID = MUOM.getDefault_UOM_ID(getCtx());
|
||||||
|
|
|
@ -988,7 +988,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
} // reverseCorrectIt
|
} // reverseCorrectIt
|
||||||
|
|
||||||
protected MInventory reverse(boolean accrual) {
|
protected MInventory reverse(boolean accrual) {
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getMovementDate();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getMovementDate();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -996,7 +996,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
// Price List
|
// Price List
|
||||||
if (getM_PriceList_ID() == 0)
|
if (getM_PriceList_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#M_PriceList_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.M_PRICELIST_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
{
|
{
|
||||||
MPriceList pl = new MPriceList(getCtx(), ii, null);
|
MPriceList pl = new MPriceList(getCtx(), ii, null);
|
||||||
|
@ -1021,13 +1021,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setC_Currency_ID (ii);
|
setC_Currency_ID (ii);
|
||||||
else
|
else
|
||||||
setC_Currency_ID(Env.getContextAsInt(getCtx(), "#C_Currency_ID"));
|
setC_Currency_ID(Env.getContextAsInt(getCtx(), Env.C_CURRENCY_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sales Rep
|
// Sales Rep
|
||||||
if (getSalesRep_ID() == 0)
|
if (getSalesRep_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#SalesRep_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.SALESREP_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setSalesRep_ID (ii);
|
setSalesRep_ID (ii);
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1041,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
// Payment Term
|
// Payment Term
|
||||||
if (getC_PaymentTerm_ID() == 0)
|
if (getC_PaymentTerm_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#C_PaymentTerm_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.C_PAYMENTTERM_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setC_PaymentTerm_ID (ii);
|
setC_PaymentTerm_ID (ii);
|
||||||
else
|
else
|
||||||
|
@ -2023,7 +2023,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
DB.getDatabase().forUpdate(bp, 0);
|
DB.getDatabase().forUpdate(bp, 0);
|
||||||
// Update total revenue and balance / credit limit (reversed on AllocationLine.processIt)
|
// Update total revenue and balance / credit limit (reversed on AllocationLine.processIt)
|
||||||
BigDecimal invAmt = null;
|
BigDecimal invAmt = null;
|
||||||
int baseCurrencyId = Env.getContextAsInt(getCtx(), "$C_Currency_ID");
|
int baseCurrencyId = Env.getContextAsInt(getCtx(), Env.C_CURRENCY_ID);
|
||||||
if (getC_Currency_ID() != baseCurrencyId && isOverrideCurrencyRate())
|
if (getC_Currency_ID() != baseCurrencyId && isOverrideCurrencyRate())
|
||||||
{
|
{
|
||||||
invAmt = getGrandTotal(true).multiply(getCurrencyRate());
|
invAmt = getGrandTotal(true).multiply(getCurrencyRate());
|
||||||
|
@ -2513,7 +2513,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
} // reverseCorrectIt
|
} // reverseCorrectIt
|
||||||
|
|
||||||
private MInvoice reverse(boolean accrual) {
|
private MInvoice reverse(boolean accrual) {
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getDateAcct();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getDateAcct();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
if (isDescription())
|
if (isDescription())
|
||||||
return true;
|
return true;
|
||||||
//
|
//
|
||||||
int M_Warehouse_ID = Env.getContextAsInt(getCtx(), "#M_Warehouse_ID");
|
int M_Warehouse_ID = Env.getContextAsInt(getCtx(), Env.M_WAREHOUSE_ID);
|
||||||
//
|
//
|
||||||
int C_Tax_ID = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID() , m_DateInvoiced, m_DateInvoiced,
|
int C_Tax_ID = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID() , m_DateInvoiced, m_DateInvoiced,
|
||||||
getAD_Org_ID(), M_Warehouse_ID,
|
getAD_Org_ID(), M_Warehouse_ID,
|
||||||
|
|
|
@ -875,7 +875,7 @@ public class MJournal extends X_GL_Journal implements DocAction
|
||||||
// Journal
|
// Journal
|
||||||
MJournal reverse = new MJournal (this);
|
MJournal reverse = new MJournal (this);
|
||||||
reverse.setGL_JournalBatch_ID(GL_JournalBatch_ID);
|
reverse.setGL_JournalBatch_ID(GL_JournalBatch_ID);
|
||||||
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
|
Timestamp reversalDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,7 +714,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
||||||
// Reverse it
|
// Reverse it
|
||||||
MJournalBatch reverse = new MJournalBatch (this);
|
MJournalBatch reverse = new MJournalBatch (this);
|
||||||
reverse.setC_Period_ID(0);
|
reverse.setC_Period_ID(0);
|
||||||
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
|
Timestamp reversalDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -833,7 +833,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
||||||
|
|
||||||
protected MMovement reverse(boolean accrual)
|
protected MMovement reverse(boolean accrual)
|
||||||
{
|
{
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getMovementDate();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getMovementDate();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -959,7 +959,7 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
// Default Warehouse
|
// Default Warehouse
|
||||||
if (getM_Warehouse_ID() == 0)
|
if (getM_Warehouse_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#M_Warehouse_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.M_WAREHOUSE_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setM_Warehouse_ID(ii);
|
setM_Warehouse_ID(ii);
|
||||||
else
|
else
|
||||||
|
@ -1025,13 +1025,13 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setC_Currency_ID (ii);
|
setC_Currency_ID (ii);
|
||||||
else
|
else
|
||||||
setC_Currency_ID(Env.getContextAsInt(getCtx(), "#C_Currency_ID"));
|
setC_Currency_ID(Env.getContextAsInt(getCtx(), Env.C_CURRENCY_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default Sales Rep
|
// Default Sales Rep
|
||||||
if (getSalesRep_ID() == 0)
|
if (getSalesRep_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#SalesRep_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.SALESREP_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setSalesRep_ID (ii);
|
setSalesRep_ID (ii);
|
||||||
}
|
}
|
||||||
|
@ -1043,7 +1043,7 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
// Default Payment Term
|
// Default Payment Term
|
||||||
if (getC_PaymentTerm_ID() == 0)
|
if (getC_PaymentTerm_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#C_PaymentTerm_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.C_PAYMENTTERM_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setC_PaymentTerm_ID(ii);
|
setC_PaymentTerm_ID(ii);
|
||||||
else
|
else
|
||||||
|
|
|
@ -2048,7 +2048,7 @@ public class MPayment extends X_C_Payment
|
||||||
DB.getDatabase().forUpdate(bp, 0);
|
DB.getDatabase().forUpdate(bp, 0);
|
||||||
// Update total balance to include this payment
|
// Update total balance to include this payment
|
||||||
BigDecimal payAmt = null;
|
BigDecimal payAmt = null;
|
||||||
int baseCurrencyId = Env.getContextAsInt(getCtx(), "$C_Currency_ID");
|
int baseCurrencyId = Env.getContextAsInt(getCtx(), Env.C_CURRENCY_ID);
|
||||||
if (getC_Currency_ID() != baseCurrencyId && isOverrideCurrencyRate())
|
if (getC_Currency_ID() != baseCurrencyId && isOverrideCurrencyRate())
|
||||||
{
|
{
|
||||||
payAmt = getConvertedAmt();
|
payAmt = getConvertedAmt();
|
||||||
|
@ -2700,7 +2700,7 @@ public class MPayment extends X_C_Payment
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Std Period open?
|
// Std Period open?
|
||||||
Timestamp dateAcct = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getDateAcct();
|
Timestamp dateAcct = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getDateAcct();
|
||||||
if (dateAcct == null) {
|
if (dateAcct == null) {
|
||||||
dateAcct = new Timestamp(System.currentTimeMillis());
|
dateAcct = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class MProduction extends X_M_Production implements DocAction {
|
||||||
setC_Activity_ID(project.getC_Activity_ID());
|
setC_Activity_ID(project.getC_Activity_ID());
|
||||||
setC_ProjectPhase_ID(line.getC_ProjectPhase_ID());
|
setC_ProjectPhase_ID(line.getC_ProjectPhase_ID());
|
||||||
setC_ProjectTask_ID(line.getC_ProjectTask_ID());
|
setC_ProjectTask_ID(line.getC_ProjectTask_ID());
|
||||||
setMovementDate( Env.getContextAsDate(p_ctx, "#Date"));
|
setMovementDate( Env.getContextAsDate(p_ctx, Env.DATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -704,7 +704,7 @@ public class MProduction extends X_M_Production implements DocAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MProduction reverse(boolean accrual) {
|
protected MProduction reverse(boolean accrual) {
|
||||||
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), "#Date") : getMovementDate();
|
Timestamp reversalDate = accrual ? Env.getContextAsDate(getCtx(), Env.DATE) : getMovementDate();
|
||||||
if (reversalDate == null) {
|
if (reversalDate == null) {
|
||||||
reversalDate = new Timestamp(System.currentTimeMillis());
|
reversalDate = new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,7 +817,7 @@ public class MRequest extends X_R_Request
|
||||||
return "RequestActionEMailNoFrom";
|
return "RequestActionEMailNoFrom";
|
||||||
|
|
||||||
// Check that UI user is Request User
|
// Check that UI user is Request User
|
||||||
// int realSalesRep_ID = Env.getContextAsInt (getCtx(), "#AD_User_ID");
|
// int realSalesRep_ID = Env.getContextAsInt (getCtx(), Env.AD_USER_ID);
|
||||||
// if (realSalesRep_ID != getSalesRep_ID())
|
// if (realSalesRep_ID != getSalesRep_ID())
|
||||||
// setSalesRep_ID(realSalesRep_ID);
|
// setSalesRep_ID(realSalesRep_ID);
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ public class MRequest extends X_R_Request
|
||||||
* private void sendTransferMessage ()
|
* private void sendTransferMessage ()
|
||||||
{
|
{
|
||||||
// Sender
|
// Sender
|
||||||
int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(p_ctx, Env.AD_USER_ID);
|
||||||
if (AD_User_ID == 0)
|
if (AD_User_ID == 0)
|
||||||
AD_User_ID = getUpdatedBy();
|
AD_User_ID = getUpdatedBy();
|
||||||
// Old
|
// Old
|
||||||
|
|
|
@ -86,8 +86,8 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
public static MRole getDefault (Properties ctx, boolean reload)
|
public static MRole getDefault (Properties ctx, boolean reload)
|
||||||
{
|
{
|
||||||
int AD_Role_ID = Env.getContextAsInt(ctx, "#AD_Role_ID");
|
int AD_Role_ID = Env.getContextAsInt(ctx, Env.AD_ROLE_ID);
|
||||||
int AD_User_ID = Env.getContextAsInt(ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(ctx, Env.AD_USER_ID);
|
||||||
// if (!Ini.isClient()) // none for Server
|
// if (!Ini.isClient()) // none for Server
|
||||||
// AD_User_ID = 0;
|
// AD_User_ID = 0;
|
||||||
MRole defaultRole = getDefaultRole();
|
MRole defaultRole = getDefaultRole();
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class MSession extends X_AD_Session
|
||||||
*/
|
*/
|
||||||
public static MSession get (Properties ctx, boolean createNew)
|
public static MSession get (Properties ctx, boolean createNew)
|
||||||
{
|
{
|
||||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
int AD_Session_ID = Env.getContextAsInt(ctx, Env.AD_SESSION_ID);
|
||||||
MSession session = null;
|
MSession session = null;
|
||||||
// Try to load
|
// Try to load
|
||||||
if (AD_Session_ID > 0 && s_sessions.contains(AD_Session_ID))
|
if (AD_Session_ID > 0 && s_sessions.contains(AD_Session_ID))
|
||||||
|
@ -73,7 +73,7 @@ public class MSession extends X_AD_Session
|
||||||
session = new MSession (ctx, null); // local session
|
session = new MSession (ctx, null); // local session
|
||||||
session.saveEx();
|
session.saveEx();
|
||||||
AD_Session_ID = session.getAD_Session_ID();
|
AD_Session_ID = session.getAD_Session_ID();
|
||||||
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
|
Env.setContext (ctx, Env.AD_SESSION_ID, AD_Session_ID);
|
||||||
s_sessions.add (Integer.valueOf(AD_Session_ID));
|
s_sessions.add (Integer.valueOf(AD_Session_ID));
|
||||||
}
|
}
|
||||||
return session;
|
return session;
|
||||||
|
@ -89,7 +89,7 @@ public class MSession extends X_AD_Session
|
||||||
*/
|
*/
|
||||||
public static MSession get (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession)
|
public static MSession get (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession)
|
||||||
{
|
{
|
||||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
int AD_Session_ID = Env.getContextAsInt(ctx, Env.AD_SESSION_ID);
|
||||||
MSession session = null;
|
MSession session = null;
|
||||||
// Try to load
|
// Try to load
|
||||||
if (AD_Session_ID > 0 && s_sessions.contains(AD_Session_ID))
|
if (AD_Session_ID > 0 && s_sessions.contains(AD_Session_ID))
|
||||||
|
@ -106,7 +106,7 @@ public class MSession extends X_AD_Session
|
||||||
session = new MSession (ctx, Remote_Addr, Remote_Host, WebSession, null); // remote session
|
session = new MSession (ctx, Remote_Addr, Remote_Host, WebSession, null); // remote session
|
||||||
session.saveEx();
|
session.saveEx();
|
||||||
AD_Session_ID = session.getAD_Session_ID();
|
AD_Session_ID = session.getAD_Session_ID();
|
||||||
Env.setContext(ctx, "#AD_Session_ID", AD_Session_ID);
|
Env.setContext(ctx, Env.AD_SESSION_ID, AD_Session_ID);
|
||||||
s_sessions.add(Integer.valueOf(AD_Session_ID));
|
s_sessions.add(Integer.valueOf(AD_Session_ID));
|
||||||
}
|
}
|
||||||
return session;
|
return session;
|
||||||
|
@ -164,8 +164,8 @@ public class MSession extends X_AD_Session
|
||||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||||
+ Adempiere.DATE_VERSION + " "
|
+ Adempiere.DATE_VERSION + " "
|
||||||
+ Adempiere.getImplementationVersion());
|
+ Adempiere.getImplementationVersion());
|
||||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
setAD_Role_ID(Env.getContextAsInt(ctx, Env.AD_ROLE_ID));
|
||||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
setLoginDate(Env.getContextAsDate(ctx, Env.DATE));
|
||||||
} // MSession
|
} // MSession
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,8 +185,8 @@ public class MSession extends X_AD_Session
|
||||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||||
+ Adempiere.DATE_VERSION + " "
|
+ Adempiere.DATE_VERSION + " "
|
||||||
+ Adempiere.getImplementationVersion());
|
+ Adempiere.getImplementationVersion());
|
||||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
setAD_Role_ID(Env.getContextAsInt(ctx, Env.AD_ROLE_ID));
|
||||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
setLoginDate(Env.getContextAsDate(ctx, Env.DATE));
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e)
|
catch (UnknownHostException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,7 +159,7 @@ public final class MSetup
|
||||||
}
|
}
|
||||||
int AD_Client_ID = m_client.getAD_Client_ID();
|
int AD_Client_ID = m_client.getAD_Client_ID();
|
||||||
Env.setContext(m_ctx, m_WindowNo, "AD_Client_ID", AD_Client_ID);
|
Env.setContext(m_ctx, m_WindowNo, "AD_Client_ID", AD_Client_ID);
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", AD_Client_ID);
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, AD_Client_ID);
|
||||||
|
|
||||||
// Standard Values
|
// Standard Values
|
||||||
m_stdValues = String.valueOf(AD_Client_ID) + ",0,'Y',getDate(),0,getDate(),0";
|
m_stdValues = String.valueOf(AD_Client_ID) + ",0,'Y',getDate(),0,getDate(),0";
|
||||||
|
@ -208,7 +208,7 @@ public final class MSetup
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Env.setContext(m_ctx, m_WindowNo, "AD_Org_ID", getAD_Org_ID());
|
Env.setContext(m_ctx, m_WindowNo, "AD_Org_ID", getAD_Org_ID());
|
||||||
Env.setContext(m_ctx, "#AD_Org_ID", getAD_Org_ID());
|
Env.setContext(m_ctx, Env.AD_ORG_ID, getAD_Org_ID());
|
||||||
m_stdValuesOrg = AD_Client_ID + "," + getAD_Org_ID() + ",'Y',getDate(),0,getDate(),0";
|
m_stdValuesOrg = AD_Client_ID + "," + getAD_Org_ID() + ",'Y',getDate(),0,getDate(),0";
|
||||||
// Info
|
// Info
|
||||||
m_info.append(Msg.translate(m_lang, "AD_Org_ID")).append("=").append(name).append("\n");
|
m_info.append(Msg.translate(m_lang, "AD_Org_ID")).append("=").append(name).append("\n");
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ public abstract class PO
|
||||||
String colName = p_info.getColumnName(i);
|
String colName = p_info.getColumnName(i);
|
||||||
// Set Standard Values
|
// Set Standard Values
|
||||||
if (colName.endsWith("tedBy"))
|
if (colName.endsWith("tedBy"))
|
||||||
m_newValues[i] = Integer.valueOf(Env.getContextAsInt(p_ctx, "#AD_User_ID"));
|
m_newValues[i] = Integer.valueOf(Env.getContextAsInt(p_ctx, Env.AD_USER_ID));
|
||||||
else if (colName.equals("Created") || colName.equals("Updated"))
|
else if (colName.equals("Created") || colName.equals("Updated"))
|
||||||
m_newValues[i] = new Timestamp (System.currentTimeMillis());
|
m_newValues[i] = new Timestamp (System.currentTimeMillis());
|
||||||
else if (colName.equals(p_info.getTableName() + "_ID")) // KeyColumn
|
else if (colName.equals(p_info.getTableName() + "_ID")) // KeyColumn
|
||||||
|
@ -2574,7 +2574,7 @@ public abstract class PO
|
||||||
// If no changes set UpdatedBy explicitly to ensure commit of lob
|
// If no changes set UpdatedBy explicitly to ensure commit of lob
|
||||||
if (!changes && !updatedBy)
|
if (!changes && !updatedBy)
|
||||||
{
|
{
|
||||||
int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(p_ctx, Env.AD_USER_ID);
|
||||||
set_ValueNoCheck("UpdatedBy", Integer.valueOf(AD_User_ID));
|
set_ValueNoCheck("UpdatedBy", Integer.valueOf(AD_User_ID));
|
||||||
sql.append("UpdatedBy=").append(AD_User_ID);
|
sql.append("UpdatedBy=").append(AD_User_ID);
|
||||||
changes = true;
|
changes = true;
|
||||||
|
@ -2753,7 +2753,7 @@ public abstract class PO
|
||||||
}
|
}
|
||||||
if (!updatedBy) // UpdatedBy not explicitly set
|
if (!updatedBy) // UpdatedBy not explicitly set
|
||||||
{
|
{
|
||||||
int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(p_ctx, Env.AD_USER_ID);
|
||||||
set_ValueNoCheck("UpdatedBy", Integer.valueOf(AD_User_ID));
|
set_ValueNoCheck("UpdatedBy", Integer.valueOf(AD_User_ID));
|
||||||
if (withValues)
|
if (withValues)
|
||||||
{
|
{
|
||||||
|
@ -4977,7 +4977,7 @@ public abstract class PO
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkValidContext() {
|
private void checkValidContext() {
|
||||||
if (getCtx().isEmpty() && getCtx().getProperty("#AD_Client_ID") == null)
|
if (getCtx().isEmpty() && getCtx().getProperty(Env.AD_CLIENT_ID) == null)
|
||||||
throw new AdempiereException("Context lost");
|
throw new AdempiereException("Context lost");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5016,9 +5016,9 @@ public abstract class PO
|
||||||
+" Env.AD_Client_ID="+envClientID
|
+" Env.AD_Client_ID="+envClientID
|
||||||
+" PO.AD_Client_ID="+poClientID
|
+" PO.AD_Client_ID="+poClientID
|
||||||
+" writing="+writing
|
+" writing="+writing
|
||||||
+" Session="+Env.getContext(getCtx(), "#AD_Session_ID"));
|
+" Session="+Env.getContext(getCtx(), Env.AD_SESSION_ID));
|
||||||
String message = "Cross tenant PO " + (writing ? "writing" : "reading") + " request detected from session "
|
String message = "Cross tenant PO " + (writing ? "writing" : "reading") + " request detected from session "
|
||||||
+ Env.getContext(getCtx(), "#AD_Session_ID") + " for table " + get_TableName()
|
+ Env.getContext(getCtx(), Env.AD_SESSION_ID) + " for table " + get_TableName()
|
||||||
+ " Record_ID=" + get_ID();
|
+ " Record_ID=" + get_ID();
|
||||||
throw new AdempiereException(message);
|
throw new AdempiereException(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class ScheduleUtil
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
pstmt.setTimestamp(1, startDay);
|
pstmt.setTimestamp(1, startDay);
|
||||||
pstmt.setTimestamp(2, endDay);
|
pstmt.setTimestamp(2, endDay);
|
||||||
pstmt.setInt(3, Env.getContextAsInt(m_ctx, "#C_Country_ID"));
|
pstmt.setInt(3, Env.getContextAsInt(m_ctx, Env.C_COUNTRY_ID));
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
|
|
@ -614,12 +614,12 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
*/
|
*/
|
||||||
private void unlock ()
|
private void unlock ()
|
||||||
{
|
{
|
||||||
boolean noContext = Env.getCtx().isEmpty() && Env.getCtx().getProperty("#AD_Client_ID") == null;
|
boolean noContext = Env.getCtx().isEmpty() && Env.getCtx().getProperty(Env.AD_CLIENT_ID) == null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//save logging info even if context is lost
|
//save logging info even if context is lost
|
||||||
if (noContext)
|
if (noContext)
|
||||||
Env.getCtx().put("#AD_Client_ID", m_pi.getAD_Client_ID());
|
Env.getCtx().put(Env.AD_CLIENT_ID, m_pi.getAD_Client_ID());
|
||||||
|
|
||||||
//clear interrupt signal so that we can unlock the ad_pinstance record
|
//clear interrupt signal so that we can unlock the ad_pinstance record
|
||||||
if (Thread.currentThread().isInterrupted())
|
if (Thread.currentThread().isInterrupted())
|
||||||
|
@ -646,7 +646,7 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (noContext)
|
if (noContext)
|
||||||
Env.getCtx().remove("#AD_Client_ID");
|
Env.getCtx().remove(Env.AD_CLIENT_ID);
|
||||||
}
|
}
|
||||||
} // unlock
|
} // unlock
|
||||||
|
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class FileUtil
|
||||||
String dt = sdf.format(cal.getTime());
|
String dt = sdf.format(cal.getTime());
|
||||||
String cleanName = subject.replaceAll("[ &/]", "");
|
String cleanName = subject.replaceAll("[ &/]", "");
|
||||||
String localFile = System.getProperty("java.io.tmpdir")
|
String localFile = System.getProperty("java.io.tmpdir")
|
||||||
+ System.getProperty("file.separator") + cleanName + "_" + dt + "_" + Env.getContext(Env.getCtx(), "#AD_Session_ID")
|
+ System.getProperty("file.separator") + cleanName + "_" + dt + "_" + Env.getContext(Env.getCtx(), Env.AD_SESSION_ID)
|
||||||
+ extension;
|
+ extension;
|
||||||
return localFile;
|
return localFile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,13 +522,13 @@ public class CLogMgt
|
||||||
sb.append(getMsg("Database")).append(eq) .append(getDatabaseInfo()).append(NL);
|
sb.append(getMsg("Database")).append(eq) .append(getDatabaseInfo()).append(NL);
|
||||||
sb.append(getMsg("Schema")).append(eq) .append(CConnection.get().getDbUid()).append(NL);
|
sb.append(getMsg("Schema")).append(eq) .append(CConnection.get().getDbUid()).append(NL);
|
||||||
//
|
//
|
||||||
sb.append(getMsg("AD_User_ID")).append(eq) .append(Env.getContext(Env.getCtx(), "#AD_User_Name")).append(NL);
|
sb.append(getMsg("AD_User_ID")).append(eq) .append(Env.getContext(Env.getCtx(), Env.AD_USER_NAME)).append(NL);
|
||||||
sb.append(getMsg("AD_Role_ID")).append(eq) .append(Env.getContext(Env.getCtx(), "#AD_Role_Name")).append(NL);
|
sb.append(getMsg("AD_Role_ID")).append(eq) .append(Env.getContext(Env.getCtx(), Env.AD_ROLE_NAME)).append(NL);
|
||||||
//
|
//
|
||||||
sb.append(getMsg("AD_Client_ID")).append(eq).append(Env.getContext(Env.getCtx(), "#AD_Client_Name")).append(NL);
|
sb.append(getMsg("AD_Client_ID")).append(eq).append(Env.getContext(Env.getCtx(), Env.AD_CLIENT_NAME)).append(NL);
|
||||||
sb.append(getMsg("AD_Org_ID")).append(eq) .append(Env.getContext(Env.getCtx(), "#AD_Org_Name")).append(NL);
|
sb.append(getMsg("AD_Org_ID")).append(eq) .append(Env.getContext(Env.getCtx(), Env.AD_ORG_NAME)).append(NL);
|
||||||
//
|
//
|
||||||
sb.append(getMsg("Date")).append(eq) .append(Env.getContext(Env.getCtx(), "#Date")).append(NL);
|
sb.append(getMsg("Date")).append(eq) .append(Env.getContext(Env.getCtx(), Env.DATE)).append(NL);
|
||||||
sb.append(getMsg("Printer")).append(eq) .append(Env.getContext(Env.getCtx(), "#Printer")).append(NL);
|
sb.append(getMsg("Printer")).append(eq) .append(Env.getContext(Env.getCtx(), "#Printer")).append(NL);
|
||||||
// Show Implementation Vendor / Version - teo_sarca, [ 1622855 ]
|
// Show Implementation Vendor / Version - teo_sarca, [ 1622855 ]
|
||||||
sb.append(getMsg("ImplementationVendor")).append(eq).append(org.compiere.Adempiere.getImplementationVendor()).append(NL);
|
sb.append(getMsg("ImplementationVendor")).append(eq).append(org.compiere.Adempiere.getImplementationVendor()).append(NL);
|
||||||
|
|
|
@ -444,7 +444,7 @@ public final class EMail implements Serializable
|
||||||
msg = msg.substring(0, index);
|
msg = msg.substring(0, index);
|
||||||
String cc = "??";
|
String cc = "??";
|
||||||
if (m_ctx != null)
|
if (m_ctx != null)
|
||||||
cc = m_ctx.getProperty("#AD_Client_ID");
|
cc = m_ctx.getProperty(Env.AD_CLIENT_ID);
|
||||||
msg += " - AD_Client_ID=" + cc;
|
msg += " - AD_Client_ID=" + cc;
|
||||||
}
|
}
|
||||||
String className = ex.getClass().getName();
|
String className = ex.getClass().getName();
|
||||||
|
|
|
@ -75,24 +75,64 @@ import org.compiere.process.SvrProcess;
|
||||||
*/
|
*/
|
||||||
public final class Env
|
public final class Env
|
||||||
{
|
{
|
||||||
public static final String STANDARD_REPORT_FOOTER_TRADEMARK_TEXT = "#STANDARD_REPORT_FOOTER_TRADEMARK_TEXT";
|
//Environments Constants
|
||||||
|
|
||||||
public static final String AD_ROLE_ID = "#AD_Role_ID";
|
|
||||||
|
|
||||||
public static final String AD_USER_ID = "#AD_User_ID";
|
|
||||||
|
|
||||||
public static final String AD_ORG_ID = "#AD_Org_ID";
|
|
||||||
|
|
||||||
public static final String AD_CLIENT_ID = "#AD_Client_ID";
|
public static final String AD_CLIENT_ID = "#AD_Client_ID";
|
||||||
|
public static final String AD_CLIENT_NAME = "#AD_Client_Name";
|
||||||
public static final String AD_ORG_NAME = "#AD_Org_Name";
|
public static final String AD_ORG_ID = "#AD_Org_ID";
|
||||||
|
public static final String AD_ORG_NAME = "#AD_Org_Name";
|
||||||
public static final String M_WAREHOUSE_ID = "#M_Warehouse_ID";
|
public static final String AD_PRINTCOLOR_ID = "#AD_PrintColor_ID";
|
||||||
|
public static final String AD_PRINTFONT_ID = "#AD_PrintFont_ID";
|
||||||
|
public static final String AD_PRINTPAPER_ID = "#AD_PrintPaper_ID";
|
||||||
|
public static final String AD_PRINTTABLEFORMAT_ID = "#AD_PrintTableFormat_ID";
|
||||||
|
public static final String AD_ROLE_ID = "#AD_Role_ID";
|
||||||
|
public static final String AD_ROLE_NAME = "#AD_Role_Name";
|
||||||
|
public static final String AD_SESSION_ID = "#AD_Session_ID";
|
||||||
|
public static final String AD_USER_ID = "#AD_User_ID";
|
||||||
|
public static final String AD_USER_NAME = "#AD_User_Name";
|
||||||
|
public static final String C_ACCTSCHEMA_ID = "$C_AcctSchema_ID";
|
||||||
|
public static final String C_BANKACCOUNT_ID = "#C_BankAccount_ID";
|
||||||
|
public static final String C_BP_GROUP_ID = "#C_BP_Group_ID";
|
||||||
|
public static final String C_CASHBOOK_ID = "#C_CashBook_ID";
|
||||||
|
public static final String C_CONVERSIONTYPE_ID = "#C_ConversionType_ID";
|
||||||
|
public static final String C_COUNTRY_ID = "#C_Country_ID";
|
||||||
|
public static final String C_CURRENCY_ID = "$C_Currency_ID";
|
||||||
|
public static final String C_DOCTYPETARGET_ID = "#C_DocTypeTarget_ID";
|
||||||
|
public static final String C_DUNNING_ID = "#C_Dunning_ID";
|
||||||
|
public static final String C_PAYMENTTERM_ID = "#C_PaymentTerm_ID";
|
||||||
|
public static final String C_REGION_ID = "#C_Region_ID";
|
||||||
|
public static final String C_TAXCATEGORY_ID = "#C_TaxCategory_ID";
|
||||||
|
public static final String C_TAX_ID = "#C_Tax_ID";
|
||||||
|
public static final String C_UOM_ID = "#C_UOM_ID";
|
||||||
|
public static final String DATE = "#Date";
|
||||||
|
public static final String DB_TYPE = "#DBType";
|
||||||
|
public static final String GL_CATEGORY_ID = "#GL_Category_ID";
|
||||||
|
public static final String HAS_ALIAS = "$HasAlias";
|
||||||
|
/** Context Language identifier */
|
||||||
|
public static final String LANGUAGE = "#AD_Language";
|
||||||
|
public static final String LANGUAGE_NAME = "#LanguageName";
|
||||||
|
public static final String LOCAL_HTTP_ADDRESS = "#LocalHttpAddr";
|
||||||
|
public static final String LOCALE = "#Locale";
|
||||||
|
public static final String M_PRICELIST_ID = "#M_PriceList_ID";
|
||||||
|
public static final String M_PRODUCT_CATEGORY_ID = "#M_Product_Category_ID";
|
||||||
|
public static final String M_WAREHOUSE_ID = "#M_Warehouse_ID";
|
||||||
|
/** Context for POS ID */
|
||||||
|
public static final String POS_ID = "#POS_ID";
|
||||||
|
public static final String R_STATUSCATEGORY_ID = "#R_StatusCategory_ID";
|
||||||
|
public static final String R_STATUS_ID = "#R_Status_ID";
|
||||||
public static final String RUNNING_UNIT_TESTING_TEST_CASE = "#RUNNING_UNIT_TESTING_TEST_CASE";
|
public static final String RUNNING_UNIT_TESTING_TEST_CASE = "#RUNNING_UNIT_TESTING_TEST_CASE";
|
||||||
|
public static final String SALESREP_ID = "#SalesRep_ID";
|
||||||
|
public static final String SHOW_ACCOUNTING = "#ShowAcct";
|
||||||
|
public static final String SHOW_ADVANCED = "#ShowAdvanced";
|
||||||
|
public static final String SHOW_TRANSLATION = "#ShowTrl";
|
||||||
|
public static final String STANDARD_PRECISION = "#StdPrecision";
|
||||||
|
public static final String STANDARD_REPORT_FOOTER_TRADEMARK_TEXT = "#STANDARD_REPORT_FOOTER_TRADEMARK_TEXT";
|
||||||
|
public static final String SYSTEM_NAME = "#System_Name";
|
||||||
|
public static final String UI_CLIENT = "#UIClient";
|
||||||
|
public static final String USER_LEVEL = "#User_Level";
|
||||||
|
|
||||||
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
|
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
|
||||||
|
|
||||||
|
|
||||||
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
||||||
|
|
||||||
public static int adWindowDummyID =200054;
|
public static int adWindowDummyID =200054;
|
||||||
|
@ -1013,12 +1053,6 @@ public final class Env
|
||||||
* Language issues
|
* Language issues
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Context Language identifier */
|
|
||||||
static public final String LANGUAGE = "#AD_Language";
|
|
||||||
|
|
||||||
/** Context for POS ID */
|
|
||||||
static public final String POS_ID = "#POS_ID";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Base Language
|
* Check Base Language
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -1154,8 +1188,7 @@ public final class Env
|
||||||
}
|
}
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String LOCALE = "#Locale";
|
|
||||||
/**
|
/**
|
||||||
* @param ctx
|
* @param ctx
|
||||||
* @return Locale
|
* @return Locale
|
||||||
|
@ -1356,9 +1389,9 @@ public final class Env
|
||||||
sb.append(name).append(" ");
|
sb.append(name).append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append(getContext(ctx, "#AD_User_Name")).append("@")
|
sb.append(getContext(ctx, Env.AD_USER_NAME)).append("@")
|
||||||
.append(getContext(ctx, "#AD_Client_Name")).append(".")
|
.append(getContext(ctx, Env.AD_CLIENT_NAME)).append(".")
|
||||||
.append(getContext(ctx, "#AD_Org_Name"))
|
.append(getContext(ctx, Env.AD_ORG_NAME))
|
||||||
.append(" [").append(CConnection.get().toString()).append("]");
|
.append(" [").append(CConnection.get().toString()).append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
} // getHeader
|
} // getHeader
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Login
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
Env.setContext(ctx, "#Date", "2000-01-01");
|
Env.setContext(ctx, Env.DATE, "2000-01-01");
|
||||||
// logger.exiting("Env", "initTest");
|
// logger.exiting("Env", "initTest");
|
||||||
return ctx;
|
return ctx;
|
||||||
} // testInit
|
} // testInit
|
||||||
|
@ -369,10 +369,10 @@ public class Login
|
||||||
if (!rs.next()) // no record found
|
if (!rs.next()) // no record found
|
||||||
if (force)
|
if (force)
|
||||||
{
|
{
|
||||||
Env.setContext(m_ctx, "#AD_User_Name", "System");
|
Env.setContext(m_ctx, Env.AD_USER_NAME, "System");
|
||||||
Env.setContext(m_ctx, "#AD_User_ID", "0");
|
Env.setContext(m_ctx, Env.AD_USER_ID, "0");
|
||||||
Env.setContext(m_ctx, "#AD_User_Description", "System Forced Login");
|
Env.setContext(m_ctx, "#AD_User_Description", "System Forced Login");
|
||||||
Env.setContext(m_ctx, "#User_Level", "S "); // Format 'SCO'
|
Env.setContext(m_ctx, Env.USER_LEVEL, "S "); // Format 'SCO'
|
||||||
Env.setContext(m_ctx, "#User_Client", "0"); // Format c1, c2, ...
|
Env.setContext(m_ctx, "#User_Client", "0"); // Format c1, c2, ...
|
||||||
Env.setContext(m_ctx, "#User_Org", "0"); // Format o1, o2, ...
|
Env.setContext(m_ctx, "#User_Org", "0"); // Format o1, o2, ...
|
||||||
retValue = new KeyNamePair[] {new KeyNamePair(0, "System Administrator")};
|
retValue = new KeyNamePair[] {new KeyNamePair(0, "System Administrator")};
|
||||||
|
@ -384,9 +384,9 @@ public class Login
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Env.setContext(m_ctx, "#AD_User_Name", app_user);
|
Env.setContext(m_ctx, Env.AD_USER_NAME, app_user);
|
||||||
Env.setContext(m_ctx, "#AD_User_ID", rs.getInt(1));
|
Env.setContext(m_ctx, Env.AD_USER_ID, rs.getInt(1));
|
||||||
Env.setContext(m_ctx, "#SalesRep_ID", rs.getInt(1));
|
Env.setContext(m_ctx, Env.SALESREP_ID, rs.getInt(1));
|
||||||
|
|
||||||
if (Ini.isClient())
|
if (Ini.isClient())
|
||||||
{
|
{
|
||||||
|
@ -485,11 +485,11 @@ public class Login
|
||||||
}
|
}
|
||||||
|
|
||||||
// Role Info
|
// Role Info
|
||||||
Env.setContext(m_ctx, "#AD_Role_ID", role.getKey());
|
Env.setContext(m_ctx, Env.AD_ROLE_ID, role.getKey());
|
||||||
Env.setContext(m_ctx, "#AD_Role_Name", role.getName());
|
Env.setContext(m_ctx, Env.AD_ROLE_NAME, role.getName());
|
||||||
Ini.setProperty(Ini.P_ROLE, role.getName());
|
Ini.setProperty(Ini.P_ROLE, role.getName());
|
||||||
// User Level
|
// User Level
|
||||||
Env.setContext(m_ctx, "#User_Level", rs.getString(1)); // Format 'SCO'
|
Env.setContext(m_ctx, Env.USER_LEVEL, rs.getString(1)); // Format 'SCO'
|
||||||
|
|
||||||
// load Clients
|
// load Clients
|
||||||
do
|
do
|
||||||
|
@ -529,11 +529,11 @@ public class Login
|
||||||
{
|
{
|
||||||
if (rol == null)
|
if (rol == null)
|
||||||
throw new IllegalArgumentException("Rol missing");
|
throw new IllegalArgumentException("Rol missing");
|
||||||
if (Env.getContext(m_ctx,"#AD_Client_ID").length() == 0) // could be number 0
|
if (Env.getContext(m_ctx,Env.AD_CLIENT_ID).length() == 0) // could be number 0
|
||||||
throw new UnsupportedOperationException("Missing Context #AD_Client_ID");
|
throw new UnsupportedOperationException("Missing Context #AD_Client_ID");
|
||||||
|
|
||||||
int AD_Client_ID = Env.getContextAsInt(m_ctx,"#AD_Client_ID");
|
int AD_Client_ID = Env.getContextAsInt(m_ctx,Env.AD_CLIENT_ID);
|
||||||
int AD_User_ID = Env.getContextAsInt(m_ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(m_ctx, Env.AD_USER_ID);
|
||||||
// s_log.fine("Client: " + client.toStringX() + ", AD_Role_ID=" + AD_Role_ID);
|
// s_log.fine("Client: " + client.toStringX() + ", AD_Role_ID=" + AD_Role_ID);
|
||||||
|
|
||||||
// get Client details for role
|
// get Client details for role
|
||||||
|
@ -571,11 +571,11 @@ public class Login
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Role Info
|
// Role Info
|
||||||
Env.setContext(m_ctx, "#AD_Role_ID", rol.getKey());
|
Env.setContext(m_ctx, Env.AD_ROLE_ID, rol.getKey());
|
||||||
Env.setContext(m_ctx, "#AD_Role_Name", rol.getName());
|
Env.setContext(m_ctx, Env.AD_ROLE_NAME, rol.getName());
|
||||||
Ini.setProperty(Ini.P_ROLE, rol.getName());
|
Ini.setProperty(Ini.P_ROLE, rol.getName());
|
||||||
// User Level
|
// User Level
|
||||||
Env.setContext(m_ctx, "#User_Level", rs.getString(1)); // Format 'SCO'
|
Env.setContext(m_ctx, Env.USER_LEVEL, rs.getString(1)); // Format 'SCO'
|
||||||
// load Orgs
|
// load Orgs
|
||||||
|
|
||||||
do{
|
do{
|
||||||
|
@ -830,7 +830,7 @@ public class Login
|
||||||
long today = System.currentTimeMillis();
|
long today = System.currentTimeMillis();
|
||||||
if (timestamp != null)
|
if (timestamp != null)
|
||||||
today = timestamp.getTime();
|
today = timestamp.getTime();
|
||||||
Env.setContext(m_ctx, "#Date", new java.sql.Timestamp(today));
|
Env.setContext(m_ctx, Env.DATE, new java.sql.Timestamp(today));
|
||||||
|
|
||||||
// Optional Printer
|
// Optional Printer
|
||||||
if (printerName == null)
|
if (printerName == null)
|
||||||
|
@ -845,19 +845,19 @@ public class Login
|
||||||
loadUserPreferences();
|
loadUserPreferences();
|
||||||
|
|
||||||
if (MRole.getDefault(m_ctx, false).isShowAcct())
|
if (MRole.getDefault(m_ctx, false).isShowAcct())
|
||||||
Env.setContext(m_ctx, "#ShowAcct", Ini.getProperty(Ini.P_SHOW_ACCT));
|
Env.setContext(m_ctx, Env.SHOW_ACCOUNTING, Ini.getProperty(Ini.P_SHOW_ACCT));
|
||||||
else
|
else
|
||||||
Env.setContext(m_ctx, "#ShowAcct", "N");
|
Env.setContext(m_ctx, Env.SHOW_ACCOUNTING, "N");
|
||||||
Env.setContext(m_ctx, "#ShowTrl", Ini.getProperty(Ini.P_SHOW_TRL));
|
Env.setContext(m_ctx, Env.SHOW_TRANSLATION, Ini.getProperty(Ini.P_SHOW_TRL));
|
||||||
Env.setContext(m_ctx, "#ShowAdvanced", MRole.getDefault().isAccessAdvanced());
|
Env.setContext(m_ctx, Env.SHOW_ADVANCED, MRole.getDefault().isAccessAdvanced());
|
||||||
|
|
||||||
String retValue = "";
|
String retValue = "";
|
||||||
int AD_Client_ID = Env.getContextAsInt(m_ctx, "#AD_Client_ID");
|
int AD_Client_ID = Env.getContextAsInt(m_ctx, Env.AD_CLIENT_ID);
|
||||||
int AD_Org_ID = org.getKey();
|
int AD_Org_ID = org.getKey();
|
||||||
|
|
||||||
// Other Settings
|
// Other Settings
|
||||||
Env.setContext(m_ctx, "#YYYY", "Y");
|
Env.setContext(m_ctx, "#YYYY", "Y");
|
||||||
Env.setContext(m_ctx, "#StdPrecision", 2);
|
Env.setContext(m_ctx, Env.STANDARD_PRECISION, 2);
|
||||||
|
|
||||||
// AccountSchema Info (first)
|
// AccountSchema Info (first)
|
||||||
String sql = "SELECT * "
|
String sql = "SELECT * "
|
||||||
|
@ -885,9 +885,9 @@ public class Login
|
||||||
{
|
{
|
||||||
// Accounting Info
|
// Accounting Info
|
||||||
C_AcctSchema_ID = rs.getInt("C_AcctSchema_ID");
|
C_AcctSchema_ID = rs.getInt("C_AcctSchema_ID");
|
||||||
Env.setContext(m_ctx, "$C_AcctSchema_ID", C_AcctSchema_ID);
|
Env.setContext(m_ctx, Env.C_ACCTSCHEMA_ID, C_AcctSchema_ID);
|
||||||
Env.setContext(m_ctx, "$C_Currency_ID", rs.getInt("C_Currency_ID"));
|
Env.setContext(m_ctx, Env.C_CURRENCY_ID, rs.getInt("C_Currency_ID"));
|
||||||
Env.setContext(m_ctx, "$HasAlias", rs.getString("HasAlias"));
|
Env.setContext(m_ctx, Env.HAS_ALIAS, rs.getString("HasAlias"));
|
||||||
}
|
}
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
|
@ -908,9 +908,9 @@ public class Login
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C_AcctSchema_ID = as.getC_AcctSchema_ID();
|
C_AcctSchema_ID = as.getC_AcctSchema_ID();
|
||||||
Env.setContext(m_ctx, "$C_AcctSchema_ID", C_AcctSchema_ID);
|
Env.setContext(m_ctx, Env.C_ACCTSCHEMA_ID, C_AcctSchema_ID);
|
||||||
Env.setContext(m_ctx, "$C_Currency_ID", as.getC_Currency_ID());
|
Env.setContext(m_ctx, Env.C_CURRENCY_ID, as.getC_Currency_ID());
|
||||||
Env.setContext(m_ctx, "$HasAlias", as.isHasAlias());
|
Env.setContext(m_ctx, Env.HAS_ALIAS, as.isHasAlias());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -999,7 +999,7 @@ public class Login
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
// Country
|
// Country
|
||||||
Env.setContext(m_ctx, "#C_Country_ID", MCountry.getDefault().getC_Country_ID());
|
Env.setContext(m_ctx, Env.C_COUNTRY_ID, MCountry.getDefault().getC_Country_ID());
|
||||||
// Call ModelValidators afterLoadPreferences - teo_sarca FR [ 1670025 ]
|
// Call ModelValidators afterLoadPreferences - teo_sarca FR [ 1670025 ]
|
||||||
ModelValidationEngine.get().afterLoadPreferences(m_ctx);
|
ModelValidationEngine.get().afterLoadPreferences(m_ctx);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -1343,7 +1343,7 @@ public class Login
|
||||||
user.setIsLocked(false);
|
user.setIsLocked(false);
|
||||||
user.setDateAccountLocked(null);
|
user.setDateAccountLocked(null);
|
||||||
user.setFailedLoginCount(0);
|
user.setFailedLoginCount(0);
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID());
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, user.getAD_Client_ID());
|
||||||
if (!user.save())
|
if (!user.save())
|
||||||
log.severe("Failed to unlock user account");
|
log.severe("Failed to unlock user account");
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1357,7 @@ public class Login
|
||||||
{
|
{
|
||||||
user.setIsLocked(true);
|
user.setIsLocked(true);
|
||||||
user.setDateAccountLocked(new Timestamp(now));
|
user.setDateAccountLocked(new Timestamp(now));
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID());
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, user.getAD_Client_ID());
|
||||||
if (!user.save())
|
if (!user.save())
|
||||||
log.severe("Failed to lock user account");
|
log.severe("Failed to lock user account");
|
||||||
}
|
}
|
||||||
|
@ -1466,7 +1466,7 @@ public class Login
|
||||||
{
|
{
|
||||||
user.setFailedLoginCount(0);
|
user.setFailedLoginCount(0);
|
||||||
user.setDateLastLogin(new Timestamp(now));
|
user.setDateLastLogin(new Timestamp(now));
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID());
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, user.getAD_Client_ID());
|
||||||
if (!user.save())
|
if (!user.save())
|
||||||
log.severe("Failed to update user record with date last login (" + user.getName() + " / clientID = " + user.getAD_Client_ID() + ")");
|
log.severe("Failed to update user record with date last login (" + user.getName() + " / clientID = " + user.getAD_Client_ID() + ")");
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1516,7 @@ public class Login
|
||||||
user.setFailedLoginCount(count);
|
user.setFailedLoginCount(count);
|
||||||
user.setIsLocked(reachMaxAttempt);
|
user.setIsLocked(reachMaxAttempt);
|
||||||
user.setDateAccountLocked(user.isLocked() ? new Timestamp(now) : null);
|
user.setDateAccountLocked(user.isLocked() ? new Timestamp(now) : null);
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID());
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, user.getAD_Client_ID());
|
||||||
if (!user.save())
|
if (!user.save())
|
||||||
log.severe("Failed to update user record with increase failed login count");
|
log.severe("Failed to update user record with increase failed login count");
|
||||||
}
|
}
|
||||||
|
@ -1614,22 +1614,22 @@ public class Login
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
//Client Info
|
//Client Info
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", client.getKey());
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, client.getKey());
|
||||||
Env.setContext(m_ctx, "#AD_Client_Name", client.getName());
|
Env.setContext(m_ctx, Env.AD_CLIENT_NAME, client.getName());
|
||||||
Ini.setProperty(Ini.P_CLIENT, client.getName());
|
Ini.setProperty(Ini.P_CLIENT, client.getName());
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getRoles
|
} // getRoles
|
||||||
|
|
||||||
public KeyNamePair[] getClients() {
|
public KeyNamePair[] getClients() {
|
||||||
|
|
||||||
if (Env.getContext(m_ctx,"#AD_User_ID").length() == 0){
|
if (Env.getContext(m_ctx,Env.AD_USER_ID).length() == 0){
|
||||||
throw new UnsupportedOperationException("Missing Context #AD_User_ID");
|
throw new UnsupportedOperationException("Missing Context #AD_User_ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
loginErrMsg = null;
|
loginErrMsg = null;
|
||||||
isPasswordExpired = false;
|
isPasswordExpired = false;
|
||||||
|
|
||||||
int AD_User_ID = Env.getContextAsInt(m_ctx, "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(m_ctx, Env.AD_USER_ID);
|
||||||
KeyNamePair[] retValue = null;
|
KeyNamePair[] retValue = null;
|
||||||
ArrayList<KeyNamePair> clientList = new ArrayList<KeyNamePair>();
|
ArrayList<KeyNamePair> clientList = new ArrayList<KeyNamePair>();
|
||||||
StringBuilder sql= new StringBuilder("SELECT DISTINCT cli.AD_Client_ID, cli.Name, u.AD_User_ID, u.Name");
|
StringBuilder sql= new StringBuilder("SELECT DISTINCT cli.AD_Client_ID, cli.Name, u.AD_User_ID, u.Name");
|
||||||
|
|
|
@ -754,7 +754,7 @@ public class WebUser
|
||||||
setPasswordOK (m_loggedIn, password);
|
setPasswordOK (m_loggedIn, password);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("success=" + m_loggedIn);
|
if (log.isLoggable(Level.FINE)) log.fine("success=" + m_loggedIn);
|
||||||
if (m_loggedIn)
|
if (m_loggedIn)
|
||||||
Env.setContext(m_ctx, "#AD_User_ID", getAD_User_ID());
|
Env.setContext(m_ctx, Env.AD_USER_ID, getAD_User_ID());
|
||||||
return m_loggedIn;
|
return m_loggedIn;
|
||||||
} // isLoggedIn
|
} // isLoggedIn
|
||||||
|
|
||||||
|
|
|
@ -967,7 +967,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
||||||
try {
|
try {
|
||||||
if (contextLost)
|
if (contextLost)
|
||||||
{
|
{
|
||||||
Env.getCtx().setProperty("#AD_Client_ID", (m_po != null ? Integer.toString(m_po.getAD_Client_ID()) : "0") );
|
Env.getCtx().setProperty(Env.AD_CLIENT_ID, (m_po != null ? Integer.toString(m_po.getAD_Client_ID()) : "0") );
|
||||||
m_state = new StateEngine(WFSTATE_Running);
|
m_state = new StateEngine(WFSTATE_Running);
|
||||||
setProcessed(true);
|
setProcessed(true);
|
||||||
setWFState (StateEngine.STATE_Aborted);
|
setWFState (StateEngine.STATE_Aborted);
|
||||||
|
@ -992,7 +992,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (contextLost)
|
if (contextLost)
|
||||||
Env.getCtx().remove("#AD_Client_ID");
|
Env.getCtx().remove(Env.AD_CLIENT_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -995,9 +995,9 @@ public class MWorkflow extends X_AD_Workflow implements ImmutablePOSupport
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID ", "11");
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, "11");
|
||||||
Env.setContext(Env.getCtx(), "#AD_Org_ID ", "11");
|
Env.setContext(Env.getCtx(), Env.AD_ORG_ID, "11");
|
||||||
Env.setContext(Env.getCtx(), "#AD_User_ID ", "100");
|
Env.setContext(Env.getCtx(), Env.AD_USER_ID, "100");
|
||||||
//
|
//
|
||||||
int AD_Workflow_ID = 115; // Requisition WF
|
int AD_Workflow_ID = 115; // Requisition WF
|
||||||
int M_Requsition_ID = 100;
|
int M_Requsition_ID = 100;
|
||||||
|
|
|
@ -607,7 +607,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
// Default Warehouse
|
// Default Warehouse
|
||||||
if (getM_Warehouse_ID() == 0)
|
if (getM_Warehouse_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#M_Warehouse_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.M_WAREHOUSE_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setM_Warehouse_ID(ii);
|
setM_Warehouse_ID(ii);
|
||||||
else
|
else
|
||||||
|
@ -637,7 +637,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
// Default Sales Rep
|
// Default Sales Rep
|
||||||
if (getSalesRep_ID() == 0)
|
if (getSalesRep_ID() == 0)
|
||||||
{
|
{
|
||||||
int ii = Env.getContextAsInt(getCtx(), "#AD_User_ID");
|
int ii = Env.getContextAsInt(getCtx(), Env.AD_USER_ID);
|
||||||
if (ii != 0)
|
if (ii != 0)
|
||||||
setSalesRep_ID (ii);
|
setSalesRep_ID (ii);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class BankTransfer extends SvrProcess
|
||||||
|
|
||||||
// Login Date
|
// Login Date
|
||||||
if (p_StatementDate == null)
|
if (p_StatementDate == null)
|
||||||
p_StatementDate = Env.getContextAsDate(getCtx(), "#Date");
|
p_StatementDate = Env.getContextAsDate(getCtx(), Env.DATE);
|
||||||
if (p_StatementDate == null)
|
if (p_StatementDate == null)
|
||||||
p_StatementDate = new Timestamp(System.currentTimeMillis());
|
p_StatementDate = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
else
|
else
|
||||||
packIn.setPackageName(symbolicName);
|
packIn.setPackageName(symbolicName);
|
||||||
|
|
||||||
if (Env.getCtx().getProperty("#AD_Client_ID") == null) {
|
if (Env.getCtx().getProperty(Env.AD_CLIENT_ID) == null) {
|
||||||
Env.getCtx().put("#AD_Client_ID", 0);
|
Env.getCtx().put(Env.AD_CLIENT_ID, 0);
|
||||||
}
|
}
|
||||||
//get package version from file name suffix or bundle header
|
//get package version from file name suffix or bundle header
|
||||||
String packageVersion = null;
|
String packageVersion = null;
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class PackInProcess extends SvrProcess {
|
||||||
packageDirectory = System.getProperty("java.io.tmpdir");
|
packageDirectory = System.getProperty("java.io.tmpdir");
|
||||||
}
|
}
|
||||||
|
|
||||||
String targetDirName = packageDirectory + File.separator + "packin" + Env.getContext(getCtx(), "#AD_User_ID");
|
String targetDirName = packageDirectory + File.separator + "packin" + Env.getContext(getCtx(), Env.AD_USER_ID);
|
||||||
File targetDir = new File(targetDirName);
|
File targetDir = new File(targetDirName);
|
||||||
|
|
||||||
if (targetDir.exists()) {
|
if (targetDir.exists()) {
|
||||||
|
@ -116,7 +116,7 @@ public class PackInProcess extends SvrProcess {
|
||||||
Zipper.unpackFile(zipFilepath, targetDir);
|
Zipper.unpackFile(zipFilepath, targetDir);
|
||||||
|
|
||||||
String dict_file = packageDirectory + File.separator
|
String dict_file = packageDirectory + File.separator
|
||||||
+ "packin" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator + parentDir + File.separator
|
+ "packin" + Env.getContext(getCtx(), Env.AD_USER_ID) + File.separator + parentDir + File.separator
|
||||||
+ "dict" + File.separator + "PackOut.xml";
|
+ "dict" + File.separator + "PackOut.xml";
|
||||||
|
|
||||||
if (log.isLoggable(Level.INFO)) log.info("dict file->" + dict_file);
|
if (log.isLoggable(Level.INFO)) log.info("dict file->" + dict_file);
|
||||||
|
@ -127,7 +127,7 @@ public class PackInProcess extends SvrProcess {
|
||||||
m_UpdateDictionary = false;
|
m_UpdateDictionary = false;
|
||||||
|
|
||||||
m_packageDirectory = packageDirectory + File.separator
|
m_packageDirectory = packageDirectory + File.separator
|
||||||
+ "packin" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator + parentDir + File.separator;
|
+ "packin" + Env.getContext(getCtx(), Env.AD_USER_ID) + File.separator + parentDir + File.separator;
|
||||||
|
|
||||||
PackIn packIn = new PackIn();
|
PackIn packIn = new PackIn();
|
||||||
packIn.setPackageDirectory(m_packageDirectory);
|
packIn.setPackageDirectory(m_packageDirectory);
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class PackOutProcess extends SvrProcess
|
||||||
packoutDirectory = System.getProperty("java.io.tmpdir");
|
packoutDirectory = System.getProperty("java.io.tmpdir");
|
||||||
if (!packoutDirectory.endsWith("/") && !packoutDirectory.endsWith("\\"))
|
if (!packoutDirectory.endsWith("/") && !packoutDirectory.endsWith("\\"))
|
||||||
packoutDirectory+= File.separator;
|
packoutDirectory+= File.separator;
|
||||||
packoutDirectory = packoutDirectory + "packout" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator;
|
packoutDirectory = packoutDirectory + "packout" + Env.getContext(getCtx(), Env.AD_USER_ID) + File.separator;
|
||||||
|
|
||||||
//create packout folder if needed
|
//create packout folder if needed
|
||||||
File packoutDirectoryFile = new File(packoutDirectory);
|
File packoutDirectoryFile = new File(packoutDirectory);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class AdempiereActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected void setupPackInContext() {
|
protected void setupPackInContext() {
|
||||||
Properties serverContext = new Properties();
|
Properties serverContext = new Properties();
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty(Env.AD_CLIENT_ID, "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class Incremental2PackActivator extends AbstractActivator {
|
||||||
Trx trx = Trx.get(Trx.createTrxName(), true);
|
Trx trx = Trx.get(Trx.createTrxName(), true);
|
||||||
trx.setDisplayName(getClass().getName()+"_packIn");
|
trx.setDisplayName(getClass().getName()+"_packIn");
|
||||||
try {
|
try {
|
||||||
Env.getCtx().put("#AD_Client_ID", 0);
|
Env.getCtx().put(Env.AD_CLIENT_ID, 0);
|
||||||
|
|
||||||
firstImp = new X_AD_Package_Imp(Env.getCtx(), 0, trx.getTrxName());
|
firstImp = new X_AD_Package_Imp(Env.getCtx(), 0, trx.getTrxName());
|
||||||
firstImp.setName(getName());
|
firstImp.setName(getName());
|
||||||
|
@ -256,7 +256,7 @@ public class Incremental2PackActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected void setupPackInContext() {
|
protected void setupPackInContext() {
|
||||||
Properties serverContext = new Properties();
|
Properties serverContext = new Properties();
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty(Env.AD_CLIENT_ID, "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class PackInApplicationActivator extends AbstractActivator{
|
||||||
try {
|
try {
|
||||||
if (getDBLock()) {
|
if (getDBLock()) {
|
||||||
//Create Session to be able to create records in AD_ChangeLog
|
//Create Session to be able to create records in AD_ChangeLog
|
||||||
if (Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID") <= 0)
|
if (Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID) <= 0)
|
||||||
MSession.get(Env.getCtx(), true);
|
MSession.get(Env.getCtx(), true);
|
||||||
for(File zipFile : fileArray) {
|
for(File zipFile : fileArray) {
|
||||||
currentFile = zipFile;
|
currentFile = zipFile;
|
||||||
|
@ -188,7 +188,7 @@ public class PackInApplicationActivator extends AbstractActivator{
|
||||||
String message = "Installing " + fileName + " in client " + client.getValue() + "/" + client.getName();
|
String message = "Installing " + fileName + " in client " + client.getValue() + "/" + client.getName();
|
||||||
statusUpdate(message);
|
statusUpdate(message);
|
||||||
}
|
}
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", client.getAD_Client_ID());
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, client.getAD_Client_ID());
|
||||||
try {
|
try {
|
||||||
// call 2pack
|
// call 2pack
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
|
@ -204,7 +204,7 @@ public class PackInApplicationActivator extends AbstractActivator{
|
||||||
logger.log(Level.WARNING, "Pack in failed.", e);
|
logger.log(Level.WARNING, "Pack in failed.", e);
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
Env.setContext(Env.getCtx(), "#AD_Client_ID", 0);
|
Env.setContext(Env.getCtx(), Env.AD_CLIENT_ID, 0);
|
||||||
}
|
}
|
||||||
logger.warning(packinFile.getPath() + " installed");
|
logger.warning(packinFile.getPath() + " installed");
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ public class PackInApplicationActivator extends AbstractActivator{
|
||||||
|
|
||||||
protected void setupPackInContext() {
|
protected void setupPackInContext() {
|
||||||
Properties serverContext = new Properties();
|
Properties serverContext = new Properties();
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty(Env.AD_CLIENT_ID, "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class Version2PackActivator extends AbstractActivator{
|
||||||
|
|
||||||
protected void setupPackInContext() {
|
protected void setupPackInContext() {
|
||||||
Properties serverContext = new Properties();
|
Properties serverContext = new Properties();
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty(Env.AD_CLIENT_ID, "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -98,14 +98,14 @@ public class ReplicationProcessor extends AdempiereServer {
|
||||||
// process is not started!
|
// process is not started!
|
||||||
|
|
||||||
// Prepare a ctx
|
// Prepare a ctx
|
||||||
Env.setContext(mImportProcessor.getCtx(), "#AD_Client_ID", mImportProcessor.getAD_Client_ID());
|
Env.setContext(mImportProcessor.getCtx(), Env.AD_CLIENT_ID, mImportProcessor.getAD_Client_ID());
|
||||||
Env.setContext(mImportProcessor.getCtx(), "#AD_Org_ID", mImportProcessor.getAD_Org_ID());
|
Env.setContext(mImportProcessor.getCtx(), Env.AD_ORG_ID, mImportProcessor.getAD_Org_ID());
|
||||||
if (mImportProcessor.getAD_Org_ID() != 0) {
|
if (mImportProcessor.getAD_Org_ID() != 0) {
|
||||||
MOrgInfo schedorg = MOrgInfo.get(getCtx(), mImportProcessor.getAD_Org_ID(), null);
|
MOrgInfo schedorg = MOrgInfo.get(getCtx(), mImportProcessor.getAD_Org_ID(), null);
|
||||||
if (schedorg.getM_Warehouse_ID() > 0)
|
if (schedorg.getM_Warehouse_ID() > 0)
|
||||||
Env.setContext(mImportProcessor.getCtx(), "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
Env.setContext(mImportProcessor.getCtx(), Env.M_WAREHOUSE_ID, schedorg.getM_Warehouse_ID());
|
||||||
}
|
}
|
||||||
Env.setContext(mImportProcessor.getCtx(), "#AD_User_ID", getAD_User_ID());
|
Env.setContext(mImportProcessor.getCtx(), Env.AD_USER_ID, getAD_User_ID());
|
||||||
|
|
||||||
m_summary = new StringBuffer();
|
m_summary = new StringBuffer();
|
||||||
String trxName = mImportProcessor.get_TrxName();
|
String trxName = mImportProcessor.get_TrxName();
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class ImportHelper {
|
||||||
|
|
||||||
if(po != null)
|
if(po != null)
|
||||||
{
|
{
|
||||||
Env.setContext(po.getCtx(), "#AD_Client_ID", po.getAD_Client_ID());
|
Env.setContext(po.getCtx(), Env.AD_CLIENT_ID, po.getAD_Client_ID());
|
||||||
|
|
||||||
if(MReplicationStrategy.REPLICATION_TABLE==ReplicationMode)
|
if(MReplicationStrategy.REPLICATION_TABLE==ReplicationMode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -422,7 +422,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (reportPath.startsWith("@#LocalHttpAddr@")) {
|
if (reportPath.startsWith("@#LocalHttpAddr@")) {
|
||||||
String localaddr = Env.getContext(Env.getCtx(), "#LocalHttpAddr");
|
String localaddr = Env.getContext(Env.getCtx(), Env.LOCAL_HTTP_ADDRESS);
|
||||||
if (!Util.isEmpty(localaddr)) {
|
if (!Util.isEmpty(localaddr)) {
|
||||||
reportPath = reportPath.replace("@#LocalHttpAddr@", localaddr);
|
reportPath = reportPath.replace("@#LocalHttpAddr@", localaddr);
|
||||||
}
|
}
|
||||||
|
@ -593,10 +593,10 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
params.put("AD_ROLE_ID", Integer.valueOf( Env.getAD_Role_ID(Env.getCtx())));
|
params.put("AD_ROLE_ID", Integer.valueOf( Env.getAD_Role_ID(Env.getCtx())));
|
||||||
params.put("AD_USER_ID", Integer.valueOf( Env.getAD_User_ID(Env.getCtx())));
|
params.put("AD_USER_ID", Integer.valueOf( Env.getAD_User_ID(Env.getCtx())));
|
||||||
|
|
||||||
params.put("AD_CLIENT_NAME", Env.getContext(Env.getCtx(), "#AD_Client_Name"));
|
params.put("AD_CLIENT_NAME", Env.getContext(Env.getCtx(), Env.AD_CLIENT_NAME));
|
||||||
params.put("AD_ROLE_NAME", Env.getContext(Env.getCtx(), "#AD_Role_Name"));
|
params.put("AD_ROLE_NAME", Env.getContext(Env.getCtx(), Env.AD_ROLE_NAME));
|
||||||
params.put("AD_USER_NAME", Env.getContext(Env.getCtx(), "#AD_User_Name"));
|
params.put("AD_USER_NAME", Env.getContext(Env.getCtx(), Env.AD_USER_NAME));
|
||||||
params.put("AD_ORG_NAME", Env.getContext(Env.getCtx(), "#AD_Org_Name"));
|
params.put("AD_ORG_NAME", Env.getContext(Env.getCtx(), Env.AD_ORG_NAME));
|
||||||
params.put("BASE_DIR", REPORT_HOME.getAbsolutePath());
|
params.put("BASE_DIR", REPORT_HOME.getAbsolutePath());
|
||||||
//params.put("HeaderLogo", reportPath);
|
//params.put("HeaderLogo", reportPath);
|
||||||
//params.put("LoginLogo", reportPath);
|
//params.put("LoginLogo", reportPath);
|
||||||
|
|
|
@ -77,23 +77,23 @@ public class AcctProcessor extends AdempiereServer
|
||||||
m_summary = new StringBuffer();
|
m_summary = new StringBuffer();
|
||||||
|
|
||||||
// Prepar ctx
|
// Prepar ctx
|
||||||
Env.setContext(getCtx(), "#AD_Client_ID", m_client.getAD_Client_ID());
|
Env.setContext(getCtx(), Env.AD_CLIENT_ID, m_client.getAD_Client_ID());
|
||||||
Env.setContext(getCtx(), "#AD_Language", m_client.getAD_Language());
|
Env.setContext(getCtx(), Env.LANGUAGE, m_client.getAD_Language());
|
||||||
Env.setContext(getCtx(), "#AD_Org_ID", m_model.getAD_Org_ID());
|
Env.setContext(getCtx(), Env.AD_ORG_ID, m_model.getAD_Org_ID());
|
||||||
if (m_model.getAD_Org_ID() != 0) {
|
if (m_model.getAD_Org_ID() != 0) {
|
||||||
MOrgInfo schedorg = MOrgInfo.get(getCtx(), m_model.getAD_Org_ID(), null);
|
MOrgInfo schedorg = MOrgInfo.get(getCtx(), m_model.getAD_Org_ID(), null);
|
||||||
if (schedorg.getM_Warehouse_ID() > 0)
|
if (schedorg.getM_Warehouse_ID() > 0)
|
||||||
Env.setContext(getCtx(), "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
Env.setContext(getCtx(), Env.M_WAREHOUSE_ID, schedorg.getM_Warehouse_ID());
|
||||||
}
|
}
|
||||||
Env.setContext(getCtx(), "#AD_User_ID", getAD_User_ID());
|
Env.setContext(getCtx(), Env.AD_USER_ID, getAD_User_ID());
|
||||||
Env.setContext(getCtx(), "#SalesRep_ID", getAD_User_ID());
|
Env.setContext(getCtx(), Env.SALESREP_ID, getAD_User_ID());
|
||||||
MUser scheduser = MUser.get(getCtx(), getAD_User_ID());
|
MUser scheduser = MUser.get(getCtx(), getAD_User_ID());
|
||||||
MRole[] schedroles = scheduser.getRoles(m_model.getAD_Org_ID());
|
MRole[] schedroles = scheduser.getRoles(m_model.getAD_Org_ID());
|
||||||
if (schedroles != null && schedroles.length > 0)
|
if (schedroles != null && schedroles.length > 0)
|
||||||
Env.setContext(getCtx(), "#AD_Role_ID", schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
Env.setContext(getCtx(), Env.AD_ROLE_ID, schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
Env.setContext(getCtx(), Env.DATE, dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||||
|
|
||||||
// Get Schemata
|
// Get Schemata
|
||||||
if (m_model.getC_AcctSchema_ID() == 0)
|
if (m_model.getC_AcctSchema_ID() == 0)
|
||||||
|
|
|
@ -155,30 +155,30 @@ public abstract class AdempiereServer implements Runnable
|
||||||
{
|
{
|
||||||
Properties context = new Properties();
|
Properties context = new Properties();
|
||||||
MClient schedclient = MClient.get(getCtx(), p_model.getAD_Client_ID());
|
MClient schedclient = MClient.get(getCtx(), p_model.getAD_Client_ID());
|
||||||
Env.setContext(context, "#AD_Client_ID", schedclient.getAD_Client_ID());
|
Env.setContext(context, Env.AD_CLIENT_ID, schedclient.getAD_Client_ID());
|
||||||
Env.setContext(context, "#AD_Language", schedclient.getAD_Language());
|
Env.setContext(context, Env.LANGUAGE, schedclient.getAD_Language());
|
||||||
if (p_model instanceof PO) {
|
if (p_model instanceof PO) {
|
||||||
PO po = (PO) p_model;
|
PO po = (PO) p_model;
|
||||||
if (po.get_ColumnIndex("AD_Org_ID") >= 0) {
|
if (po.get_ColumnIndex("AD_Org_ID") >= 0) {
|
||||||
Env.setContext(context, "#AD_Org_ID", po.get_ValueAsInt("AD_Org_ID"));
|
Env.setContext(context, Env.AD_ORG_ID, po.get_ValueAsInt("AD_Org_ID"));
|
||||||
MOrgInfo schedorg = new Query(context, MOrgInfo.Table_Name, "AD_Org_ID=?", null)
|
MOrgInfo schedorg = new Query(context, MOrgInfo.Table_Name, "AD_Org_ID=?", null)
|
||||||
.setParameters(po.get_ValueAsInt("AD_Org_ID")).first();
|
.setParameters(po.get_ValueAsInt("AD_Org_ID")).first();
|
||||||
if (schedorg != null && schedorg.getM_Warehouse_ID() > 0)
|
if (schedorg != null && schedorg.getM_Warehouse_ID() > 0)
|
||||||
Env.setContext(context, "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
Env.setContext(context, Env.M_WAREHOUSE_ID, schedorg.getM_Warehouse_ID());
|
||||||
}
|
}
|
||||||
int AD_User_ID = getAD_User_ID(po);
|
int AD_User_ID = getAD_User_ID(po);
|
||||||
if (AD_User_ID > 0) {
|
if (AD_User_ID > 0) {
|
||||||
Env.setContext(context, "#AD_User_ID", AD_User_ID);
|
Env.setContext(context, Env.AD_USER_ID, AD_User_ID);
|
||||||
Env.setContext(context, "#SalesRep_ID", AD_User_ID);
|
Env.setContext(context, Env.SALESREP_ID, AD_User_ID);
|
||||||
MUser scheduser = new MUser(context, AD_User_ID, null);
|
MUser scheduser = new MUser(context, AD_User_ID, null);
|
||||||
MRole[] schedroles = scheduser.getRoles(po.get_ValueAsInt("AD_Org_ID"));
|
MRole[] schedroles = scheduser.getRoles(po.get_ValueAsInt("AD_Org_ID"));
|
||||||
if (schedroles != null && schedroles.length > 0)
|
if (schedroles != null && schedroles.length > 0)
|
||||||
Env.setContext(context, "#AD_Role_ID", schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
Env.setContext(context, Env.AD_ROLE_ID, schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Env.setContext(context, "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
Env.setContext(context, Env.DATE, dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||||
|
|
||||||
Properties prevContext = ServerContext.getCurrentInstance();
|
Properties prevContext = ServerContext.getCurrentInstance();
|
||||||
try {
|
try {
|
||||||
|
@ -240,13 +240,13 @@ public abstract class AdempiereServer implements Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties context = new Properties();
|
Properties context = new Properties();
|
||||||
Env.setContext(context, "#AD_Client_ID", p_model.getAD_Client_ID());
|
Env.setContext(context, Env.AD_CLIENT_ID, p_model.getAD_Client_ID());
|
||||||
if (p_model instanceof PO) {
|
if (p_model instanceof PO) {
|
||||||
PO po = (PO) p_model;
|
PO po = (PO) p_model;
|
||||||
if (po.get_ColumnIndex("AD_Org_ID") >= 0)
|
if (po.get_ColumnIndex("AD_Org_ID") >= 0)
|
||||||
Env.setContext(context, "#AD_Org_ID", po.get_ValueAsInt("AD_Org_ID"));
|
Env.setContext(context, Env.AD_ORG_ID, po.get_ValueAsInt("AD_Org_ID"));
|
||||||
if (po.get_ColumnIndex("AD_User_ID") >= 0)
|
if (po.get_ColumnIndex("AD_User_ID") >= 0)
|
||||||
Env.setContext(context, "#AD_User_ID", po.get_ValueAsInt("AD_User_ID"));
|
Env.setContext(context, Env.AD_USER_ID, po.get_ValueAsInt("AD_User_ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -98,24 +98,24 @@ public class Scheduler extends AdempiereServer
|
||||||
|
|
||||||
// Prepare a ctx for the report/process - BF [1966880]
|
// Prepare a ctx for the report/process - BF [1966880]
|
||||||
MClient schedclient = MClient.get(getCtx(), scheduler.getAD_Client_ID());
|
MClient schedclient = MClient.get(getCtx(), scheduler.getAD_Client_ID());
|
||||||
Env.setContext(getCtx(), "#AD_Client_ID", schedclient.getAD_Client_ID());
|
Env.setContext(getCtx(), Env.AD_CLIENT_ID, schedclient.getAD_Client_ID());
|
||||||
Env.setContext(getCtx(), "#AD_Language", schedclient.getAD_Language());
|
Env.setContext(getCtx(), Env.LANGUAGE, schedclient.getAD_Language());
|
||||||
Env.setContext(getCtx(), "#AD_Org_ID", scheduler.getAD_Org_ID());
|
Env.setContext(getCtx(), Env.AD_ORG_ID, scheduler.getAD_Org_ID());
|
||||||
if (scheduler.getAD_Org_ID() != 0) {
|
if (scheduler.getAD_Org_ID() != 0) {
|
||||||
MOrgInfo schedorg = MOrgInfo.get(getCtx(), scheduler.getAD_Org_ID(), null);
|
MOrgInfo schedorg = MOrgInfo.get(getCtx(), scheduler.getAD_Org_ID(), null);
|
||||||
if (schedorg.getM_Warehouse_ID() > 0)
|
if (schedorg.getM_Warehouse_ID() > 0)
|
||||||
Env.setContext(getCtx(), "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
Env.setContext(getCtx(), Env.M_WAREHOUSE_ID, schedorg.getM_Warehouse_ID());
|
||||||
}
|
}
|
||||||
Env.setContext(getCtx(), "#AD_User_ID", getAD_User_ID());
|
Env.setContext(getCtx(), Env.AD_USER_ID, getAD_User_ID());
|
||||||
Env.setContext(getCtx(), "#SalesRep_ID", getAD_User_ID());
|
Env.setContext(getCtx(), Env.SALESREP_ID, getAD_User_ID());
|
||||||
// TODO: It can be convenient to add AD_Scheduler.AD_Role_ID
|
// TODO: It can be convenient to add AD_Scheduler.AD_Role_ID
|
||||||
MUser scheduser = MUser.get(getCtx(), getAD_User_ID());
|
MUser scheduser = MUser.get(getCtx(), getAD_User_ID());
|
||||||
MRole[] schedroles = scheduser.getRoles(scheduler.getAD_Org_ID());
|
MRole[] schedroles = scheduser.getRoles(scheduler.getAD_Org_ID());
|
||||||
if (schedroles != null && schedroles.length > 0)
|
if (schedroles != null && schedroles.length > 0)
|
||||||
Env.setContext(getCtx(), "#AD_Role_ID", schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
Env.setContext(getCtx(), Env.AD_ROLE_ID, schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
Env.setContext(getCtx(), Env.DATE, dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||||
|
|
||||||
//Create new Session and set #AD_Session_ID to context
|
//Create new Session and set #AD_Session_ID to context
|
||||||
MSession session = MSession.get(getCtx(), true);
|
MSession session = MSession.get(getCtx(), true);
|
||||||
|
@ -140,7 +140,7 @@ public class Scheduler extends AdempiereServer
|
||||||
m_trx.close();
|
m_trx.close();
|
||||||
|
|
||||||
session.logout();
|
session.logout();
|
||||||
getCtx().remove("#AD_Session_ID");
|
getCtx().remove(Env.AD_SESSION_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -312,7 +312,7 @@ public class Scheduler extends AdempiereServer
|
||||||
mailContent = scheduler.getDescription();
|
mailContent = scheduler.getDescription();
|
||||||
}else{
|
}else{
|
||||||
mailTemplate.setUser(user);
|
mailTemplate.setUser(user);
|
||||||
mailTemplate.setLanguage(Env.getContext(getCtx(), "#AD_Language"));
|
mailTemplate.setLanguage(Env.getContext(getCtx(), Env.LANGUAGE));
|
||||||
// if user has bpartner link. maybe use language depend user
|
// if user has bpartner link. maybe use language depend user
|
||||||
mailContent = mailTemplate.getMailText(true);
|
mailContent = mailTemplate.getMailText(true);
|
||||||
schedulerName = mailTemplate.getMailHeader();
|
schedulerName = mailTemplate.getMailHeader();
|
||||||
|
@ -555,7 +555,7 @@ public class Scheduler extends AdempiereServer
|
||||||
else
|
else
|
||||||
value = env;
|
value = env;
|
||||||
|
|
||||||
if (tail != null && columnName.equals("#Date"))
|
if (tail != null && columnName.equals(Env.DATE))
|
||||||
{
|
{
|
||||||
tail = tail.trim();
|
tail = tail.trim();
|
||||||
if (tail.startsWith("-") || tail.startsWith("+"))
|
if (tail.startsWith("-") || tail.startsWith("+"))
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
}
|
}
|
||||||
|
|
||||||
MSystem system = MSystem.get(Env.getCtx());
|
MSystem system = MSystem.get(Env.getCtx());
|
||||||
Env.setContext(ctx, "#System_Name", system.getName());
|
Env.setContext(ctx, Env.SYSTEM_NAME, system.getName());
|
||||||
|
|
||||||
// Validate language
|
// Validate language
|
||||||
Language language = Language.getLanguage(langLogin);
|
Language language = Language.getLanguage(langLogin);
|
||||||
|
@ -241,8 +241,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
|
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
|
||||||
|
|
||||||
//enable full interface, relook into this when doing preference
|
//enable full interface, relook into this when doing preference
|
||||||
Env.setContext(ctx, "#ShowTrl", true);
|
Env.setContext(ctx, Env.SHOW_TRANSLATION, true);
|
||||||
Env.setContext(ctx, "#ShowAcct", MRole.getDefault().isShowAcct());
|
Env.setContext(ctx, Env.SHOW_ACCOUNTING, MRole.getDefault().isShowAcct());
|
||||||
|
|
||||||
// to reload preferences when the user refresh the browser
|
// to reload preferences when the user refresh the browser
|
||||||
userPreference = loadUserPreference(Env.getAD_User_ID(ctx));
|
userPreference = loadUserPreference(Env.getAD_User_ID(ctx));
|
||||||
|
@ -276,15 +276,15 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
MUser user = MUser.get(ctx);
|
MUser user = MUser.get(ctx);
|
||||||
BrowserToken.save(mSession, user);
|
BrowserToken.save(mSession, user);
|
||||||
|
|
||||||
Env.setContext(ctx, "#UIClient", "zk");
|
Env.setContext(ctx, Env.UI_CLIENT, "zk");
|
||||||
Env.setContext(ctx, "#DBType", DB.getDatabase().getName());
|
Env.setContext(ctx, Env.DB_TYPE, DB.getDatabase().getName());
|
||||||
StringBuilder localHttpAddr = new StringBuilder(Executions.getCurrent().getScheme());
|
StringBuilder localHttpAddr = new StringBuilder(Executions.getCurrent().getScheme());
|
||||||
localHttpAddr.append("://").append(Executions.getCurrent().getLocalAddr());
|
localHttpAddr.append("://").append(Executions.getCurrent().getLocalAddr());
|
||||||
int port = Executions.getCurrent().getLocalPort();
|
int port = Executions.getCurrent().getLocalPort();
|
||||||
if (port > 0 && port != 80) {
|
if (port > 0 && port != 80) {
|
||||||
localHttpAddr.append(":").append(port);
|
localHttpAddr.append(":").append(port);
|
||||||
}
|
}
|
||||||
Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString());
|
Env.setContext(ctx, Env.LOCAL_HTTP_ADDRESS, localHttpAddr.toString());
|
||||||
Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
|
Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
|
||||||
|
|
||||||
//init favorite
|
//init favorite
|
||||||
|
|
|
@ -206,7 +206,7 @@ public final class AEnv
|
||||||
*/
|
*/
|
||||||
public static void logout()
|
public static void logout()
|
||||||
{
|
{
|
||||||
String sessionID = Env.getContext(Env.getCtx(), "#AD_Session_ID");
|
String sessionID = Env.getContext(Env.getCtx(), Env.AD_SESSION_ID);
|
||||||
synchronized (windowCache)
|
synchronized (windowCache)
|
||||||
{
|
{
|
||||||
CCache<Integer,GridWindowVO> cache = windowCache.get(sessionID);
|
CCache<Integer,GridWindowVO> cache = windowCache.get(sessionID);
|
||||||
|
@ -222,7 +222,7 @@ public final class AEnv
|
||||||
if (session != null)
|
if (session != null)
|
||||||
session.logout();
|
session.logout();
|
||||||
|
|
||||||
Env.setContext(Env.getCtx(), "#AD_Session_ID", (String)null);
|
Env.setContext(Env.getCtx(), Env.AD_SESSION_ID, (String)null);
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ public final class AEnv
|
||||||
|
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Window=" + WindowNo + ", AD_Window_ID=" + AD_Window_ID);
|
if (log.isLoggable(Level.CONFIG)) log.config("Window=" + WindowNo + ", AD_Window_ID=" + AD_Window_ID);
|
||||||
GridWindowVO mWindowVO = null;
|
GridWindowVO mWindowVO = null;
|
||||||
String sessionID = Env.getContext(Env.getCtx(), "#AD_Session_ID");
|
String sessionID = Env.getContext(Env.getCtx(), Env.AD_SESSION_ID);
|
||||||
if (AD_Window_ID != 0 && Ini.isCacheWindow()) // try cache
|
if (AD_Window_ID != 0 && Ini.isCacheWindow()) // try cache
|
||||||
{
|
{
|
||||||
synchronized (windowCache)
|
synchronized (windowCache)
|
||||||
|
|
|
@ -501,7 +501,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
||||||
protected void querySaved()
|
protected void querySaved()
|
||||||
{
|
{
|
||||||
//user query
|
//user query
|
||||||
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"));
|
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), Env.AD_USER_ID));
|
||||||
fSavedName.removeAllItems();
|
fSavedName.removeAllItems();
|
||||||
for (MPInstance instance : savedParams)
|
for (MPInstance instance : savedParams)
|
||||||
{
|
{
|
||||||
|
@ -597,7 +597,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
||||||
final String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
|
final String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
|
||||||
return new Query(Env.getCtx(), MPInstance.Table_Name, where, null)
|
return new Query(Env.getCtx(), MPInstance.Table_Name, where, null)
|
||||||
.setOnlyActiveRecords(true).setClient_ID()
|
.setOnlyActiveRecords(true).setClient_ID()
|
||||||
.setParameters(m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"))
|
.setParameters(m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), Env.AD_USER_ID))
|
||||||
.setOrderBy("Created DESC")
|
.setOrderBy("Created DESC")
|
||||||
.first();
|
.first();
|
||||||
}
|
}
|
||||||
|
@ -1167,13 +1167,13 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
||||||
super();
|
super();
|
||||||
|
|
||||||
m_ctx = new Properties();
|
m_ctx = new Properties();
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", ctx.getProperty("#AD_Client_ID"));
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, ctx.getProperty(Env.AD_CLIENT_ID));
|
||||||
Env.setContext(m_ctx, "#AD_Org_ID", ctx.getProperty("#AD_Org_ID"));
|
Env.setContext(m_ctx, Env.AD_ORG_ID, ctx.getProperty(Env.AD_ORG_ID));
|
||||||
Env.setContext(m_ctx, "#AD_Role_ID", ctx.getProperty("#AD_Role_ID"));
|
Env.setContext(m_ctx, Env.AD_ROLE_ID, ctx.getProperty(Env.AD_ROLE_ID));
|
||||||
Env.setContext(m_ctx, "#M_Warehouse_ID", ctx.getProperty("#M_Warehouse_ID"));
|
Env.setContext(m_ctx, Env.M_WAREHOUSE_ID, ctx.getProperty(Env.M_WAREHOUSE_ID));
|
||||||
Env.setContext(m_ctx, "#AD_Language", ctx.getProperty("#AD_Language"));
|
Env.setContext(m_ctx, Env.LANGUAGE, ctx.getProperty(Env.LANGUAGE));
|
||||||
Env.setContext(m_ctx, "#AD_User_ID", ctx.getProperty("#AD_User_ID"));
|
Env.setContext(m_ctx, Env.AD_USER_ID, ctx.getProperty(Env.AD_USER_ID));
|
||||||
Env.setContext(m_ctx, "#Date", ctx.getProperty("#Date"));
|
Env.setContext(m_ctx, Env.DATE, ctx.getProperty(Env.DATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -459,7 +459,7 @@ public class WAllocation extends Allocation
|
||||||
|
|
||||||
// Date set to Login Date
|
// Date set to Login Date
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTime(Env.getContextAsDate(Env.getCtx(), "#Date"));
|
cal.setTime(Env.getContextAsDate(Env.getCtx(), Env.DATE));
|
||||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
cal.set(Calendar.MINUTE, 0);
|
cal.set(Calendar.MINUTE, 0);
|
||||||
cal.set(Calendar.SECOND, 0);
|
cal.set(Calendar.SECOND, 0);
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
|
||||||
fWarehouse = new WTableDirEditor ("M_Warehouse_ID", true, false, true, orgL);
|
fWarehouse = new WTableDirEditor ("M_Warehouse_ID", true, false, true, orgL);
|
||||||
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
|
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
|
||||||
fWarehouse.addValueChangeListener(this);
|
fWarehouse.addValueChangeListener(this);
|
||||||
fWarehouse.setValue(Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID"));
|
fWarehouse.setValue(Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID));
|
||||||
setM_Warehouse_ID(fWarehouse.getValue());
|
setM_Warehouse_ID(fWarehouse.getValue());
|
||||||
// Document Action Prepared/ Completed
|
// Document Action Prepared/ Completed
|
||||||
lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
|
lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class FavouriteController {
|
||||||
{
|
{
|
||||||
int AD_Client_ID = MUser.get(Env.getCtx()).getAD_Client_ID();
|
int AD_Client_ID = MUser.get(Env.getCtx()).getAD_Client_ID();
|
||||||
int AD_Org_ID = 0;
|
int AD_Org_ID = 0;
|
||||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), Env.AD_USER_ID);
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
if (add)
|
if (add)
|
||||||
sql.append("INSERT INTO AD_TreeBar "
|
sql.append("INSERT INTO AD_TreeBar "
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
|
||||||
// Try to get C_AcctSchema_ID from global context - teo_sarca BF [ 1830531 ]
|
// Try to get C_AcctSchema_ID from global context - teo_sarca BF [ 1830531 ]
|
||||||
if (C_AcctSchema_ID <= 0)
|
if (C_AcctSchema_ID <= 0)
|
||||||
{
|
{
|
||||||
C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), "$C_AcctSchema_ID");
|
C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), Env.C_ACCTSCHEMA_ID);
|
||||||
}
|
}
|
||||||
new WAccountDialog (gridField.getHeader(), m_mAccount, C_AcctSchema_ID, new Callback<Integer>() {
|
new WAccountDialog (gridField.getHeader(), m_mAccount, C_AcctSchema_ID, new Callback<Integer>() {
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class WRadioGroupEditor extends WEditor implements ContextMenuListener, L
|
||||||
lookup.setMandatory(true);
|
lookup.setMandatory(true);
|
||||||
lookup.setMandatory(isMandatory());
|
lookup.setMandatory(isMandatory());
|
||||||
|
|
||||||
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0)
|
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), Env.AD_ROLE_ID) == 0)
|
||||||
|| lookup.getDisplayType() != DisplayType.List)
|
|| lookup.getDisplayType() != DisplayType.List)
|
||||||
{
|
{
|
||||||
zoom= true;
|
zoom= true;
|
||||||
|
|
|
@ -209,7 +209,7 @@ ContextMenuListener, IZoomableEditor
|
||||||
lookup.addListDataListener(this);
|
lookup.addListDataListener(this);
|
||||||
lookup.setMandatory(isMandatory());
|
lookup.setMandatory(isMandatory());
|
||||||
|
|
||||||
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0)
|
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), Env.AD_ROLE_ID) == 0)
|
||||||
|| lookup.getDisplayType() != DisplayType.List)
|
|| lookup.getDisplayType() != DisplayType.List)
|
||||||
{
|
{
|
||||||
zoom= true;
|
zoom= true;
|
||||||
|
|
|
@ -448,7 +448,7 @@ public class InfoProductWindow extends InfoWindow {
|
||||||
int M_PriceList_Version_ID = findPLV (M_PriceList_ID);
|
int M_PriceList_Version_ID = findPLV (M_PriceList_ID);
|
||||||
// Set Warehouse
|
// Set Warehouse
|
||||||
if (M_Warehouse_ID == 0)
|
if (M_Warehouse_ID == 0)
|
||||||
M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID");
|
M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID);
|
||||||
if (M_Warehouse_ID != 0)
|
if (M_Warehouse_ID != 0)
|
||||||
setWarehouse (M_Warehouse_ID);
|
setWarehouse (M_Warehouse_ID);
|
||||||
// Set PriceList Version
|
// Set PriceList Version
|
||||||
|
|
|
@ -344,7 +344,7 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
|
||||||
for (KeyNamePair clientKNPair : m_clientKNPairs)
|
for (KeyNamePair clientKNPair : m_clientKNPairs)
|
||||||
{
|
{
|
||||||
int clientId = clientKNPair.getKey();
|
int clientId = clientKNPair.getKey();
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", clientId);
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, clientId);
|
||||||
MUser user = MUser.get(m_ctx, m_userName);
|
MUser user = MUser.get(m_ctx, m_userName);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -757,7 +757,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
||||||
int M_PriceList_Version_ID = findPLV (M_PriceList_ID);
|
int M_PriceList_Version_ID = findPLV (M_PriceList_ID);
|
||||||
// Set Warehouse
|
// Set Warehouse
|
||||||
if (M_Warehouse_ID == 0)
|
if (M_Warehouse_ID == 0)
|
||||||
M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID");
|
M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID);
|
||||||
if (M_Warehouse_ID != 0)
|
if (M_Warehouse_ID != 0)
|
||||||
setWarehouse (M_Warehouse_ID);
|
setWarehouse (M_Warehouse_ID);
|
||||||
// Set PriceList Version
|
// Set PriceList Version
|
||||||
|
|
|
@ -516,7 +516,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MMailText mailText = new MMailText(m_ctx, R_MailText_ID, null);
|
MMailText mailText = new MMailText(m_ctx, R_MailText_ID, null);
|
||||||
mailText.setLanguage(Env.getContext(m_ctx, "#AD_Language"));
|
mailText.setLanguage(Env.getContext(m_ctx, Env.LANGUAGE));
|
||||||
to.set_ValueOfColumn("Password", newPassword); // will be hashed and validate on saveEx
|
to.set_ValueOfColumn("Password", newPassword); // will be hashed and validate on saveEx
|
||||||
mailText.setUser(to);
|
mailText.setUser(to);
|
||||||
String message = mailText.getMailText(true);
|
String message = mailText.getMailText(true);
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
|
||||||
m_clientKNPairs = clientsKNPairs;
|
m_clientKNPairs = clientsKNPairs;
|
||||||
|
|
||||||
if( m_clientKNPairs.length == 1 && !m_show ){
|
if( m_clientKNPairs.length == 1 && !m_show ){
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", (String) m_clientKNPairs[0].getID());
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, (String) m_clientKNPairs[0].getID());
|
||||||
MUser user = MUser.get (m_ctx, m_userName);
|
MUser user = MUser.get (m_ctx, m_userName);
|
||||||
m_userpreference=new UserPreference();
|
m_userpreference=new UserPreference();
|
||||||
m_userpreference.loadPreference(user.get_ID());
|
m_userpreference.loadPreference(user.get_ID());
|
||||||
|
@ -569,15 +569,15 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
|
||||||
|
|
||||||
private void setUserID() {
|
private void setUserID() {
|
||||||
if (lstClient.getSelectedItem() != null) {
|
if (lstClient.getSelectedItem() != null) {
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", (String) lstClient.getSelectedItem().getValue());
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, (String) lstClient.getSelectedItem().getValue());
|
||||||
} else {
|
} else {
|
||||||
Env.setContext(m_ctx, "#AD_Client_ID", (String) null);
|
Env.setContext(m_ctx, Env.AD_CLIENT_ID, (String) null);
|
||||||
}
|
}
|
||||||
MUser user = MUser.get (m_ctx, m_userName);
|
MUser user = MUser.get (m_ctx, m_userName);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Env.setContext(m_ctx, "#AD_User_ID", user.getAD_User_ID() );
|
Env.setContext(m_ctx, Env.AD_USER_ID, user.getAD_User_ID() );
|
||||||
Env.setContext(m_ctx, "#AD_User_Name", user.getName() );
|
Env.setContext(m_ctx, Env.AD_USER_NAME, user.getName() );
|
||||||
Env.setContext(m_ctx, "#SalesRep_ID", user.getAD_User_ID() );
|
Env.setContext(m_ctx, Env.SALESREP_ID, user.getAD_User_ID() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class SessionContextListener implements ExecutionInit,
|
||||||
if (Env.getCtx().getProperty(SERVLET_SESSION_ID) == null)
|
if (Env.getCtx().getProperty(SERVLET_SESSION_ID) == null)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID");
|
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID);
|
||||||
if (AD_Session_ID > 0) {
|
if (AD_Session_ID > 0) {
|
||||||
String key = getSessionDesktopListKey(AD_Session_ID);
|
String key = getSessionDesktopListKey(AD_Session_ID);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -39,10 +39,10 @@ public class SessionManager
|
||||||
|
|
||||||
public static boolean isUserLoggedIn(Properties ctx)
|
public static boolean isUserLoggedIn(Properties ctx)
|
||||||
{
|
{
|
||||||
String adUserId = Env.getContext(ctx, "#AD_User_ID");
|
String adUserId = Env.getContext(ctx, Env.AD_USER_ID);
|
||||||
String adRoleId = Env.getContext(ctx, "#AD_Role_ID");
|
String adRoleId = Env.getContext(ctx, Env.AD_ROLE_ID);
|
||||||
String adClientId = Env.getContext(ctx, "#AD_Client_ID");
|
String adClientId = Env.getContext(ctx, Env.AD_CLIENT_ID);
|
||||||
String adOrgId = Env.getContext(ctx, "#AD_Org_ID");
|
String adOrgId = Env.getContext(ctx, Env.AD_ORG_ID);
|
||||||
|
|
||||||
return (!"".equals(adUserId) && !"".equals(adRoleId)
|
return (!"".equals(adUserId) && !"".equals(adRoleId)
|
||||||
&& !"".equals(adClientId) && !"".equals(adOrgId));
|
&& !"".equals(adClientId) && !"".equals(adOrgId));
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class ValidateReadonlyComponent implements AuService {
|
||||||
// for combobox each change have both event onchange and onselect
|
// for combobox each change have both event onchange and onselect
|
||||||
if (editing){
|
if (editing){
|
||||||
comp.invalidate();
|
comp.invalidate();
|
||||||
String user = Env.getContext(Env.getCtx(), "#AD_User_Name") + "[" + Env.getContext(Env.getCtx(), "#AD_User_ID") + "]";
|
String user = Env.getContext(Env.getCtx(), Env.AD_USER_NAME) + "[" + Env.getContext(Env.getCtx(), Env.AD_USER_ID) + "]";
|
||||||
log.log(Level.WARNING, String.format("Detected UI interaction with a read-only element: %1$s on event %2$s from user %3$s",
|
log.log(Level.WARNING, String.format("Detected UI interaction with a read-only element: %1$s on event %2$s from user %3$s",
|
||||||
comp.getClass(), cmd, user));
|
comp.getClass(), cmd, user));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class Allocation
|
||||||
|
|
||||||
public void dynInit() throws Exception
|
public void dynInit() throws Exception
|
||||||
{
|
{
|
||||||
m_C_Currency_ID = Env.getContextAsInt(Env.getCtx(), "$C_Currency_ID"); // default
|
m_C_Currency_ID = Env.getContextAsInt(Env.getCtx(), Env.C_CURRENCY_ID); // default
|
||||||
//
|
//
|
||||||
if (log.isLoggable(Level.INFO)) log.info("Currency=" + m_C_Currency_ID);
|
if (log.isLoggable(Level.INFO)) log.info("Currency=" + m_C_Currency_ID);
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ public class Allocation
|
||||||
|
|
||||||
// Create Allocation
|
// Create Allocation
|
||||||
MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual
|
MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual
|
||||||
DateTrx, C_Currency_ID, Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName);
|
DateTrx, C_Currency_ID, Env.getContext(Env.getCtx(), Env.AD_USER_NAME), trxName);
|
||||||
alloc.setAD_Org_ID(AD_Org_ID);
|
alloc.setAD_Org_ID(AD_Org_ID);
|
||||||
alloc.setC_DocType_ID(m_C_DocType_ID);
|
alloc.setC_DocType_ID(m_C_DocType_ID);
|
||||||
alloc.setDescription(alloc.getDescriptionForManualAllocation(m_C_BPartner_ID, trxName));
|
alloc.setDescription(alloc.getDescriptionForManualAllocation(m_C_BPartner_ID, trxName));
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class Charge
|
||||||
*/
|
*/
|
||||||
public void findChargeElementID()
|
public void findChargeElementID()
|
||||||
{
|
{
|
||||||
m_C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), "$C_AcctSchema_ID");
|
m_C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), Env.C_ACCTSCHEMA_ID);
|
||||||
// get Element
|
// get Element
|
||||||
String sql = "SELECT C_Element_ID "
|
String sql = "SELECT C_Element_ID "
|
||||||
+ "FROM C_AcctSchema_Element "
|
+ "FROM C_AcctSchema_Element "
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class FactReconcile {
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
|
|
||||||
String matchcode = "Manual: " + Env.getContext(Env.getCtx(), "#AD_User_Name") + " " + time;
|
String matchcode = "Manual: " + Env.getContext(Env.getCtx(), Env.AD_USER_NAME) + " " + time;
|
||||||
|
|
||||||
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null)
|
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null)
|
||||||
.setParameters(new Object[] {factId}).first();
|
.setParameters(new Object[] {factId}).first();
|
||||||
|
|
|
@ -100,8 +100,8 @@ public abstract class AbstractTestCase {
|
||||||
Env.setContext(Env.getCtx(), Env.AD_USER_ID, loginDetails.getUserId());
|
Env.setContext(Env.getCtx(), Env.AD_USER_ID, loginDetails.getUserId());
|
||||||
Env.setContext(Env.getCtx(), Env.AD_ROLE_ID, loginDetails.getRoleId());
|
Env.setContext(Env.getCtx(), Env.AD_ROLE_ID, loginDetails.getRoleId());
|
||||||
Env.setContext(Env.getCtx(), Env.M_WAREHOUSE_ID, loginDetails.getWarehouseId());
|
Env.setContext(Env.getCtx(), Env.M_WAREHOUSE_ID, loginDetails.getWarehouseId());
|
||||||
Env.setContext(Env.getCtx(), "#LanguageName", loginDetails.getLoginLanguage().getName());
|
Env.setContext(Env.getCtx(), Env.LANGUAGE_NAME, loginDetails.getLoginLanguage().getName());
|
||||||
Env.setContext(Env.getCtx(), "#Date", loginDetails.getLoginDate());
|
Env.setContext(Env.getCtx(), Env.DATE, loginDetails.getLoginDate());
|
||||||
|
|
||||||
Env.verifyLanguage(Env.getCtx(), getLanguage());
|
Env.verifyLanguage(Env.getCtx(), getLanguage());
|
||||||
Env.setContext(Env.getCtx(), Env.LANGUAGE, getLanguage().getAD_Language());
|
Env.setContext(Env.getCtx(), Env.LANGUAGE, getLanguage().getAD_Language());
|
||||||
|
@ -110,9 +110,9 @@ public abstract class AbstractTestCase {
|
||||||
|
|
||||||
if (loginDetails.getRoleId() > 0) {
|
if (loginDetails.getRoleId() > 0) {
|
||||||
if (MRole.getDefault(Env.getCtx(), false).isShowAcct())
|
if (MRole.getDefault(Env.getCtx(), false).isShowAcct())
|
||||||
Env.setContext(Env.getCtx(), "#ShowAcct", "Y");
|
Env.setContext(Env.getCtx(), Env.SHOW_ACCOUNTING, "Y");
|
||||||
else
|
else
|
||||||
Env.setContext(Env.getCtx(), "#ShowAcct", "N");
|
Env.setContext(Env.getCtx(), Env.SHOW_ACCOUNTING, "N");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Define AcctSchema , Currency, HasAlias **/
|
/** Define AcctSchema , Currency, HasAlias **/
|
||||||
|
|
|
@ -536,7 +536,7 @@ public class MatchInvTest extends AbstractTestCase {
|
||||||
public void testMatReceiptPostingWithDiffCurrencyPrecision() {
|
public void testMatReceiptPostingWithDiffCurrencyPrecision() {
|
||||||
MBPartner bpartner = MBPartner.get(Env.getCtx(), 114); // Tree Farm Inc.
|
MBPartner bpartner = MBPartner.get(Env.getCtx(), 114); // Tree Farm Inc.
|
||||||
MProduct product = MProduct.get(Env.getCtx(), 124); // Elm Tree
|
MProduct product = MProduct.get(Env.getCtx(), 124); // Elm Tree
|
||||||
Timestamp currentDate = Env.getContextAsDate(Env.getCtx(), "#Date");
|
Timestamp currentDate = Env.getContextAsDate(Env.getCtx(), Env.DATE);
|
||||||
|
|
||||||
MPriceList priceList = new MPriceList(Env.getCtx(), 0, null);
|
MPriceList priceList = new MPriceList(Env.getCtx(), 0, null);
|
||||||
priceList.setName("Purchase JPY " + System.currentTimeMillis());
|
priceList.setName("Purchase JPY " + System.currentTimeMillis());
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class AllocationTest extends AbstractTestCase {
|
||||||
|
|
||||||
// Create allocation to allocate payment to charge
|
// Create allocation to allocate payment to charge
|
||||||
MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual
|
MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual
|
||||||
payment1.getDateTrx(), CURRENCY_USD, Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName);
|
payment1.getDateTrx(), CURRENCY_USD, Env.getContext(Env.getCtx(), Env.AD_USER_NAME), trxName);
|
||||||
alloc.setAD_Org_ID(payment1.getAD_Org_ID());
|
alloc.setAD_Org_ID(payment1.getAD_Org_ID());
|
||||||
int doctypeAlloc = MDocType.getDocType("CMA");
|
int doctypeAlloc = MDocType.getDocType("CMA");
|
||||||
alloc.setC_DocType_ID(doctypeAlloc);
|
alloc.setC_DocType_ID(doctypeAlloc);
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class CompiereService {
|
||||||
CompiereUtil.initWeb();
|
CompiereUtil.initWeb();
|
||||||
|
|
||||||
ServerContext.setCurrentInstance(new Properties());
|
ServerContext.setCurrentInstance(new Properties());
|
||||||
Env.setContext(getCtx(), "#AD_Language", "en_US" );
|
Env.setContext(getCtx(), Env.LANGUAGE, "en_US" );
|
||||||
m_language = Language.getLanguage("en_US");
|
m_language = Language.getLanguage("en_US");
|
||||||
|
|
||||||
dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
|
dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
|
||||||
|
@ -266,7 +266,7 @@ public class CompiereService {
|
||||||
else
|
else
|
||||||
m_userName = Util.isEmpty(user.getLDAPUser()) ? user.getName() : user.getLDAPUser();
|
m_userName = Util.isEmpty(user.getLDAPUser()) ? user.getName() : user.getLDAPUser();
|
||||||
|
|
||||||
Env.setContext( getCtx(), "#AD_Language", Lang);
|
Env.setContext( getCtx(), Env.LANGUAGE, Lang);
|
||||||
m_language = Language.getLanguage(Lang);
|
m_language = Language.getLanguage(Lang);
|
||||||
Env.verifyLanguage( getCtx(), m_language );
|
Env.verifyLanguage( getCtx(), m_language );
|
||||||
|
|
||||||
|
@ -281,10 +281,10 @@ public class CompiereService {
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat( dateFormatOnlyForCtx );
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat( dateFormatOnlyForCtx );
|
||||||
Env.setContext( getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
Env.setContext( getCtx(), Env.DATE, dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||||
if (log.isLoggable(Level.INFO)) log.info(" #Date = "+ Env.getContextAsDate( getCtx(), "#Date"));
|
if (log.isLoggable(Level.INFO)) log.info(" #Date = "+ Env.getContextAsDate( getCtx(), Env.DATE));
|
||||||
|
|
||||||
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
|
Env.setContext( getCtx(), Env.M_WAREHOUSE_ID, M_Warehouse_ID );
|
||||||
Env.setContext(getCtx(), Env.LANGUAGE, m_language.getAD_Language());
|
Env.setContext(getCtx(), Env.LANGUAGE, m_language.getAD_Language());
|
||||||
|
|
||||||
// Create session
|
// Create session
|
||||||
|
|
|
@ -124,9 +124,9 @@ public class Process {
|
||||||
if (DisplayType.isDate(para.getAD_Reference_ID()))
|
if (DisplayType.isDate(para.getAD_Reference_ID()))
|
||||||
{
|
{
|
||||||
if (para.getDefaultValue().indexOf( "@#Date@")>=0) {
|
if (para.getDefaultValue().indexOf( "@#Date@")>=0) {
|
||||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
//Object t = Env.getContextAsDate( cs.getM_ctx(), Env.DATE );
|
||||||
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
|
//String t = Env.getContext( cs.getM_ctx(), Env.DATE );
|
||||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), "#Date") );
|
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), Env.DATE) );
|
||||||
|
|
||||||
p.setDefaultValue( t ); //cs.dateFormat.format( t ));
|
p.setDefaultValue( t ); //cs.dateFormat.format( t ));
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ public class Process {
|
||||||
if (DisplayType.isDate(para.getAD_Reference_ID()))
|
if (DisplayType.isDate(para.getAD_Reference_ID()))
|
||||||
{
|
{
|
||||||
if (para.getDefaultValue2().indexOf( "@#Date@")>=0) {
|
if (para.getDefaultValue2().indexOf( "@#Date@")>=0) {
|
||||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
//Object t = Env.getContextAsDate( cs.getM_ctx(), Env.DATE );
|
||||||
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
|
//String t = Env.getContext( cs.getM_ctx(), Env.DATE );
|
||||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), "#Date") );
|
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), Env.DATE) );
|
||||||
p.setDefaultValue2( t ); //cs.dateFormat.format( t ) );
|
p.setDefaultValue2( t ); //cs.dateFormat.format( t ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,13 +131,13 @@ public class AbstractService {
|
||||||
if (!okclient)
|
if (!okclient)
|
||||||
return "Error logging in - client not allowed for this user";
|
return "Error logging in - client not allowed for this user";
|
||||||
|
|
||||||
m_cs.getCtx().setProperty("#AD_Client_ID", "" + loginRequest.getClientID());
|
m_cs.getCtx().setProperty(Env.AD_CLIENT_ID, "" + loginRequest.getClientID());
|
||||||
Env.setContext(m_cs.getCtx(), "#AD_Client_ID", (String) selectedClient.getID());
|
Env.setContext(m_cs.getCtx(), Env.AD_CLIENT_ID, (String) selectedClient.getID());
|
||||||
MUser user = MUser.get (m_cs.getCtx(), loginRequest.getUser());
|
MUser user = MUser.get (m_cs.getCtx(), loginRequest.getUser());
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Env.setContext(m_cs.getCtx(), "#AD_User_ID", user.getAD_User_ID() );
|
Env.setContext(m_cs.getCtx(), Env.AD_USER_ID, user.getAD_User_ID() );
|
||||||
Env.setContext(m_cs.getCtx(), "#AD_User_Name", user.getName() );
|
Env.setContext(m_cs.getCtx(), Env.AD_USER_NAME, user.getName() );
|
||||||
Env.setContext(m_cs.getCtx(), "#SalesRep_ID", user.getAD_User_ID() );
|
Env.setContext(m_cs.getCtx(), Env.SALESREP_ID, user.getAD_User_ID() );
|
||||||
String userAgent = getHttpServletRequest().getHeader("User-Agent");
|
String userAgent = getHttpServletRequest().getHeader("User-Agent");
|
||||||
Env.setContext(m_cs.getCtx(), "#UserAgent", userAgent == null ? "Unknown" : userAgent);
|
Env.setContext(m_cs.getCtx(), "#UserAgent", userAgent == null ? "Unknown" : userAgent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue