Fixed multi lingual reporting issue
This commit is contained in:
parent
fa6dafed7d
commit
6f2f78cd11
|
@ -24,12 +24,12 @@ import org.compiere.wf.MWFProcess;
|
|||
import org.compiere.wf.MWorkflow;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1757523 ] Server Processes are using Server's context
|
||||
* <li>BF [ 2528297 ] Poor error message on jasper fail
|
||||
* <li>BF [ 2530847 ] Report is displayed even if java process fails
|
||||
* <li>BF [ 2530847 ] Report is displayed even if java process fails
|
||||
*/
|
||||
public final class ProcessUtil {
|
||||
|
||||
|
@ -37,9 +37,9 @@ public final class ProcessUtil {
|
|||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ProcessUtil.class);
|
||||
|
||||
|
||||
private ProcessUtil() {}
|
||||
|
||||
|
||||
/**
|
||||
* @param processInfo
|
||||
* @param ProcedureName
|
||||
|
@ -63,7 +63,7 @@ public final class ProcessUtil {
|
|||
try
|
||||
{
|
||||
//hengsin, add trx support, updateable support.
|
||||
CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, trxName);
|
||||
CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, trxName);
|
||||
cstmt.setInt(1, processInfo.getAD_PInstance_ID());
|
||||
cstmt.executeUpdate();
|
||||
cstmt.close();
|
||||
|
@ -90,12 +90,12 @@ public final class ProcessUtil {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public static boolean startJavaProcess(ProcessInfo pi, Trx trx) {
|
||||
return startJavaProcess(Env.getCtx(), pi, trx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ctx
|
||||
* @param pi
|
||||
|
@ -120,36 +120,49 @@ public final class ProcessUtil {
|
|||
if (proc.getJasperReport() != null)
|
||||
className = JASPER_STARTER_CLASS;
|
||||
}
|
||||
|
||||
|
||||
ProcessCall process = null;
|
||||
if (Core.isExtension(className)) {
|
||||
process = Core.getProcess(className);
|
||||
}
|
||||
|
||||
|
||||
if (process == null) {
|
||||
//Get Class
|
||||
Class<?> processClass = null;
|
||||
//use context classloader if available
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader == null)
|
||||
if (classLoader != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
processClass = classLoader.loadClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
log.log(Level.FINE, className, ex);
|
||||
}
|
||||
}
|
||||
if (processClass == null)
|
||||
{
|
||||
classLoader = ProcessUtil.class.getClassLoader();
|
||||
try
|
||||
{
|
||||
processClass = classLoader.loadClass(className);
|
||||
try
|
||||
{
|
||||
processClass = classLoader.loadClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
log.log(Level.WARNING, className, ex);
|
||||
pi.setSummary ("ClassNotFound", true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
log.log(Level.WARNING, className, ex);
|
||||
pi.setSummary ("ClassNotFound", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (processClass == null) {
|
||||
pi.setSummary("No Instance for " + pi.getClassName(), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get Process
|
||||
|
||||
//Get Process
|
||||
try
|
||||
{
|
||||
process = (ProcessCall)processClass.newInstance();
|
||||
|
@ -159,9 +172,9 @@ public final class ProcessUtil {
|
|||
log.log(Level.WARNING, "Instance for " + className, ex);
|
||||
pi.setSummary ("InstanceError", true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean success = false;
|
||||
try
|
||||
{
|
||||
|
@ -188,11 +201,11 @@ public final class ProcessUtil {
|
|||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
public static boolean startScriptProcess(Properties ctx, ProcessInfo pi, Trx trx) {
|
||||
String msg = null;
|
||||
boolean success = true;
|
||||
try
|
||||
try
|
||||
{
|
||||
String cmd = pi.getClassName();
|
||||
MRule rule = MRule.get(ctx, cmd.substring(MRule.SCRIPT_PREFIX.length()));
|
||||
|
@ -201,7 +214,7 @@ public final class ProcessUtil {
|
|||
pi.setSummary ("ScriptNotFound", true);
|
||||
return false;
|
||||
}
|
||||
if ( ! (rule.getEventType().equals(MRule.EVENTTYPE_Process)
|
||||
if ( ! (rule.getEventType().equals(MRule.EVENTTYPE_Process)
|
||||
&& rule.getRuleType().equals(MRule.RULETYPE_JSR223ScriptingAPIs))) {
|
||||
log.log(Level.WARNING, cmd + " must be of type JSR 223 and event Process");
|
||||
pi.setSummary ("ScriptNotFound", true);
|
||||
|
@ -215,7 +228,7 @@ public final class ProcessUtil {
|
|||
// Method arguments context are A_
|
||||
// Parameter context are P_
|
||||
MRule.setContext(engine, ctx, 0); // no window
|
||||
// now add the method arguments to the engine
|
||||
// now add the method arguments to the engine
|
||||
engine.put(MRule.ARGUMENTS_PREFIX + "Ctx", ctx);
|
||||
if (trx == null)
|
||||
trx = Trx.get(pi.getTitle()+"_"+pi.getAD_PInstance_ID(), true);
|
||||
|
@ -258,16 +271,16 @@ public final class ProcessUtil {
|
|||
}
|
||||
}
|
||||
engine.put(MRule.ARGUMENTS_PREFIX + "ProcessInfo", pi);
|
||||
|
||||
|
||||
msg = engine.eval(rule.getScript()).toString();
|
||||
//transaction should rollback if there are error in process
|
||||
if ("@Error@".equals(msg))
|
||||
success = false;
|
||||
|
||||
|
||||
// Parse Variables
|
||||
msg = Msg.parseTranslation(ctx, msg);
|
||||
pi.setSummary (msg, !success);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -278,7 +291,7 @@ public final class ProcessUtil {
|
|||
if (success) {
|
||||
if (trx != null)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
trx.commit(true);
|
||||
} catch (Exception e)
|
||||
|
@ -299,7 +312,7 @@ public final class ProcessUtil {
|
|||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
public static MWFProcess startWorkFlow(Properties ctx, ProcessInfo pi, int AD_Workflow_ID) {
|
||||
MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID);
|
||||
MWFProcess wfProcess = null;
|
||||
|
@ -322,6 +335,6 @@ public final class ProcessUtil {
|
|||
public static boolean startJavaProcessWithoutTrxClose(Properties ctx, ProcessInfo pi, Trx trx) {
|
||||
return startJavaProcess(ctx, pi, trx, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -91,7 +91,7 @@ import org.w3c.dom.Element;
|
|||
* <li>https://sourceforge.net/tracker/?func=detail&aid=2947622&group_id=176962&atid=879332
|
||||
*/
|
||||
public abstract class PO
|
||||
implements Serializable, Comparator, Evaluatee
|
||||
implements Serializable, Comparator, Evaluatee, Cloneable
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
@ -4009,4 +4009,46 @@ public abstract class PO
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
PO clone = (PO) super.clone();
|
||||
clone.m_trxName = null;
|
||||
if (m_custom != null)
|
||||
{
|
||||
clone.m_custom = new HashMap<String, String>();
|
||||
clone.m_custom.putAll(m_custom);
|
||||
}
|
||||
if (m_newValues != null)
|
||||
{
|
||||
clone.m_newValues = new Object[m_newValues.length];
|
||||
for(int i = 0; i < m_newValues.length; i++)
|
||||
{
|
||||
clone.m_newValues[i] = m_newValues[i];
|
||||
}
|
||||
}
|
||||
if (m_oldValues != null)
|
||||
{
|
||||
clone.m_oldValues = new Object[m_oldValues.length];
|
||||
for(int i = 0; i < m_oldValues.length; i++)
|
||||
{
|
||||
clone.m_oldValues[i] = m_oldValues[i];
|
||||
}
|
||||
}
|
||||
if (m_IDs != null)
|
||||
{
|
||||
clone.m_IDs = new Object[m_IDs.length];
|
||||
for(int i = 0; i < m_IDs.length; i++)
|
||||
{
|
||||
clone.m_IDs[i] = m_IDs[i];
|
||||
}
|
||||
}
|
||||
clone.p_ctx = Env.getCtx();
|
||||
clone.m_doc = null;
|
||||
clone.m_lobInfo = null;
|
||||
clone.m_attachment = null;
|
||||
clone.m_isReplication = false;
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
} // PO
|
||||
|
|
|
@ -29,6 +29,7 @@ import javax.sql.RowSet;
|
|||
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.X_AD_PrintFormat;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -49,7 +50,7 @@ import org.compiere.util.Util;
|
|||
public class MPrintFormat extends X_AD_PrintFormat
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3626220385155526700L;
|
||||
|
||||
|
@ -64,7 +65,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
{
|
||||
super (ctx, AD_PrintFormat_ID, trxName);
|
||||
// Language=[Deutsch,Locale=de_DE,AD_Language=en_US,DatePattern=DD.MM.YYYY,DecimalPoint=false]
|
||||
m_language = Language.getLoginLanguage();
|
||||
m_language = Env.getLanguage(ctx);
|
||||
if (AD_PrintFormat_ID == 0)
|
||||
{
|
||||
setStandardHeaderFooter(true);
|
||||
|
@ -74,7 +75,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
}
|
||||
m_items = getItems();
|
||||
} // MPrintFormat
|
||||
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
|
@ -84,7 +85,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
public MPrintFormat (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
m_language = Language.getLoginLanguage();
|
||||
m_language = Env.getLanguage(ctx);
|
||||
m_items = getItems();
|
||||
} // MPrintFormat
|
||||
|
||||
|
@ -192,7 +193,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
// Display restrictions - Passwords, etc.
|
||||
+ " AND NOT EXISTS (SELECT * FROM AD_Field f "
|
||||
+ "WHERE pfi.AD_Column_ID=f.AD_Column_ID"
|
||||
+ " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL))"
|
||||
+ " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL))"
|
||||
+ "ORDER BY SeqNo";
|
||||
MRole role = MRole.getDefault(getCtx(), false);
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -260,7 +261,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
log.fine("setTranslation #" + no);
|
||||
} // setTranslation
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Set Standard Header
|
||||
* @param standardHeaderFooter true if std header
|
||||
|
@ -287,7 +288,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
super.setIsForm(false);
|
||||
} // setIsTableBased
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Set Translation View Language.
|
||||
* @param language language (checked for base language)
|
||||
|
@ -331,7 +332,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
}
|
||||
} // setTranslationViewQuery
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Optional TableFormat
|
||||
* @param AD_PrintTableFormat_ID table format
|
||||
|
@ -367,7 +368,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Load Special data (images, ..).
|
||||
* To be extended by sub-classes
|
||||
|
@ -421,7 +422,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
* @param AD_PrintFormat_ID 0 or existing PrintFormat
|
||||
* @return print format
|
||||
*/
|
||||
static public MPrintFormat createFromTable (Properties ctx,
|
||||
static public MPrintFormat createFromTable (Properties ctx,
|
||||
int AD_Table_ID, int AD_PrintFormat_ID)
|
||||
{
|
||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||
|
@ -650,13 +651,13 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "(table) - " + sql, e);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
MPrintFormatItem[] retValue = new MPrintFormatItem[list.size()];
|
||||
list.toArray(retValue);
|
||||
|
@ -694,18 +695,18 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
* @param fromItems from items
|
||||
* @param toItems to items
|
||||
*/
|
||||
static private void copyTranslationItems (MPrintFormatItem[] fromItems,
|
||||
static private void copyTranslationItems (MPrintFormatItem[] fromItems,
|
||||
MPrintFormatItem[] toItems)
|
||||
{
|
||||
if (fromItems == null || toItems == null)
|
||||
return; // should not happen
|
||||
|
||||
|
||||
int counter = 0;
|
||||
for (int i = 0; i < fromItems.length; i++)
|
||||
{
|
||||
{
|
||||
int fromID = fromItems[i].getAD_PrintFormatItem_ID();
|
||||
int toID = toItems[i].getAD_PrintFormatItem_ID();
|
||||
|
||||
|
||||
StringBuffer sql = new StringBuffer("UPDATE AD_PrintFormatItem_Trl new ")
|
||||
// Set
|
||||
.append("SET (PrintName, PrintNameSuffix, IsTranslated) = ")
|
||||
|
@ -730,7 +731,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
s_log.finest("#" + counter);
|
||||
} // copyTranslationItems
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Copy existing Definition To Client
|
||||
* @param ctx context
|
||||
|
@ -738,7 +739,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
* @param to_AD_PrintFormat_ID format
|
||||
* @return print format
|
||||
*/
|
||||
public static MPrintFormat copy (Properties ctx,
|
||||
public static MPrintFormat copy (Properties ctx,
|
||||
int from_AD_PrintFormat_ID, int to_AD_PrintFormat_ID)
|
||||
{
|
||||
return copy (ctx, from_AD_PrintFormat_ID, to_AD_PrintFormat_ID, -1);
|
||||
|
@ -751,7 +752,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
* @param to_Client_ID to client
|
||||
* @return print format
|
||||
*/
|
||||
public static MPrintFormat copyToClient (Properties ctx,
|
||||
public static MPrintFormat copyToClient (Properties ctx,
|
||||
int AD_PrintFormat_ID, int to_Client_ID)
|
||||
{
|
||||
return copy (ctx, AD_PrintFormat_ID, 0, to_Client_ID);
|
||||
|
@ -769,7 +770,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
int to_AD_PrintFormat_ID, int to_Client_ID)
|
||||
{
|
||||
s_log.info ("From AD_PrintFormat_ID=" + from_AD_PrintFormat_ID
|
||||
+ ", To AD_PrintFormat_ID=" + to_AD_PrintFormat_ID
|
||||
+ ", To AD_PrintFormat_ID=" + to_AD_PrintFormat_ID
|
||||
+ ", To Client_ID=" + to_Client_ID);
|
||||
if (from_AD_PrintFormat_ID == 0)
|
||||
throw new IllegalArgumentException ("From_AD_PrintFormat_ID is 0");
|
||||
|
@ -786,8 +787,8 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
}
|
||||
// Set Name - Remove TEMPLATE - add copy
|
||||
to.setName(Util.replace(to.getName(), "TEMPLATE", String.valueOf(to_Client_ID)));
|
||||
to.setName(to.getName()
|
||||
+ " " + Msg.getMsg(ctx, "Copy")
|
||||
to.setName(to.getName()
|
||||
+ " " + Msg.getMsg(ctx, "Copy")
|
||||
+ " " + to.hashCode()); // unique name
|
||||
//
|
||||
to.save();
|
||||
|
@ -823,6 +824,15 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
else
|
||||
s_formats.put(key, pf);
|
||||
}
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
try {
|
||||
pf = pf.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return pf;
|
||||
} // get
|
||||
|
||||
|
@ -843,7 +853,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
sql += "AD_ReportView_ID=?";
|
||||
else
|
||||
sql += "AD_Table_ID=?";
|
||||
sql += " ORDER BY IsDefault DESC";
|
||||
sql += " ORDER BY IsDefault DESC";
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
|
@ -872,7 +882,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
Integer key = new Integer(AD_PrintFormat_ID);
|
||||
s_formats.put(key, null);
|
||||
} // deleteFromCache
|
||||
|
||||
|
||||
//begin vpj-cd e-evolution
|
||||
/**
|
||||
* Get ID of Print Format use Name
|
||||
|
@ -888,10 +898,10 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
return DB.getSQLValue(null, sql, formatName, AD_Table_ID, AD_Client_ID);
|
||||
}
|
||||
//end vpj-cd e-evolution
|
||||
|
||||
|
||||
/**
|
||||
* @param AD_Table_ID
|
||||
* @param AD_Client_ID use -1 to retrieve from all client
|
||||
* @param AD_Client_ID use -1 to retrieve from all client
|
||||
* @param trxName
|
||||
*/
|
||||
public static RowSet getAccessiblePrintFormats (int AD_Table_ID, int AD_Client_ID, String trxName)
|
||||
|
@ -904,7 +914,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
{
|
||||
sql = sql + " AND AD_Client_ID = ? ";
|
||||
}
|
||||
sql = sql + "ORDER BY AD_Client_ID DESC, IsDefault DESC, Name"; // Own First
|
||||
sql = sql + "ORDER BY AD_Client_ID DESC, IsDefault DESC, Name"; // Own First
|
||||
//
|
||||
sql = MRole.getDefault().addAccessSQL (
|
||||
sql, "AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
|
@ -925,11 +935,23 @@ public class MPrintFormat extends X_AD_PrintFormat
|
|||
DB.close(pstmt);
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
|
||||
return rowSet;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MPrintFormat clone() throws CloneNotSupportedException {
|
||||
MPrintFormat clone = (MPrintFormat) super.clone();
|
||||
clone.m_items = m_items == null ? null : new MPrintFormatItem[m_items.length];
|
||||
for(int i = 0; i < m_items.length; i++) {
|
||||
clone.m_items[i] = m_items[i];
|
||||
}
|
||||
clone.m_tFormat = m_tFormat;
|
||||
clone.m_language = Env.getLanguage(Env.getCtx());
|
||||
clone.m_translationViewLanguage = null;
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Test
|
||||
* @param args arga
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.logging.Level;
|
|||
* </pre>
|
||||
* @author Jorg Janke
|
||||
* @version $Id: DisplayType.java,v 1.6 2006/08/30 20:30:44 comdivision Exp $
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1810632 ] PricePrecision error in InfoProduct (and similar)
|
||||
*/
|
||||
|
@ -100,8 +100,8 @@ public final class DisplayType
|
|||
public static final int URL = 40;
|
||||
/** Display Type 42 PrinterName */
|
||||
public static final int PrinterName = 42;
|
||||
// Candidates:
|
||||
|
||||
// Candidates:
|
||||
|
||||
/**
|
||||
* - New Display Type
|
||||
INSERT INTO AD_REFERENCE
|
||||
|
@ -130,7 +130,7 @@ public final class DisplayType
|
|||
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (DisplayType.class);
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if (numeric) ID (Table, Search, Account, ..).
|
||||
* (stored as Integer)
|
||||
|
@ -155,12 +155,12 @@ public final class DisplayType
|
|||
*/
|
||||
public static boolean isNumeric(int displayType)
|
||||
{
|
||||
if (displayType == Amount || displayType == Number || displayType == CostPrice
|
||||
if (displayType == Amount || displayType == Number || displayType == CostPrice
|
||||
|| displayType == Integer || displayType == Quantity)
|
||||
return true;
|
||||
return false;
|
||||
} // isNumeric
|
||||
|
||||
|
||||
/**
|
||||
* Get Default Precision.
|
||||
* Used for databases who cannot handle dynamic number precision.
|
||||
|
@ -173,12 +173,12 @@ public final class DisplayType
|
|||
return 2;
|
||||
if (displayType == Number)
|
||||
return 6;
|
||||
if (displayType == CostPrice
|
||||
if (displayType == CostPrice
|
||||
|| displayType == Quantity)
|
||||
return 4;
|
||||
return 0;
|
||||
} // getDefaultPrecision
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns true, if DisplayType is text (String, Text, TextLong, Memo).
|
||||
|
@ -187,7 +187,7 @@ public final class DisplayType
|
|||
*/
|
||||
public static boolean isText(int displayType)
|
||||
{
|
||||
if (displayType == String || displayType == Text
|
||||
if (displayType == String || displayType == Text
|
||||
|| displayType == TextLong || displayType == Memo
|
||||
|| displayType == FilePath || displayType == FileName
|
||||
|| displayType == URL || displayType == PrinterName)
|
||||
|
@ -221,7 +221,7 @@ public final class DisplayType
|
|||
return true;
|
||||
return false;
|
||||
} // isLookup
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if DisplayType is a Large Object
|
||||
* @param displayType Display Type
|
||||
|
@ -229,7 +229,7 @@ public final class DisplayType
|
|||
*/
|
||||
public static boolean isLOB (int displayType)
|
||||
{
|
||||
if (displayType == Binary
|
||||
if (displayType == Binary
|
||||
|| displayType == TextLong)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -295,7 +295,7 @@ public final class DisplayType
|
|||
}
|
||||
return format;
|
||||
} // getDecimalFormat
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Return Format for numeric DisplayType
|
||||
* @param displayType Display Type (default Number)
|
||||
|
@ -306,7 +306,7 @@ public final class DisplayType
|
|||
{
|
||||
return getNumberFormat(displayType, language, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return Format for numeric DisplayType
|
||||
* @param displayType Display Type
|
||||
|
@ -368,7 +368,7 @@ public final class DisplayType
|
|||
{
|
||||
Language myLanguage = language;
|
||||
if (myLanguage == null)
|
||||
myLanguage = Language.getLoginLanguage();
|
||||
myLanguage = Env.getLanguage(Env.getCtx());
|
||||
//
|
||||
if ( pattern != null && pattern.length() > 0)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ public final class DisplayType
|
|||
s_log.log(Level.WARNING, "Invalid date pattern: " + pattern);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (displayType == DateTime)
|
||||
return myLanguage.getDateTimeFormat();
|
||||
else if (displayType == Time)
|
||||
|
@ -454,8 +454,8 @@ public final class DisplayType
|
|||
&& columnName.equals("BinaryData"))
|
||||
return "BLOB";
|
||||
// ID, CreatedBy/UpdatedBy, Acct
|
||||
else if (columnName.endsWith("_ID")
|
||||
|| columnName.endsWith("tedBy")
|
||||
else if (columnName.endsWith("_ID")
|
||||
|| columnName.endsWith("tedBy")
|
||||
|| columnName.endsWith("_Acct") )
|
||||
return "NUMBER(10)";
|
||||
else if (fieldLength < 4)
|
||||
|
@ -472,7 +472,7 @@ public final class DisplayType
|
|||
return "NUMBER";
|
||||
if (displayType == DisplayType.Binary)
|
||||
return "BLOB";
|
||||
if (displayType == DisplayType.TextLong
|
||||
if (displayType == DisplayType.TextLong
|
||||
|| (displayType == DisplayType.Text && fieldLength >= 4000))
|
||||
return "CLOB";
|
||||
if (displayType == DisplayType.YesNo)
|
||||
|
@ -481,7 +481,7 @@ public final class DisplayType
|
|||
if (fieldLength == 1)
|
||||
return "CHAR(" + fieldLength + ")";
|
||||
else
|
||||
return "NVARCHAR2(" + fieldLength + ")";
|
||||
return "NVARCHAR2(" + fieldLength + ")";
|
||||
}
|
||||
if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID
|
||||
{
|
||||
|
@ -499,10 +499,10 @@ public final class DisplayType
|
|||
}
|
||||
if (!DisplayType.isText(displayType))
|
||||
s_log.severe("Unhandled Data Type = " + displayType);
|
||||
|
||||
|
||||
return "NVARCHAR2(" + fieldLength + ")";
|
||||
} // getSQLDataType
|
||||
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
* @param displayType display Type
|
||||
|
@ -577,5 +577,5 @@ public final class DisplayType
|
|||
//
|
||||
return "UNKNOWN DisplayType=" + displayType;
|
||||
} // getDescription
|
||||
|
||||
|
||||
} // DisplayType
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class Env
|
|||
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
|
||||
|
||||
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
||||
|
||||
|
||||
/**
|
||||
* @param provider
|
||||
* @deprecated
|
||||
|
@ -95,7 +95,7 @@ public final class Env
|
|||
{
|
||||
return eventListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exit System
|
||||
* @param status System exit status (usually 0 for no error)
|
||||
|
@ -145,7 +145,7 @@ public final class Env
|
|||
{
|
||||
listener.onReset(finalCall);
|
||||
}
|
||||
|
||||
|
||||
// Clear all Context
|
||||
if (finalCall)
|
||||
getCtx().clear();
|
||||
|
@ -1027,6 +1027,33 @@ public final class Env
|
|||
return Language.getLoginLanguage();
|
||||
} // getLanguage
|
||||
|
||||
public static ArrayList<String> getSupportedLanguages()
|
||||
{
|
||||
ArrayList<String> AD_Languages = new ArrayList<String>();
|
||||
String sql = "SELECT DISTINCT AD_Language FROM AD_Message_Trl";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String AD_Language = rs.getString(1);
|
||||
AD_Languages.add(AD_Language);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
getLogger().log(Level.SEVERE, "", e);
|
||||
}
|
||||
finally {
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
return AD_Languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify Language.
|
||||
* Check that language is supported by the system
|
||||
|
@ -1176,7 +1203,7 @@ public final class Env
|
|||
for(IEnvEventListener listener : listeners)
|
||||
{
|
||||
listener.onClearWindowContext(WindowNo);
|
||||
}
|
||||
}
|
||||
} // clearWinContext
|
||||
|
||||
/**
|
||||
|
@ -1347,7 +1374,7 @@ public final class Env
|
|||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Clean up context for Window (i.e. delete it)
|
||||
* @param WindowNo window
|
||||
|
@ -1536,11 +1563,11 @@ public final class Env
|
|||
{
|
||||
if(!(key instanceof String))
|
||||
continue;
|
||||
|
||||
|
||||
Object value = ctx.get(key);
|
||||
if (!(value instanceof String))
|
||||
continue;
|
||||
|
||||
|
||||
p.put(key, value);
|
||||
}
|
||||
|
||||
|
@ -1548,9 +1575,9 @@ public final class Env
|
|||
}
|
||||
|
||||
/** Window Cache */
|
||||
private static CCache<Integer,GridWindowVO> s_windowsvo
|
||||
private static CCache<Integer,GridWindowVO> s_windowsvo
|
||||
= new CCache<Integer,GridWindowVO>("AD_Window", 10);
|
||||
|
||||
|
||||
/**
|
||||
* Get Window Model
|
||||
*
|
||||
|
@ -1572,7 +1599,7 @@ public final class Env
|
|||
getLogger().info("Cached=" + mWindowVO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create Window Model on Client
|
||||
if (mWindowVO == null)
|
||||
{
|
||||
|
@ -1583,7 +1610,7 @@ public final class Env
|
|||
} // from Client
|
||||
if (mWindowVO == null)
|
||||
return null;
|
||||
|
||||
|
||||
// Check (remote) context
|
||||
if (!mWindowVO.ctx.equals(Env.getCtx()))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue