Implement [ 1810133 ] Add logging policy on column level
This commit is contained in:
parent
6aa7c87454
commit
d823361719
|
@ -509,4 +509,13 @@ public interface I_AD_Column
|
|||
* Version of the table definition
|
||||
*/
|
||||
public BigDecimal getVersion();
|
||||
|
||||
/** Column name IsAllowLogging */
|
||||
public static final String COLUMNNAME_isAllowLogging = "IsAllowLogging";
|
||||
|
||||
|
||||
/** Get IsAllowLogging .
|
||||
* Determines, if a column must be recorded into the change log
|
||||
*/
|
||||
public boolean IsAllowLogging() ;
|
||||
}
|
||||
|
|
|
@ -1,222 +1,231 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import org.compiere.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Change Log Model
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MChangeLog.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
|
||||
*/
|
||||
public class MChangeLog extends X_AD_ChangeLog
|
||||
{
|
||||
/**
|
||||
* Do we track changes for this table
|
||||
* @param AD_Table_ID table
|
||||
* @return true if changes are tracked
|
||||
*/
|
||||
public static boolean isLogged (int AD_Table_ID)
|
||||
{
|
||||
if (s_changeLog == null || s_changeLog.length == 0)
|
||||
fillChangeLog();
|
||||
//
|
||||
int index = Arrays.binarySearch(s_changeLog, AD_Table_ID);
|
||||
return index >= 0;
|
||||
} // trackChanges
|
||||
|
||||
/**
|
||||
* Fill Log with tables to be logged
|
||||
*/
|
||||
private static void fillChangeLog()
|
||||
{
|
||||
ArrayList<Integer> list = new ArrayList<Integer>(40);
|
||||
String sql = "SELECT t.AD_Table_ID FROM AD_Table t "
|
||||
+ "WHERE t.IsChangeLog='Y'" // also inactive
|
||||
+ " OR EXISTS (SELECT * FROM AD_Column c "
|
||||
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='EntityType') "
|
||||
+ "ORDER BY t.AD_Table_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new Integer(rs.getInt(1)));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
// Convert to Array
|
||||
s_changeLog = new int [list.size()];
|
||||
for (int i = 0; i < s_changeLog.length; i++)
|
||||
{
|
||||
Integer id = (Integer)list.get(i);
|
||||
s_changeLog[i] = id.intValue();
|
||||
}
|
||||
s_log.info("#" + s_changeLog.length);
|
||||
} // fillChangeLog
|
||||
|
||||
/** Change Log */
|
||||
private static int[] s_changeLog = null;
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger(MChangeLog.class);
|
||||
/** NULL Value */
|
||||
public static String NULL = "NULL";
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MChangeLog(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param AD_ChangeLog_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MChangeLog (Properties ctx, int AD_ChangeLog_ID, String trxName)
|
||||
{
|
||||
super (ctx, 0, trxName);
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Preserved for backward compatibility
|
||||
*@deprecated
|
||||
*/
|
||||
public MChangeLog (Properties ctx,
|
||||
int AD_ChangeLog_ID, String TrxName, int AD_Session_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue)
|
||||
{
|
||||
this(ctx, AD_ChangeLog_ID, TrxName, AD_Session_ID, AD_Table_ID,
|
||||
AD_Column_ID, Record_ID, AD_Client_ID, AD_Org_ID, OldValue,
|
||||
NewValue, (String) null /*event*/ );
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Full Constructor
|
||||
* @param ctx context
|
||||
* @param AD_ChangeLog_ID 0 for new change log
|
||||
* @param TrxName transaction
|
||||
* @param AD_Session_ID session
|
||||
* @param AD_Table_ID table
|
||||
* @param AD_Column_ID column
|
||||
* @param Record_ID record
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
* @param OldValue old
|
||||
* @param NewValue new
|
||||
*/
|
||||
public MChangeLog (Properties ctx,
|
||||
int AD_ChangeLog_ID, String TrxName, int AD_Session_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue, String event)
|
||||
{
|
||||
this (ctx, 0, TrxName);
|
||||
if (AD_ChangeLog_ID == 0)
|
||||
{
|
||||
AD_ChangeLog_ID = DB.getNextID (AD_Client_ID, Table_Name, TrxName);
|
||||
if (AD_ChangeLog_ID <= 0)
|
||||
log.severe("No NextID (" + AD_ChangeLog_ID + ")");
|
||||
}
|
||||
setAD_ChangeLog_ID (AD_ChangeLog_ID);
|
||||
setTrxName(TrxName);
|
||||
setAD_Session_ID (AD_Session_ID);
|
||||
//
|
||||
setAD_Table_ID (AD_Table_ID);
|
||||
setAD_Column_ID (AD_Column_ID);
|
||||
setRecord_ID (Record_ID);
|
||||
//
|
||||
setClientOrg (AD_Client_ID, AD_Org_ID);
|
||||
//
|
||||
setOldValue (OldValue);
|
||||
setNewValue (NewValue);
|
||||
setEventChangeLog(event);
|
||||
// EVENT / Release 3.3.1t_2007-12-05 ADempiere
|
||||
// Drop description from AD_ChangeLog - pass it to AD_Session to save disk space
|
||||
// setDescription(Adempiere.MAIN_VERSION + "_" + Adempiere.DATE_VERSION + " " + Adempiere.getImplementationVersion());
|
||||
} // MChangeLog
|
||||
|
||||
|
||||
/**
|
||||
* Set Old Value
|
||||
* @param OldValue old
|
||||
*/
|
||||
public void setOldValue (Object OldValue)
|
||||
{
|
||||
if (OldValue == null)
|
||||
super.setOldValue (NULL);
|
||||
else
|
||||
super.setOldValue (OldValue.toString());
|
||||
} // setOldValue
|
||||
|
||||
/**
|
||||
* Is Old Value Null
|
||||
* @return true if null
|
||||
*/
|
||||
public boolean isOldNull()
|
||||
{
|
||||
String value = getOldValue();
|
||||
return value == null || value.equals(NULL);
|
||||
} // isOldNull
|
||||
|
||||
/**
|
||||
* Set New Value
|
||||
* @param NewValue new
|
||||
*/
|
||||
public void setNewValue (Object NewValue)
|
||||
{
|
||||
if (NewValue == null)
|
||||
super.setNewValue (NULL);
|
||||
else
|
||||
super.setNewValue (NewValue.toString());
|
||||
} // setNewValue
|
||||
|
||||
/**
|
||||
* Is New Value Null
|
||||
* @return true if null
|
||||
*/
|
||||
public boolean isNewNull()
|
||||
{
|
||||
String value = getNewValue();
|
||||
return value == null || value.equals(NULL);
|
||||
} // isNewNull
|
||||
|
||||
} // MChangeLog
|
||||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
* Change Log Model
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MChangeLog.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
|
||||
*/
|
||||
public class MChangeLog extends X_AD_ChangeLog
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7156972859181201446L;
|
||||
|
||||
|
||||
/**
|
||||
* Do we track changes for this table
|
||||
* @param AD_Table_ID table
|
||||
* @return true if changes are tracked
|
||||
*/
|
||||
public static boolean isLogged (int AD_Table_ID)
|
||||
{
|
||||
if (s_changeLog == null || s_changeLog.length == 0)
|
||||
fillChangeLog();
|
||||
//
|
||||
int index = Arrays.binarySearch(s_changeLog, AD_Table_ID);
|
||||
return index >= 0;
|
||||
} // trackChanges
|
||||
|
||||
/**
|
||||
* Fill Log with tables to be logged
|
||||
*/
|
||||
private static void fillChangeLog()
|
||||
{
|
||||
ArrayList<Integer> list = new ArrayList<Integer>(40);
|
||||
String sql = "SELECT t.AD_Table_ID FROM AD_Table t "
|
||||
+ "WHERE t.IsChangeLog='Y'" // also inactive
|
||||
+ " OR EXISTS (SELECT * FROM AD_Column c "
|
||||
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='EntityType') "
|
||||
+ "ORDER BY t.AD_Table_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new Integer(rs.getInt(1)));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
// Convert to Array
|
||||
s_changeLog = new int [list.size()];
|
||||
for (int i = 0; i < s_changeLog.length; i++)
|
||||
{
|
||||
Integer id = (Integer)list.get(i);
|
||||
s_changeLog[i] = id.intValue();
|
||||
}
|
||||
s_log.info("#" + s_changeLog.length);
|
||||
} // fillChangeLog
|
||||
|
||||
/** Change Log */
|
||||
private static int[] s_changeLog = null;
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger(MChangeLog.class);
|
||||
/** NULL Value */
|
||||
public static String NULL = "NULL";
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MChangeLog(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param AD_ChangeLog_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MChangeLog (Properties ctx, int AD_ChangeLog_ID, String trxName)
|
||||
{
|
||||
super (ctx, 0, trxName);
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Preserved for backward compatibility
|
||||
*@deprecated
|
||||
*/
|
||||
public MChangeLog (Properties ctx,
|
||||
int AD_ChangeLog_ID, String TrxName, int AD_Session_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue)
|
||||
{
|
||||
this(ctx, AD_ChangeLog_ID, TrxName, AD_Session_ID, AD_Table_ID,
|
||||
AD_Column_ID, Record_ID, AD_Client_ID, AD_Org_ID, OldValue,
|
||||
NewValue, (String) null /*event*/ );
|
||||
} // MChangeLog
|
||||
|
||||
/**
|
||||
* Full Constructor
|
||||
* @param ctx context
|
||||
* @param AD_ChangeLog_ID 0 for new change log
|
||||
* @param TrxName transaction
|
||||
* @param AD_Session_ID session
|
||||
* @param AD_Table_ID table
|
||||
* @param AD_Column_ID column
|
||||
* @param Record_ID record
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
* @param OldValue old
|
||||
* @param NewValue new
|
||||
*/
|
||||
public MChangeLog (Properties ctx,
|
||||
int AD_ChangeLog_ID, String TrxName, int AD_Session_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue, String event)
|
||||
{
|
||||
this (ctx, 0, TrxName);
|
||||
if (AD_ChangeLog_ID == 0)
|
||||
{
|
||||
AD_ChangeLog_ID = DB.getNextID (AD_Client_ID, Table_Name, TrxName);
|
||||
if (AD_ChangeLog_ID <= 0)
|
||||
log.severe("No NextID (" + AD_ChangeLog_ID + ")");
|
||||
}
|
||||
setAD_ChangeLog_ID (AD_ChangeLog_ID);
|
||||
setTrxName(TrxName);
|
||||
setAD_Session_ID (AD_Session_ID);
|
||||
//
|
||||
setAD_Table_ID (AD_Table_ID);
|
||||
setAD_Column_ID (AD_Column_ID);
|
||||
setRecord_ID (Record_ID);
|
||||
//
|
||||
setClientOrg (AD_Client_ID, AD_Org_ID);
|
||||
//
|
||||
setOldValue (OldValue);
|
||||
setNewValue (NewValue);
|
||||
setEventChangeLog(event);
|
||||
// EVENT / Release 3.3.1t_2007-12-05 ADempiere
|
||||
// Drop description from AD_ChangeLog - pass it to AD_Session to save disk space
|
||||
// setDescription(Adempiere.MAIN_VERSION + "_" + Adempiere.DATE_VERSION + " " + Adempiere.getImplementationVersion());
|
||||
} // MChangeLog
|
||||
|
||||
|
||||
/**
|
||||
* Set Old Value
|
||||
* @param OldValue old
|
||||
*/
|
||||
public void setOldValue (Object OldValue)
|
||||
{
|
||||
if (OldValue == null)
|
||||
super.setOldValue (NULL);
|
||||
else
|
||||
super.setOldValue (OldValue.toString());
|
||||
} // setOldValue
|
||||
|
||||
/**
|
||||
* Is Old Value Null
|
||||
* @return true if null
|
||||
*/
|
||||
public boolean isOldNull()
|
||||
{
|
||||
String value = getOldValue();
|
||||
return value == null || value.equals(NULL);
|
||||
} // isOldNull
|
||||
|
||||
/**
|
||||
* Set New Value
|
||||
* @param NewValue new
|
||||
*/
|
||||
public void setNewValue (Object NewValue)
|
||||
{
|
||||
if (NewValue == null)
|
||||
super.setNewValue (NULL);
|
||||
else
|
||||
super.setNewValue (NewValue.toString());
|
||||
} // setNewValue
|
||||
|
||||
/**
|
||||
* Is New Value Null
|
||||
* @return true if null
|
||||
*/
|
||||
public boolean isNewNull()
|
||||
{
|
||||
String value = getNewValue();
|
||||
return value == null || value.equals(NULL);
|
||||
} // isNewNull
|
||||
|
||||
} // MChangeLog
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,316 +1,319 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Session Model.
|
||||
* Maintained in AMenu.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MSession.java,v 1.3 2006/07/30 00:58:05 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1810182 ] Session lost after cache reset
|
||||
* <li>BF [ 1892156 ] MSession is not really cached
|
||||
*/
|
||||
public class MSession extends X_AD_Session
|
||||
{
|
||||
/**
|
||||
* Get existing or create local session
|
||||
* @param ctx context
|
||||
* @param createNew create if not found
|
||||
* @return session session
|
||||
*/
|
||||
public static MSession get (Properties ctx, boolean createNew)
|
||||
{
|
||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
||||
MSession session = null;
|
||||
if (AD_Session_ID > 0)
|
||||
session = (MSession)s_sessions.get(new Integer(AD_Session_ID));
|
||||
// Try to load
|
||||
if (session == null && AD_Session_ID > 0)
|
||||
{
|
||||
session = new MSession(ctx, AD_Session_ID, null);
|
||||
if (session.get_ID() != AD_Session_ID) {
|
||||
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
}
|
||||
s_sessions.put(AD_Session_ID, session);
|
||||
}
|
||||
// Create New
|
||||
if (session == null && createNew)
|
||||
{
|
||||
session = new MSession (ctx, null); // local session
|
||||
session.save();
|
||||
AD_Session_ID = session.getAD_Session_ID();
|
||||
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
s_sessions.put (new Integer(AD_Session_ID), session);
|
||||
}
|
||||
return session;
|
||||
} // get
|
||||
|
||||
/**
|
||||
* Get existing or create remote session
|
||||
* @param ctx context
|
||||
* @param Remote_Addr remote address
|
||||
* @param Remote_Host remote host
|
||||
* @param WebSession web session
|
||||
* @return session
|
||||
*/
|
||||
public static MSession get (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession)
|
||||
{
|
||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
||||
MSession session = null;
|
||||
if (AD_Session_ID > 0)
|
||||
session = (MSession)s_sessions.get(new Integer(AD_Session_ID));
|
||||
if (session == null)
|
||||
{
|
||||
session = new MSession (ctx, Remote_Addr, Remote_Host, WebSession, null); // remote session
|
||||
session.save();
|
||||
AD_Session_ID = session.getAD_Session_ID();
|
||||
Env.setContext(ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
s_sessions.put(new Integer(AD_Session_ID), session);
|
||||
}
|
||||
return session;
|
||||
} // get
|
||||
|
||||
/** Sessions */
|
||||
private static CCache<Integer, MSession> s_sessions = Ini.isClient()
|
||||
? new CCache<Integer, MSession>("AD_Session_ID", 1, 0) // one client session
|
||||
: new CCache<Integer, MSession>("AD_Session_ID", 30, 0); // no time-out
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param AD_Session_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, int AD_Session_ID, String trxName)
|
||||
{
|
||||
super(ctx, AD_Session_ID, trxName);
|
||||
if (AD_Session_ID == 0)
|
||||
{
|
||||
setProcessed (false);
|
||||
}
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* Load Costructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* New (remote) Constructor
|
||||
* @param ctx context
|
||||
* @param Remote_Addr remote address
|
||||
* @param Remote_Host remote host
|
||||
* @param WebSession web session
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession, String trxName)
|
||||
{
|
||||
this (ctx, 0, trxName);
|
||||
if (Remote_Addr != null)
|
||||
setRemote_Addr(Remote_Addr);
|
||||
if (Remote_Host != null)
|
||||
setRemote_Host(Remote_Host);
|
||||
if (WebSession != null)
|
||||
setWebSession(WebSession);
|
||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||
+ Adempiere.DATE_VERSION + " "
|
||||
+ Adempiere.getImplementationVersion());
|
||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* New (local) Constructor
|
||||
* @param ctx context
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, String trxName)
|
||||
{
|
||||
this (ctx, 0, trxName);
|
||||
try
|
||||
{
|
||||
InetAddress lh = InetAddress.getLocalHost();
|
||||
setRemote_Addr(lh.getHostAddress());
|
||||
setRemote_Host(lh.getHostName());
|
||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||
+ Adempiere.DATE_VERSION + " "
|
||||
+ Adempiere.getImplementationVersion());
|
||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "No Local Host", e);
|
||||
}
|
||||
} // MSession
|
||||
|
||||
/** Web Store Session */
|
||||
private boolean m_webStoreSession = false;
|
||||
|
||||
/**
|
||||
* Is it a Web Store Session
|
||||
* @return Returns true if Web Store Session.
|
||||
*/
|
||||
public boolean isWebStoreSession ()
|
||||
{
|
||||
return m_webStoreSession;
|
||||
} // isWebStoreSession
|
||||
|
||||
/**
|
||||
* Set Web Store Session
|
||||
* @param webStoreSession The webStoreSession to set.
|
||||
*/
|
||||
public void setWebStoreSession (boolean webStoreSession)
|
||||
{
|
||||
m_webStoreSession = webStoreSession;
|
||||
} // setWebStoreSession
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer("MSession[")
|
||||
.append(getAD_Session_ID())
|
||||
.append(",AD_User_ID=").append(getCreatedBy())
|
||||
.append(",").append(getCreated())
|
||||
.append(",Remote=").append(getRemote_Addr());
|
||||
String s = getRemote_Host();
|
||||
if (s != null && s.length() > 0)
|
||||
sb.append(",").append(s);
|
||||
if (m_webStoreSession)
|
||||
sb.append(",WebStoreSession");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
/**
|
||||
* Session Logout
|
||||
*/
|
||||
public void logout()
|
||||
{
|
||||
setProcessed(true);
|
||||
save();
|
||||
s_sessions.remove(new Integer(getAD_Session_ID()));
|
||||
log.info(TimeUtil.formatElapsed(getCreated(), getUpdated()));
|
||||
} // logout
|
||||
|
||||
/**
|
||||
* Preserved for backward compatibility
|
||||
*@deprecated
|
||||
*/
|
||||
public MChangeLog changeLog (
|
||||
String TrxName, int AD_ChangeLog_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue)
|
||||
{
|
||||
return changeLog(TrxName, AD_ChangeLog_ID, AD_Table_ID, AD_Column_ID,
|
||||
Record_ID, AD_Client_ID, AD_Org_ID, OldValue, NewValue,
|
||||
(String) null);
|
||||
} // changeLog
|
||||
|
||||
/**
|
||||
* Create Change Log only if table is logged
|
||||
* @param TrxName transaction name
|
||||
* @param AD_ChangeLog_ID 0 for new change log
|
||||
* @param AD_Table_ID table
|
||||
* @param AD_Column_ID column
|
||||
* @param Record_ID record
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
* @param OldValue old
|
||||
* @param NewValue new
|
||||
* @return saved change log or null
|
||||
*/
|
||||
public MChangeLog changeLog (
|
||||
String TrxName, int AD_ChangeLog_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue, String event)
|
||||
{
|
||||
// Null handling
|
||||
if (OldValue == null && NewValue == null)
|
||||
return null;
|
||||
// Equal Value
|
||||
if (OldValue != null && NewValue != null && OldValue.equals(NewValue))
|
||||
return null;
|
||||
|
||||
// No Log
|
||||
if (AD_Column_ID == 6652
|
||||
|| AD_Column_ID == 6653) // AD_Process.Statistics_
|
||||
return null;
|
||||
|
||||
// Role Logging
|
||||
MRole role = MRole.getDefault(getCtx(), false);
|
||||
// Do we need to log
|
||||
if (m_webStoreSession // log if WebStore
|
||||
|| MChangeLog.isLogged(AD_Table_ID) // im/explicit log
|
||||
|| (role != null && role.isChangeLog()))// Role Logging
|
||||
;
|
||||
else
|
||||
return null;
|
||||
//
|
||||
log.finest("AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID
|
||||
+ ": " + OldValue + " -> " + NewValue);
|
||||
boolean success = false;
|
||||
|
||||
try
|
||||
{
|
||||
MChangeLog cl = new MChangeLog(getCtx(),
|
||||
AD_ChangeLog_ID, TrxName, getAD_Session_ID(),
|
||||
AD_Table_ID, AD_Column_ID, Record_ID, AD_Client_ID, AD_Org_ID,
|
||||
OldValue, NewValue, event);
|
||||
if (cl.save())
|
||||
return cl;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID, e);
|
||||
return null;
|
||||
}
|
||||
log.log(Level.SEVERE, "AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID);
|
||||
return null;
|
||||
} // changeLog
|
||||
|
||||
} // MSession
|
||||
|
||||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.TimeUtil;
|
||||
|
||||
/**
|
||||
* Session Model.
|
||||
* Maintained in AMenu.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MSession.java,v 1.3 2006/07/30 00:58:05 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1810182 ] Session lost after cache reset
|
||||
* <li>BF [ 1892156 ] MSession is not really cached
|
||||
*/
|
||||
public class MSession extends X_AD_Session
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 480745219310430126L;
|
||||
|
||||
|
||||
/**
|
||||
* Get existing or create local session
|
||||
* @param ctx context
|
||||
* @param createNew create if not found
|
||||
* @return session session
|
||||
*/
|
||||
public static MSession get (Properties ctx, boolean createNew)
|
||||
{
|
||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
||||
MSession session = null;
|
||||
if (AD_Session_ID > 0)
|
||||
session = (MSession)s_sessions.get(new Integer(AD_Session_ID));
|
||||
// Try to load
|
||||
if (session == null && AD_Session_ID > 0)
|
||||
{
|
||||
session = new MSession(ctx, AD_Session_ID, null);
|
||||
if (session.get_ID() != AD_Session_ID) {
|
||||
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
}
|
||||
s_sessions.put(AD_Session_ID, session);
|
||||
}
|
||||
// Create New
|
||||
if (session == null && createNew)
|
||||
{
|
||||
session = new MSession (ctx, null); // local session
|
||||
session.save();
|
||||
AD_Session_ID = session.getAD_Session_ID();
|
||||
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
s_sessions.put (new Integer(AD_Session_ID), session);
|
||||
}
|
||||
return session;
|
||||
} // get
|
||||
|
||||
/**
|
||||
* Get existing or create remote session
|
||||
* @param ctx context
|
||||
* @param Remote_Addr remote address
|
||||
* @param Remote_Host remote host
|
||||
* @param WebSession web session
|
||||
* @return session
|
||||
*/
|
||||
public static MSession get (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession)
|
||||
{
|
||||
int AD_Session_ID = Env.getContextAsInt(ctx, "#AD_Session_ID");
|
||||
MSession session = null;
|
||||
if (AD_Session_ID > 0)
|
||||
session = (MSession)s_sessions.get(new Integer(AD_Session_ID));
|
||||
if (session == null)
|
||||
{
|
||||
session = new MSession (ctx, Remote_Addr, Remote_Host, WebSession, null); // remote session
|
||||
session.save();
|
||||
AD_Session_ID = session.getAD_Session_ID();
|
||||
Env.setContext(ctx, "#AD_Session_ID", AD_Session_ID);
|
||||
s_sessions.put(new Integer(AD_Session_ID), session);
|
||||
}
|
||||
return session;
|
||||
} // get
|
||||
|
||||
/** Sessions */
|
||||
private static CCache<Integer, MSession> s_sessions = Ini.isClient()
|
||||
? new CCache<Integer, MSession>("AD_Session_ID", 1, 0) // one client session
|
||||
: new CCache<Integer, MSession>("AD_Session_ID", 30, 0); // no time-out
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
* @param AD_Session_ID id
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, int AD_Session_ID, String trxName)
|
||||
{
|
||||
super(ctx, AD_Session_ID, trxName);
|
||||
if (AD_Session_ID == 0)
|
||||
{
|
||||
setProcessed (false);
|
||||
}
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* Load Costructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* New (remote) Constructor
|
||||
* @param ctx context
|
||||
* @param Remote_Addr remote address
|
||||
* @param Remote_Host remote host
|
||||
* @param WebSession web session
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession, String trxName)
|
||||
{
|
||||
this (ctx, 0, trxName);
|
||||
if (Remote_Addr != null)
|
||||
setRemote_Addr(Remote_Addr);
|
||||
if (Remote_Host != null)
|
||||
setRemote_Host(Remote_Host);
|
||||
if (WebSession != null)
|
||||
setWebSession(WebSession);
|
||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||
+ Adempiere.DATE_VERSION + " "
|
||||
+ Adempiere.getImplementationVersion());
|
||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||
} // MSession
|
||||
|
||||
/**
|
||||
* New (local) Constructor
|
||||
* @param ctx context
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MSession (Properties ctx, String trxName)
|
||||
{
|
||||
this (ctx, 0, trxName);
|
||||
try
|
||||
{
|
||||
InetAddress lh = InetAddress.getLocalHost();
|
||||
setRemote_Addr(lh.getHostAddress());
|
||||
setRemote_Host(lh.getHostName());
|
||||
setDescription(Adempiere.MAIN_VERSION + "_"
|
||||
+ Adempiere.DATE_VERSION + " "
|
||||
+ Adempiere.getImplementationVersion());
|
||||
setAD_Role_ID(Env.getContextAsInt(ctx, "#AD_Role_ID"));
|
||||
setLoginDate(Env.getContextAsDate(ctx, "#Date"));
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "No Local Host", e);
|
||||
}
|
||||
} // MSession
|
||||
|
||||
/** Web Store Session */
|
||||
private boolean m_webStoreSession = false;
|
||||
|
||||
/**
|
||||
* Is it a Web Store Session
|
||||
* @return Returns true if Web Store Session.
|
||||
*/
|
||||
public boolean isWebStoreSession ()
|
||||
{
|
||||
return m_webStoreSession;
|
||||
} // isWebStoreSession
|
||||
|
||||
/**
|
||||
* Set Web Store Session
|
||||
* @param webStoreSession The webStoreSession to set.
|
||||
*/
|
||||
public void setWebStoreSession (boolean webStoreSession)
|
||||
{
|
||||
m_webStoreSession = webStoreSession;
|
||||
} // setWebStoreSession
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer("MSession[")
|
||||
.append(getAD_Session_ID())
|
||||
.append(",AD_User_ID=").append(getCreatedBy())
|
||||
.append(",").append(getCreated())
|
||||
.append(",Remote=").append(getRemote_Addr());
|
||||
String s = getRemote_Host();
|
||||
if (s != null && s.length() > 0)
|
||||
sb.append(",").append(s);
|
||||
if (m_webStoreSession)
|
||||
sb.append(",WebStoreSession");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
/**
|
||||
* Session Logout
|
||||
*/
|
||||
public void logout()
|
||||
{
|
||||
setProcessed(true);
|
||||
save();
|
||||
s_sessions.remove(new Integer(getAD_Session_ID()));
|
||||
log.info(TimeUtil.formatElapsed(getCreated(), getUpdated()));
|
||||
} // logout
|
||||
|
||||
/**
|
||||
* Preserved for backward compatibility
|
||||
*@deprecated
|
||||
*/
|
||||
public MChangeLog changeLog (
|
||||
String TrxName, int AD_ChangeLog_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue)
|
||||
{
|
||||
return changeLog(TrxName, AD_ChangeLog_ID, AD_Table_ID, AD_Column_ID,
|
||||
Record_ID, AD_Client_ID, AD_Org_ID, OldValue, NewValue,
|
||||
(String) null);
|
||||
} // changeLog
|
||||
|
||||
/**
|
||||
* Create Change Log only if table is logged
|
||||
* @param TrxName transaction name
|
||||
* @param AD_ChangeLog_ID 0 for new change log
|
||||
* @param AD_Table_ID table
|
||||
* @param AD_Column_ID column
|
||||
* @param Record_ID record
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
* @param OldValue old
|
||||
* @param NewValue new
|
||||
* @return saved change log or null
|
||||
*/
|
||||
public MChangeLog changeLog (
|
||||
String TrxName, int AD_ChangeLog_ID,
|
||||
int AD_Table_ID, int AD_Column_ID, int Record_ID,
|
||||
int AD_Client_ID, int AD_Org_ID,
|
||||
Object OldValue, Object NewValue, String event)
|
||||
{
|
||||
// Null handling
|
||||
if (OldValue == null && NewValue == null)
|
||||
return null;
|
||||
// Equal Value
|
||||
if (OldValue != null && NewValue != null && OldValue.equals(NewValue))
|
||||
return null;
|
||||
|
||||
// Role Logging
|
||||
MRole role = MRole.getDefault(getCtx(), false);
|
||||
// Do we need to log
|
||||
if (m_webStoreSession // log if WebStore
|
||||
|| MChangeLog.isLogged(AD_Table_ID) // im/explicit log
|
||||
|| (role != null && role.isChangeLog()))// Role Logging
|
||||
;
|
||||
else
|
||||
return null;
|
||||
//
|
||||
log.finest("AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID
|
||||
+ ": " + OldValue + " -> " + NewValue);
|
||||
try
|
||||
{
|
||||
MChangeLog cl = new MChangeLog(getCtx(),
|
||||
AD_ChangeLog_ID, TrxName, getAD_Session_ID(),
|
||||
AD_Table_ID, AD_Column_ID, Record_ID, AD_Client_ID, AD_Org_ID,
|
||||
OldValue, NewValue, event);
|
||||
if (cl.save())
|
||||
return cl;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID, e);
|
||||
return null;
|
||||
}
|
||||
log.log(Level.SEVERE, "AD_ChangeLog_ID=" + AD_ChangeLog_ID
|
||||
+ ", AD_Session_ID=" + getAD_Session_ID()
|
||||
+ ", AD_Table_ID=" + AD_Table_ID + ", AD_Column_ID=" + AD_Column_ID);
|
||||
return null;
|
||||
} // changeLog
|
||||
|
||||
} // MSession
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,181 +1,186 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.util.logging.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* PO Info Column Info Value Object
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: POInfoColumn.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
|
||||
*/
|
||||
public class POInfoColumn implements Serializable
|
||||
{
|
||||
/** Used by Remote FinReport */
|
||||
static final long serialVersionUID = -3983585608504631958L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param ad_Column_ID Column ID
|
||||
* @param columnName Dolumn name
|
||||
* @param columnSQL virtual column
|
||||
* @param displayType Display Type
|
||||
* @param isMandatory Mandatory
|
||||
* @param isUpdateable Updateable
|
||||
* @param defaultLogic Default Logic
|
||||
* @param columnLabel Column Label
|
||||
* @param columnDescription Column Description
|
||||
* @param isKey true if key
|
||||
* @param isParent true if parent
|
||||
* @param ad_Reference_Value_ID reference value
|
||||
* @param validationCode sql validation code
|
||||
* @param fieldLength Field Length
|
||||
* @param valueMin minimal value
|
||||
* @param valueMax maximal value
|
||||
* @param isTranslated translated
|
||||
* @param isEncrypted encrypted
|
||||
*/
|
||||
public POInfoColumn (int ad_Column_ID, String columnName, String columnSQL, int displayType,
|
||||
boolean isMandatory, boolean isUpdateable, String defaultLogic,
|
||||
String columnLabel, String columnDescription,
|
||||
boolean isKey, boolean isParent,
|
||||
int ad_Reference_Value_ID, String validationCode,
|
||||
int fieldLength, String valueMin, String valueMax,
|
||||
boolean isTranslated, boolean isEncrypted)
|
||||
{
|
||||
AD_Column_ID = ad_Column_ID;
|
||||
ColumnName = columnName;
|
||||
ColumnSQL = columnSQL;
|
||||
DisplayType = displayType;
|
||||
if (columnName.equals("AD_Language") || columnName.equals("EntityType"))
|
||||
{
|
||||
DisplayType = org.compiere.util.DisplayType.String;
|
||||
ColumnClass = String.class;
|
||||
}
|
||||
else if (columnName.equals("Posted")
|
||||
|| columnName.equals("Processed")
|
||||
|| columnName.equals("Processing"))
|
||||
{
|
||||
ColumnClass = Boolean.class;
|
||||
}
|
||||
else if (columnName.equals("Record_ID"))
|
||||
{
|
||||
DisplayType = org.compiere.util.DisplayType.ID;
|
||||
ColumnClass = Integer.class;
|
||||
}
|
||||
else
|
||||
ColumnClass = org.compiere.util.DisplayType.getClass(displayType, true);
|
||||
IsMandatory = isMandatory;
|
||||
IsUpdateable = isUpdateable;
|
||||
DefaultLogic = defaultLogic;
|
||||
ColumnLabel = columnLabel;
|
||||
ColumnDescription = columnDescription;
|
||||
IsKey = isKey;
|
||||
IsParent = isParent;
|
||||
//
|
||||
AD_Reference_Value_ID = ad_Reference_Value_ID;
|
||||
ValidationCode = validationCode;
|
||||
//
|
||||
FieldLength = fieldLength;
|
||||
ValueMin = valueMin;
|
||||
try
|
||||
{
|
||||
if (valueMin != null && valueMin.length() > 0)
|
||||
ValueMin_BD = new BigDecimal(valueMin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CLogger.get().log(Level.SEVERE, "ValueMin=" + valueMin, ex);
|
||||
}
|
||||
ValueMax = valueMax;
|
||||
try
|
||||
{
|
||||
if (valueMax != null && valueMax.length() > 0)
|
||||
ValueMax_BD = new BigDecimal(valueMax);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CLogger.get().log(Level.SEVERE, "ValueMax=" + valueMax, ex);
|
||||
}
|
||||
IsTranslated = isTranslated;
|
||||
IsEncrypted = isEncrypted;
|
||||
} // Column
|
||||
|
||||
/** Column ID */
|
||||
public int AD_Column_ID;
|
||||
/** Column Name */
|
||||
public String ColumnName;
|
||||
/** Virtual Column */
|
||||
public String ColumnSQL;
|
||||
/** Display Type */
|
||||
public int DisplayType;
|
||||
/** Data Type */
|
||||
public Class ColumnClass;
|
||||
/** Mandatory */
|
||||
public boolean IsMandatory;
|
||||
/** Default Value */
|
||||
public String DefaultLogic;
|
||||
/** Updateable */
|
||||
public boolean IsUpdateable;
|
||||
/** Label */
|
||||
public String ColumnLabel;
|
||||
/** Description */
|
||||
public String ColumnDescription;
|
||||
/** PK */
|
||||
public boolean IsKey;
|
||||
/** FK to Parent */
|
||||
public boolean IsParent;
|
||||
/** Translated */
|
||||
public boolean IsTranslated;
|
||||
/** Encryoted */
|
||||
public boolean IsEncrypted;
|
||||
|
||||
/** Reference Value */
|
||||
public int AD_Reference_Value_ID;
|
||||
/** Validation */
|
||||
public String ValidationCode;
|
||||
|
||||
/** Field Length */
|
||||
public int FieldLength;
|
||||
/** Min Value */
|
||||
public String ValueMin;
|
||||
/** Max Value */
|
||||
public String ValueMax;
|
||||
/** Min Value */
|
||||
public BigDecimal ValueMin_BD = null;
|
||||
/** Max Value */
|
||||
public BigDecimal ValueMax_BD = null;
|
||||
|
||||
/**
|
||||
* String representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer("POInfo.Column[");
|
||||
sb.append(ColumnName).append(",ID=").append(AD_Column_ID)
|
||||
.append(",DisplayType=").append(DisplayType)
|
||||
.append(",ColumnClass=").append(ColumnClass);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
} // POInfoColumn
|
||||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
|
||||
/**
|
||||
* PO Info Column Info Value Object
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: POInfoColumn.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
|
||||
*/
|
||||
public class POInfoColumn implements Serializable
|
||||
{
|
||||
/** Used by Remote FinReport */
|
||||
static final long serialVersionUID = -3983585608504631958L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param ad_Column_ID Column ID
|
||||
* @param columnName Column name
|
||||
* @param columnSQL virtual column
|
||||
* @param displayType Display Type
|
||||
* @param isMandatory Mandatory
|
||||
* @param isUpdateable Updateable
|
||||
* @param defaultLogic Default Logic
|
||||
* @param columnLabel Column Label
|
||||
* @param columnDescription Column Description
|
||||
* @param isKey true if key
|
||||
* @param isParent true if parent
|
||||
* @param ad_Reference_Value_ID reference value
|
||||
* @param validationCode sql validation code
|
||||
* @param fieldLength Field Length
|
||||
* @param valueMin minimal value
|
||||
* @param valueMax maximal value
|
||||
* @param isTranslated translated
|
||||
* @param isEncrypted encrypted
|
||||
* @param isAllowLogging allow logging
|
||||
*/
|
||||
public POInfoColumn (int ad_Column_ID, String columnName, String columnSQL, int displayType,
|
||||
boolean isMandatory, boolean isUpdateable, String defaultLogic,
|
||||
String columnLabel, String columnDescription,
|
||||
boolean isKey, boolean isParent,
|
||||
int ad_Reference_Value_ID, String validationCode,
|
||||
int fieldLength, String valueMin, String valueMax,
|
||||
boolean isTranslated, boolean isEncrypted, boolean isAllowLogging)
|
||||
{
|
||||
AD_Column_ID = ad_Column_ID;
|
||||
ColumnName = columnName;
|
||||
ColumnSQL = columnSQL;
|
||||
DisplayType = displayType;
|
||||
if (columnName.equals("AD_Language") || columnName.equals("EntityType"))
|
||||
{
|
||||
DisplayType = org.compiere.util.DisplayType.String;
|
||||
ColumnClass = String.class;
|
||||
}
|
||||
else if (columnName.equals("Posted")
|
||||
|| columnName.equals("Processed")
|
||||
|| columnName.equals("Processing"))
|
||||
{
|
||||
ColumnClass = Boolean.class;
|
||||
}
|
||||
else if (columnName.equals("Record_ID"))
|
||||
{
|
||||
DisplayType = org.compiere.util.DisplayType.ID;
|
||||
ColumnClass = Integer.class;
|
||||
}
|
||||
else
|
||||
ColumnClass = org.compiere.util.DisplayType.getClass(displayType, true);
|
||||
IsMandatory = isMandatory;
|
||||
IsUpdateable = isUpdateable;
|
||||
DefaultLogic = defaultLogic;
|
||||
ColumnLabel = columnLabel;
|
||||
ColumnDescription = columnDescription;
|
||||
IsKey = isKey;
|
||||
IsParent = isParent;
|
||||
//
|
||||
AD_Reference_Value_ID = ad_Reference_Value_ID;
|
||||
ValidationCode = validationCode;
|
||||
//
|
||||
FieldLength = fieldLength;
|
||||
ValueMin = valueMin;
|
||||
try
|
||||
{
|
||||
if (valueMin != null && valueMin.length() > 0)
|
||||
ValueMin_BD = new BigDecimal(valueMin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CLogger.get().log(Level.SEVERE, "ValueMin=" + valueMin, ex);
|
||||
}
|
||||
ValueMax = valueMax;
|
||||
try
|
||||
{
|
||||
if (valueMax != null && valueMax.length() > 0)
|
||||
ValueMax_BD = new BigDecimal(valueMax);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CLogger.get().log(Level.SEVERE, "ValueMax=" + valueMax, ex);
|
||||
}
|
||||
IsTranslated = isTranslated;
|
||||
IsEncrypted = isEncrypted;
|
||||
IsAllowLogging = isAllowLogging;
|
||||
} // Column
|
||||
|
||||
/** Column ID */
|
||||
public int AD_Column_ID;
|
||||
/** Column Name */
|
||||
public String ColumnName;
|
||||
/** Virtual Column */
|
||||
public String ColumnSQL;
|
||||
/** Display Type */
|
||||
public int DisplayType;
|
||||
/** Data Type */
|
||||
public Class<?> ColumnClass;
|
||||
/** Mandatory */
|
||||
public boolean IsMandatory;
|
||||
/** Default Value */
|
||||
public String DefaultLogic;
|
||||
/** Updateable */
|
||||
public boolean IsUpdateable;
|
||||
/** Label */
|
||||
public String ColumnLabel;
|
||||
/** Description */
|
||||
public String ColumnDescription;
|
||||
/** PK */
|
||||
public boolean IsKey;
|
||||
/** FK to Parent */
|
||||
public boolean IsParent;
|
||||
/** Translated */
|
||||
public boolean IsTranslated;
|
||||
/** Encrypted */
|
||||
public boolean IsEncrypted;
|
||||
/** Allow Logging */
|
||||
public boolean IsAllowLogging;
|
||||
|
||||
/** Reference Value */
|
||||
public int AD_Reference_Value_ID;
|
||||
/** Validation */
|
||||
public String ValidationCode;
|
||||
|
||||
/** Field Length */
|
||||
public int FieldLength;
|
||||
/** Min Value */
|
||||
public String ValueMin;
|
||||
/** Max Value */
|
||||
public String ValueMax;
|
||||
/** Min Value */
|
||||
public BigDecimal ValueMin_BD = null;
|
||||
/** Max Value */
|
||||
public BigDecimal ValueMax_BD = null;
|
||||
|
||||
/**
|
||||
* String representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer("POInfo.Column[");
|
||||
sb.append(ColumnName).append(",ID=").append(AD_Column_ID)
|
||||
.append(",DisplayType=").append(DisplayType)
|
||||
.append(",ColumnClass=").append(ColumnClass);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
} // POInfoColumn
|
||||
|
|
|
@ -958,4 +958,20 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
|
|||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get IsAllowLogging .
|
||||
* Determines, if a column must be recorded into the change log
|
||||
*/
|
||||
public boolean IsAllowLogging() {
|
||||
Object oo = get_Value(COLUMNNAME_isAllowLogging);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
-- Jul 23, 2008 4:50:40 PM COT
|
||||
-- [ 1810133 ] Add logging policy on column level
|
||||
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53669,0,'IsAllowLogging',TO_DATE('2008-07-23 16:50:36','YYYY-MM-DD HH24:MI:SS'),100,'Determine if a column must be recorded into the change log','U','Y','IsAllowLogging','IsAllowLogging',TO_DATE('2008-07-23 16:50:36','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53669 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
|
||||
;
|
||||
|
||||
UPDATE AD_Element_Trl SET IsTranslated='Y',Name='RegistrarEnLog',PrintName='Registrar en Log de Cambios',Description='Determina si una columna debe ser registrada en el log de cambios',Updated=TO_DATE('2008-07-23 16:53:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53669 AND AD_Language='es_MX'
|
||||
;
|
||||
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56187,53669,0,20,101,'IsAllowLogging',TO_DATE('2008-07-23 16:55:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','Determine if a column must be recorded into the change log','D',1,'Y','N','N','N','N','N','N','N','N','N','Y','IsAllowLogging',0,TO_DATE('2008-07-23 16:55:42','YYYY-MM-DD HH24:MI:SS'),100,0)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56187 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
ALTER TABLE AD_Column ADD IsAllowLogging CHAR(1) DEFAULT 'Y' CHECK (IsAllowLogging IN ('Y','N'))
|
||||
;
|
||||
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56187,56317,0,101,TO_DATE('2008-07-23 16:57:53','YYYY-MM-DD HH24:MI:SS'),100,'Determine if a column must be recorded into the change log',0,'D','Y','Y','Y','N','N','N','N','N','IsAllowLogging',370,0,TO_DATE('2008-07-23 16:57:53','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56317 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
|
||||
UPDATE AD_Column SET IsAllowLogging = 'N' WHERE AD_Column_ID IN (6652, 6653)
|
||||
;
|
|
@ -0,0 +1,29 @@
|
|||
-- Jul 23, 2008 4:50:40 PM COT
|
||||
-- [ 1810133 ] Add logging policy on column level
|
||||
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53669,0,'IsAllowLogging',TO_TIMESTAMP('2008-07-23 16:50:36','YYYY-MM-DD HH24:MI:SS'),100,'Determine if a column must be recorded into the change log','U','Y','IsAllowLogging','IsAllowLogging',TO_TIMESTAMP('2008-07-23 16:50:36','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53669 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
|
||||
;
|
||||
|
||||
UPDATE AD_Element_Trl SET IsTranslated='Y',Name='RegistrarEnLog',PrintName='Registrar en Log de Cambios',Description='Determina si una columna debe ser registrada en el log de cambios',Updated=TO_TIMESTAMP('2008-07-23 16:53:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53669 AND AD_Language='es_MX'
|
||||
;
|
||||
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56187,53669,0,20,101,'IsAllowLogging',TO_TIMESTAMP('2008-07-23 16:55:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','Determine if a column must be recorded into the change log','D',1,'Y','N','N','N','N','N','N','N','N','N','Y','IsAllowLogging',0,TO_TIMESTAMP('2008-07-23 16:55:42','YYYY-MM-DD HH24:MI:SS'),100,0)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56187 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
ALTER TABLE AD_Column ADD COLUMN IsAllowLogging CHAR(1) DEFAULT 'Y' CHECK (IsAllowLogging IN ('Y','N'))
|
||||
;
|
||||
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56187,56317,0,101,TO_TIMESTAMP('2008-07-23 16:57:53','YYYY-MM-DD HH24:MI:SS'),100,'Determine if a column must be recorded into the change log',0,'D','Y','Y','Y','N','N','N','N','N','IsAllowLogging',370,0,TO_TIMESTAMP('2008-07-23 16:57:53','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56317 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
|
||||
UPDATE AD_Column SET IsAllowLogging = 'N' WHERE AD_Column_ID IN (6652, 6653)
|
||||
;
|
Loading…
Reference in New Issue