hg merge development (merge development into zk7)

This commit is contained in:
Carlos Ruiz 2014-07-23 13:04:51 -05:00
commit 23258a7b89
18 changed files with 511 additions and 21 deletions

View File

@ -0,0 +1,122 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 17, 2014 8:23:45 PM CEST
-- IDEMPIERE-2073
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FKConstraintType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211571,'5bd0edd0-0f13-463e-bf7d-4f8f8d5a8aa3',139,0,19,464,'AD_Val_Rule_ID',TO_DATE('2014-07-17 20:23:44','YYYY-MM-DD HH24:MI:SS'),100,'Dynamic Validation Rule','D','N',22,'These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Dynamic Validation',0,0,TO_DATE('2014-07-17 20:23:44','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Jul 17, 2014 8:23:48 PM CEST
UPDATE AD_Column SET FKConstraintName='ADValRule_ADUserDefField', FKConstraintType='N',Updated=TO_DATE('2014-07-17 20:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211571
;
-- Jul 17, 2014 8:23:48 PM CEST
ALTER TABLE AD_UserDef_Field ADD AD_Val_Rule_ID NUMBER(10) DEFAULT NULL
;
-- Jul 17, 2014 8:23:48 PM CEST
ALTER TABLE AD_UserDef_Field ADD CONSTRAINT ADValRule_ADUserDefField FOREIGN KEY (AD_Val_Rule_ID) REFERENCES AD_VAL_RULE(AD_VAL_RULE_ID) DEFERRABLE INITIALLY DEFERRED
;
-- Jul 17, 2014 8:24:03 PM CEST
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,211571,203266,'e0427cf3-b251-47c0-aa58-afc672aac597',0,395,2,TO_DATE('2014-07-17 20:24:03','YYYY-MM-DD HH24:MI:SS'),100,'Dynamic Validation Rule',22,'D','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.','Y','Y','Y','N','N','N','N','N','Dynamic Validation',280,TO_DATE('2014-07-17 20:24:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=200857
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=200850
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=5055
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=11252
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=200853
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=200858
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=200856
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=200855
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=200849
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=200851
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=200852
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=200854
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5054
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=200849
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=200851
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=200852
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200854
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=5051
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=5057
;
-- Jul 17, 2014 8:25:24 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, XPosition=4,Updated=TO_DATE('2014-07-17 20:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:26:05 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012',Updated=TO_DATE('2014-07-17 20:26:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:26:41 PM CEST
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2014-07-17 20:26:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
SELECT register_migration_script('201407172028_IDEMPIERE-2073.sql') FROM dual
;

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,119 @@
-- Jul 17, 2014 8:23:45 PM CEST
-- IDEMPIERE-2073
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FKConstraintType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,211571,'5bd0edd0-0f13-463e-bf7d-4f8f8d5a8aa3',139,0,19,464,'AD_Val_Rule_ID',TO_TIMESTAMP('2014-07-17 20:23:44','YYYY-MM-DD HH24:MI:SS'),100,'Dynamic Validation Rule','D','N',22,'These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','Dynamic Validation',0,0,TO_TIMESTAMP('2014-07-17 20:23:44','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Jul 17, 2014 8:23:48 PM CEST
UPDATE AD_Column SET FKConstraintName='ADValRule_ADUserDefField', FKConstraintType='N',Updated=TO_TIMESTAMP('2014-07-17 20:23:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211571
;
-- Jul 17, 2014 8:23:48 PM CEST
ALTER TABLE AD_UserDef_Field ADD COLUMN AD_Val_Rule_ID NUMERIC(10) DEFAULT NULL
;
-- Jul 17, 2014 8:23:48 PM CEST
ALTER TABLE AD_UserDef_Field ADD CONSTRAINT ADValRule_ADUserDefField FOREIGN KEY (AD_Val_Rule_ID) REFERENCES AD_VAL_RULE(AD_VAL_RULE_ID) DEFERRABLE INITIALLY DEFERRED
;
-- Jul 17, 2014 8:24:03 PM CEST
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,211571,203266,'e0427cf3-b251-47c0-aa58-afc672aac597',0,395,2,TO_TIMESTAMP('2014-07-17 20:24:03','YYYY-MM-DD HH24:MI:SS'),100,'Dynamic Validation Rule',22,'D','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.','Y','Y','Y','N','N','N','N','N','Dynamic Validation',280,TO_TIMESTAMP('2014-07-17 20:24:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=200857
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=200850
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=5055
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=11252
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=200853
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=200858
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=200856
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=200855
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=200849
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=200851
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=200852
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=200854
;
-- Jul 17, 2014 8:24:22 PM CEST
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5054
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=200849
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=200851
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=200852
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=200854
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=5051
;
-- Jul 17, 2014 8:24:59 PM CEST
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=5057
;
-- Jul 17, 2014 8:25:24 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, XPosition=4,Updated=TO_TIMESTAMP('2014-07-17 20:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:26:05 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012',Updated=TO_TIMESTAMP('2014-07-17 20:26:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Jul 17, 2014 8:26:41 PM CEST
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2014-07-17 20:26:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
SELECT register_migration_script('201407172028_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

@ -17,6 +17,8 @@
*****************************************************************************/
package org.compiere.model;
import static org.compiere.model.SystemIDs.REFERENCE_AD_USER;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@ -28,7 +30,6 @@ import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import static org.compiere.model.SystemIDs.*;
/**
@ -297,7 +298,8 @@ public class GridFieldVO implements Serializable
//IDEMPIERE-1120 Implement Field SeqNo customization
if (userDef.getSeqNo() > 0)
vo.SeqNo = userDef.getSeqNo();
if (userDef.getAD_Val_Rule_ID() > 0)
vo.ValidationCode = MValRule.get(ctx, userDef.getAD_Val_Rule_ID()).getCode();
}
}
//

View File

@ -136,6 +136,21 @@ public interface I_AD_UserDef_Field
public org.compiere.model.I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException;
/** Column name AD_Val_Rule_ID */
public static final String COLUMNNAME_AD_Val_Rule_ID = "AD_Val_Rule_ID";
/** Set Dynamic Validation.
* Dynamic Validation Rule
*/
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID);
/** Get Dynamic Validation.
* Dynamic Validation Rule
*/
public int getAD_Val_Rule_ID();
public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() throws RuntimeException;
/** Column name ColumnSpan */
public static final String COLUMNNAME_ColumnSpan = "ColumnSpan";

View File

@ -264,7 +264,7 @@ public class MInOutLineMA extends X_M_InOutLineMA
protected boolean beforeSave (boolean newRecord)
{
//Set DateMaterialPolicy
if(is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
if(!newRecord && is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
//TODO Require testing for all scenario
I_M_InOutLine line = getM_InOutLine();

View File

@ -238,7 +238,7 @@ public class MInventoryLineMA extends X_M_InventoryLineMA
protected boolean beforeSave (boolean newRecord)
{
//Set DateMaterialPolicy
if(is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
if(!newRecord && is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
I_M_InventoryLine line = getM_InventoryLine();
Timestamp dateMPolicy = null;

View File

@ -243,7 +243,7 @@ public class MMovementLineMA extends X_M_MovementLineMA
protected boolean beforeSave (boolean newRecord)
{
//Set DateMaterialPolicy
if(is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
if(!newRecord && is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)){
I_M_MovementLine line = getM_MovementLine();
Timestamp dateMPolicy = null;

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

View File

@ -30,7 +30,7 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
/**
*
*/
private static final long serialVersionUID = 20131031L;
private static final long serialVersionUID = 20140717L;
/** Standard Constructor */
public X_AD_UserDef_Field (Properties ctx, int AD_UserDef_Field_ID, String trxName)
@ -225,6 +225,34 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return ii.intValue();
}
public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() throws RuntimeException
{
return (org.compiere.model.I_AD_Val_Rule)MTable.get(getCtx(), org.compiere.model.I_AD_Val_Rule.Table_Name)
.getPO(getAD_Val_Rule_ID(), get_TrxName()); }
/** Set Dynamic Validation.
@param AD_Val_Rule_ID
Dynamic Validation Rule
*/
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID)
{
if (AD_Val_Rule_ID < 1)
set_Value (COLUMNNAME_AD_Val_Rule_ID, null);
else
set_Value (COLUMNNAME_AD_Val_Rule_ID, Integer.valueOf(AD_Val_Rule_ID));
}
/** Get Dynamic Validation.
@return Dynamic Validation Rule
*/
public int getAD_Val_Rule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Val_Rule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Column Span.
@param ColumnSpan
Number of column for a box of field

View File

@ -20,6 +20,9 @@ import java.sql.Timestamp;
import java.util.BitSet;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import org.compiere.model.MCountry;
/**
@ -829,4 +832,51 @@ public class TimeUtil
return retValue;
}
/** Returns number of non business days between 2 dates */
public static int getBusinessDaysBetween(Timestamp startDate, Timestamp endDate, int clientID, String trxName)
{
int retValue = 0;
if (startDate.equals(endDate))
return 0;
boolean negative = false;
if (endDate.before(startDate)) {
negative = true;
Timestamp temp = startDate;
startDate = endDate;
endDate = temp;
}
final String sql = "SELECT Date1 FROM C_NonBusinessDay WHERE IsActive='Y' AND AD_Client_ID=? AND Date1 BETWEEN ? AND ? AND COALESCE(C_Country_ID,0) IN (0, ?)";
List<Object> nbd = DB.getSQLValueObjectsEx(trxName, sql, clientID, startDate, endDate, MCountry.getDefault(Env.getCtx()).getC_Country_ID());
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(startDate);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
GregorianCalendar calEnd = new GregorianCalendar();
calEnd.setTime(endDate);
calEnd.set(Calendar.HOUR_OF_DAY, 0);
calEnd.set(Calendar.MINUTE, 0);
calEnd.set(Calendar.SECOND, 0);
calEnd.set(Calendar.MILLISECOND, 0);
while (cal.before(calEnd) || cal.equals(calEnd)) {
if (!nbd.contains(new Timestamp(cal.getTimeInMillis()))) {
if (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
retValue++;
}
}
cal.add(Calendar.DAY_OF_MONTH, 1);
}
if (negative)
retValue = retValue * -1;
return retValue;
}
} // TimeUtil

View File

@ -53,13 +53,13 @@ import org.xml.sax.helpers.AttributesImpl;
*/
public class GenericPOElementHandler extends AbstractElementHandler {
private String tableName;
private String m_tableName;
public GenericPOElementHandler() {
}
public GenericPOElementHandler(String tableName) {
this.tableName = tableName;
this.m_tableName = tableName;
}
public void startElement(PIPOContext ctx, Element element) throws SAXException {
@ -223,6 +223,12 @@ public class GenericPOElementHandler extends AbstractElementHandler {
document.startElement("", "", tables[index], atts);
PoExporter filler = new PoExporter(ctx, document, po);
filler.export(excludes, true);
ctx.packOut.getCtx().ctx.put("Table_Name",tables[index]);
try {
new CommonTranslationHandler().packOut(ctx.packOut,document,null,po.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
}
}
for (int i=index+1; i<tables.length; i++) {
@ -252,8 +258,8 @@ public class GenericPOElementHandler extends AbstractElementHandler {
}
else
{
tableId = MTable.get(packout.getCtx().ctx, tableName).getAD_Table_ID();
sql = "SELECT * FROM " + tableName + " WHERE " + tableName + "_ID=" + recordId;
tableId = MTable.get(packout.getCtx().ctx, m_tableName).getAD_Table_ID();
sql = "SELECT * FROM " + m_tableName + " WHERE " + m_tableName + "_ID=" + recordId;
}
packout.getCtx().ctx.put(DataElementParameters.AD_TABLE_ID, Integer.toString(tableId));
packout.getCtx().ctx.put(DataElementParameters.SQL_STATEMENT, sql);

View File

@ -69,6 +69,8 @@ public class GridTab2PackExporter implements IGridTabExporter {
sql.append("))");
}
for(GridTab child : childs) {
if (child.getTableName().toLowerCase().endsWith("_trl")) // ignore trl tabs as they are exported as translation
continue;
if (child.getTabLevel() > gridTab.getTabLevel()+1) {
sql = sql.append(">").append(child.getTableName());
} else {
@ -157,10 +159,12 @@ public class GridTab2PackExporter implements IGridTabExporter {
/**
* {@inheritDoc}
* With 2Pack, everry tab is support to export
* With 2Pack, just trl tabs are not intended to be exported (they are exported as translation
*/
@Override
public boolean isExportableTab(GridTab gridTab) {
if (gridTab.getTableName().toLowerCase().endsWith("_trl"))
return false;
return true;
}
}

View File

@ -353,7 +353,7 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
return "images/mWindow.png";
if (mt.isReport())
return "images/mReport.png";
if (mt.isProcess())
if (mt.isProcess() || mt.isTask())
return "images/mProcess.png";
if (mt.isWorkFlow())
return "images/mWorkFlow.png";

View File

@ -235,8 +235,16 @@ public class WStringEditor extends WEditor implements ContextMenuListener
else if (WEditorPopupMenu.EDITOR_EVENT.equals(evt.getContextEvent()))
{
adwindowContent = findADWindowContent();
boolean isHtml = false;
if (( gridField.getDisplayType() == DisplayType.Text
|| gridField.getDisplayType() == DisplayType.TextLong
|| gridField.getDisplayType() == DisplayType.Memo)
&& adwindowContent != null
&& adwindowContent.getActiveGridTab() != null) {
isHtml = adwindowContent.getActiveGridTab().getValueAsBoolean("IsHtml");
}
final WTextEditorDialog dialog = new WTextEditorDialog(gridField.getVO().Header, getDisplay(),
isReadWrite(), gridField.getFieldLength());
isReadWrite(), gridField.getFieldLength(), isHtml);
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {

View File

@ -37,9 +37,9 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.South;
import org.zkoss.zul.Div;
import org.zkoss.zul.Html;
import org.zkoss.zul.South;
/**
* Application Task
@ -96,7 +96,14 @@ public class WTask extends Window implements EventListener<Event>, IHelpContext
SessionManager.getAppDesktop().showWindow(this);
Events.echoEvent("executeTask", this, null);
addEventListener("onExecuteTask", new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
executeTask();
}
});
Events.echoEvent("onExecuteTask", this, null);
}
catch(Exception e)
{
@ -204,7 +211,7 @@ public class WTask extends Window implements EventListener<Event>, IHelpContext
taskThread.interrupt();
else if (e.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT))
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Task, m_task.getAD_Task_ID());
else if (e.getName().equals(Events.ON_CLICK))
SessionManager.getAppDesktop().closeActiveWindow();
} // actionPerformed

View File

@ -38,11 +38,11 @@ import org.zkoss.zul.Vlayout;
*
*/
public class WTextEditorDialog extends Window implements EventListener<Event>{
/**
*
*/
private static final long serialVersionUID = -3852236029054284848L;
private static final long serialVersionUID = 1188165765430615546L;
private boolean editable;
private int maxSize;
private String text;
@ -59,8 +59,9 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
* @param text
* @param editable
* @param maxSize
* @param isHtml - select the html tab at start
*/
public WTextEditorDialog(String title, String text, boolean editable, int maxSize) {
public WTextEditorDialog(String title, String text, boolean editable, int maxSize, boolean IsHtml) {
super();
setTitle(title);
this.editable = editable;
@ -68,6 +69,12 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
this.text = text;
init();
if (IsHtml)
tabbox.setSelectedTab(htmlTab);
}
public WTextEditorDialog(String title, String text, boolean editable, int maxSize) {
this(title, text, editable, maxSize, false);
}
private void init() {