IDEMPIERE-2073 AD_Val_Rule_ID is missing from AD_UserDef_Field

This commit is contained in:
Carlos Ruiz 2014-07-23 11:10:24 -05:00
parent ad302c7ded
commit 10ce8aa22e
6 changed files with 123 additions and 2 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 23, 2014 11:07:39 AM COT
-- IDEMPIERE-2073 AD_Val_Rule_ID is missing from AD_UserDef_Field
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_DATE('2014-07-23 11:07:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
SELECT register_migration_script('201407231109_IDEMPIERE-2073.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Jul 23, 2014 11:07:39 AM COT
-- IDEMPIERE-2073 AD_Val_Rule_ID is missing from AD_UserDef_Field
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2014-07-23 11:07:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
SELECT register_migration_script('201407231109_IDEMPIERE-2073.sql') FROM dual
;

View File

@ -28,7 +28,6 @@ import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
@ -300,7 +299,7 @@ public class GridFieldVO implements Serializable
if (userDef.getSeqNo() > 0)
vo.SeqNo = userDef.getSeqNo();
if (userDef.getAD_Val_Rule_ID() > 0)
vo.ValidationCode = DB.getSQLValueStringEx(null, "SELECT Code FROM AD_Val_Rule WHERE AD_Val_Rule_ID = ?", userDef.getAD_Val_Rule_ID());
vo.ValidationCode = MValRule.get(ctx, userDef.getAD_Val_Rule_ID()).getCode();
}
}
//

View File

@ -0,0 +1,103 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
/**
* Persistent Validation Rule Model
* @author Carlos Ruiz
* @version $Id: MValRule.java
*/
public class MValRule extends X_AD_Val_Rule
{
/**
*
*/
private static final long serialVersionUID = -8482599477870030638L;
/**
* Get Rule from Cache
* @param ctx context
* @param AD_Val_Rule_ID id
* @return MValRule
*/
public static MValRule get (Properties ctx, int AD_Val_Rule_ID)
{
Integer key = new Integer (AD_Val_Rule_ID);
MValRule retValue = (MValRule) s_cache.get (key);
if (retValue != null)
return retValue;
retValue = new MValRule (ctx, AD_Val_Rule_ID, null);
if (retValue.get_ID () != 0)
s_cache.put (key, retValue);
return retValue;
} // get
/** Cache */
private static CCache<Integer,MValRule> s_cache = new CCache<Integer,MValRule>(Table_Name, 20);
/** Static Logger */
@SuppressWarnings("unused")
private static CLogger s_log = CLogger.getCLogger (MValRule.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param AD_Val_Rule_ID id
* @param trxName transaction
*/
public MValRule (Properties ctx, int AD_Val_Rule_ID, String trxName)
{
super (ctx, AD_Val_Rule_ID, trxName);
} // MValRule
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MValRule (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MValRule
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuilder sb = new StringBuilder ("MValRule[");
sb.append (get_ID()).append ("-").append (getName()).append ("]");
return sb.toString ();
} // toString
} // MValRule