IDEMPIERE-2319: Adding date value type support in Attribute set and adding transaction support on Attribute dialog
This commit is contained in:
parent
6a238cada7
commit
9a0b9fb317
|
@ -0,0 +1,42 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Nov 18, 2014 5:10:06 PM IST
|
||||
-- IDEMPIERE-2319: Adding date value type support in Attribute set
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ValueDate',202805,'Value Date','Value Date','ba9c466b-4436-47ec-b193-5d3b5e9ce30a',0,100,100,'Y',0,'D',TO_DATE('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 5:10:42 PM IST
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211801,'N','N','N',0,'N',7,'N','N','N','Y','986f6b4a-a721-4fa3-a865-89416a9adb6e','Y','ValueDate','Value Date','Y',100,0,'Y',TO_DATE('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202805,15,561,TO_DATE('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 5:10:50 PM IST
|
||||
ALTER TABLE M_AttributeInstance ADD ValueDate DATE DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:37:28 PM IST
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,MandatoryLogic,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211800,'N','N','N',0,'N',20,'N','N','N','Y','@AttributeValueType@=''D''','e5d9f3a8-5bc5-44ea-8bd0-4c00f54785c0','Y','DateFormat','Date format used in the input format','The date format is usually detected, but sometimes need to be defined.','Date Format','Y',100,0,'Y',TO_DATE('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2286,10,562,TO_DATE('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:37:33 PM IST
|
||||
ALTER TABLE M_Attribute ADD DateFormat VARCHAR2(20) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:39:07 PM IST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Name,AD_Ref_List_UU,Value,CreatedBy,UpdatedBy,Created,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Updated) VALUES (200279,326,'Date','34c7fbc0-6718-433e-a55c-6d203496e06a','D',100,100,TO_DATE('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_DATE('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:41:05 PM IST
|
||||
UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2014-11-18 15:41:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211800
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:41:33 PM IST
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,Created,Updated) VALUES ('N',462,20,'N','N',100,'Y',203472,'N','The date format is usually detected, but sometimes need to be defined.','Date format used in the input format','Date Format','361e4d18-9ad0-4b74-b730-bc6620502b40','Y','N',100,0,100,'Y','Y',100,0,2,211800,'D',TO_DATE('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:43:32 PM IST
|
||||
UPDATE AD_Field SET DisplayLogic='@AttributeValueType@=''D''', MandatoryLogic='@AttributeValueType@=''D''',Updated=TO_DATE('2014-11-18 15:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201411140854_IDEMPIERE-2315.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,39 @@
|
|||
-- Nov 18, 2014 5:10:06 PM IST
|
||||
-- IDEMPIERE-2319: Adding date value type support in Attribute set
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ValueDate',202805,'Value Date','Value Date','ba9c466b-4436-47ec-b193-5d3b5e9ce30a',0,100,100,'Y',0,'D',TO_TIMESTAMP('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 5:10:42 PM IST
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211801,'N','N','N',0,'N',7,'N','N','N','Y','986f6b4a-a721-4fa3-a865-89416a9adb6e','Y','ValueDate','Value Date','Y',100,0,'Y',TO_TIMESTAMP('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202805,15,561,TO_TIMESTAMP('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 5:10:50 PM IST
|
||||
ALTER TABLE M_AttributeInstance ADD COLUMN ValueDate TIMESTAMP DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:37:28 PM IST
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,MandatoryLogic,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211800,'N','N','N',0,'N',20,'N','N','N','Y','@AttributeValueType@=''D''','e5d9f3a8-5bc5-44ea-8bd0-4c00f54785c0','Y','DateFormat','Date format used in the input format','The date format is usually detected, but sometimes need to be defined.','Date Format','Y',100,0,'Y',TO_TIMESTAMP('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2286,10,562,TO_TIMESTAMP('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:37:33 PM IST
|
||||
ALTER TABLE M_Attribute ADD COLUMN DateFormat VARCHAR(20) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:39:07 PM IST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Name,AD_Ref_List_UU,Value,CreatedBy,UpdatedBy,Created,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Updated) VALUES (200279,326,'Date','34c7fbc0-6718-433e-a55c-6d203496e06a','D',100,100,TO_TIMESTAMP('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_TIMESTAMP('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:41:05 PM IST
|
||||
UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2014-11-18 15:41:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211800
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:41:33 PM IST
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,Created,Updated) VALUES ('N',462,20,'N','N',100,'Y',203472,'N','The date format is usually detected, but sometimes need to be defined.','Date format used in the input format','Date Format','361e4d18-9ad0-4b74-b730-bc6620502b40','Y','N',100,0,100,'Y','Y',100,0,2,211800,'D',TO_TIMESTAMP('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Nov 18, 2014 3:43:32 PM IST
|
||||
UPDATE AD_Field SET DisplayLogic='@AttributeValueType@=''D''', MandatoryLogic='@AttributeValueType@=''D''',Updated=TO_TIMESTAMP('2014-11-18 15:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201411190748_IDEMPIERE-2319.sql') FROM dual
|
||||
;
|
|
@ -20,7 +20,7 @@
|
|||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
|
||||
<stringAttribute key="selected_target_plugins" value="bcpkix@default:default,bcprov@default:default,com.itextpdf@default:default,com.jaspersoft.studio.bundles.barbecue@default:default,com.sun.mail.javax.mail@default:default,groovy-all@default:default,javax.activation@default:default,javax.annotation-api@default:default,javax.ejb@default:default,javax.inject@default:default,javax.jms@default:default,javax.management.j2ee-api@default:default,javax.transaction@default:false,javax.xml.rpc@default:default,javax.xml.soap@default:default,javax.xml@default:default,net.sf.supercsv.super-csv@default:default,org.apache.activemq.activemq-core@default:default,org.apache.activemq.kahadb@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.felix.scr@default:default,org.apache.poi@default:default,org.apache.servicemix.bundles.cglib@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.cryptacular@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jdt.core.compiler.batch@default:default,org.eclipse.jetty.osgi-servlet-api@default:default,org.eclipse.osgi.compatibility.plugins@default:false,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.jfree.chart-osgi@default:default,org.jfree.jcommon-osgi@default:default,org.junit@default:default,org.krysalis.barcode4j@default:default,org.passay@default:default,org.restlet@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
|
||||
<stringAttribute key="selected_target_plugins" value="bcpkix@default:default,bcprov@default:default,com.itextpdf@default:default,com.jaspersoft.studio.bundles.barbecue@default:default,com.sun.mail.javax.mail@default:default,groovy-all@default:default,javax.activation@default:default,javax.annotation-api@default:default,javax.ejb@default:default,javax.inject@default:default,javax.jms@default:default,javax.management.j2ee-api@default:default,javax.transaction@default:false,javax.xml.rpc@default:default,javax.xml.soap@default:default,javax.xml@default:default,net.sf.supercsv.super-csv@default:default,org.apache.activemq.activemq-core@default:default,org.apache.activemq.kahadb@default:default,org.apache.ant*1.10.1.v20170504-0840@default:default,org.apache.ant*1.9.6.v201510161327@default:default,org.apache.commons.codec*1.6.0.v201305230611@default:default,org.apache.commons.codec*1.9.0.v20170208-1614@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.felix.scr@default:default,org.apache.poi@default:default,org.apache.servicemix.bundles.cglib@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.cryptacular@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jdt.core.compiler.batch@default:default,org.eclipse.jetty.osgi-servlet-api@default:default,org.eclipse.osgi.compatibility.plugins@default:false,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.jfree.chart-osgi@default:default,org.jfree.jcommon-osgi@default:default,org.junit@default:default,org.krysalis.barcode4j@default:default,org.passay@default:default,org.restlet*2.0.5.v201605172130@default:default,org.restlet*2.3.2.v20150501-1520@default:default,org.slf4j.api*1.7.10.v20170428-1633@default:default,org.slf4j.api*1.7.2.v20121108-1250@default:default,org.slf4j.jcl@default:default"/>
|
||||
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.plugin.utils@default:default,org.adempiere.ui@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.fitrecorder@default:default,org.slf4j.jdk14@default:false"/>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
|
||||
|
|
|
@ -91,6 +91,19 @@ public interface I_M_Attribute
|
|||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name DateFormat */
|
||||
public static final String COLUMNNAME_DateFormat = "DateFormat";
|
||||
|
||||
/** Set Date Format.
|
||||
* Date format used in the input format
|
||||
*/
|
||||
public void setDateFormat (String DateFormat);
|
||||
|
||||
/** Get Date Format.
|
||||
* Date format used in the input format
|
||||
*/
|
||||
public String getDateFormat();
|
||||
|
||||
/** Column name Description */
|
||||
public static final String COLUMNNAME_Description = "Description";
|
||||
|
||||
|
|
|
@ -174,6 +174,15 @@ public interface I_M_AttributeInstance
|
|||
*/
|
||||
public String getValue();
|
||||
|
||||
/** Column name ValueDate */
|
||||
public static final String COLUMNNAME_ValueDate = "ValueDate";
|
||||
|
||||
/** Set Value Date */
|
||||
public void setValueDate (Timestamp ValueDate);
|
||||
|
||||
/** Get Value Date */
|
||||
public Timestamp getValueDate();
|
||||
|
||||
/** Column name ValueNumber */
|
||||
public static final String COLUMNNAME_ValueNumber = "ValueNumber";
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.model;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
@ -219,6 +220,17 @@ public class MAttribute extends X_M_Attribute
|
|||
} // setAttributeInstance
|
||||
|
||||
|
||||
public void setMAttributeInstance(int M_AttributeSetInstance_ID, Timestamp value)
|
||||
{
|
||||
MAttributeInstance instance = getMAttributeInstance(M_AttributeSetInstance_ID);
|
||||
if (instance == null)
|
||||
instance = new MAttributeInstance(getCtx(), getM_Attribute_ID(), M_AttributeSetInstance_ID, value,
|
||||
get_TrxName());
|
||||
else
|
||||
instance.setValueDate(value);
|
||||
instance.saveEx();
|
||||
}// setAttributeInstance
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.compiere.model;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
|
@ -101,15 +103,24 @@ public class MAttributeInstance extends X_M_AttributeInstance
|
|||
* @param Value String representation for fast display
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MAttributeInstance (Properties ctx, int M_Attribute_ID,
|
||||
int M_AttributeSetInstance_ID, int M_AttributeValue_ID, String Value, String trxName)
|
||||
public MAttributeInstance(Properties ctx, int M_Attribute_ID, int M_AttributeSetInstance_ID,
|
||||
int M_AttributeValue_ID, String Value, String trxName)
|
||||
{
|
||||
super(ctx, 0, trxName);
|
||||
setM_Attribute_ID (M_Attribute_ID);
|
||||
setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
|
||||
setM_AttributeValue_ID (M_AttributeValue_ID);
|
||||
setValue (Value);
|
||||
} // MAttributeInstance
|
||||
setM_Attribute_ID(M_Attribute_ID);
|
||||
setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
|
||||
setM_AttributeValue_ID(M_AttributeValue_ID);
|
||||
setValue(Value);
|
||||
} // MAttributeInstance
|
||||
|
||||
public MAttributeInstance(Properties ctx, int m_Attribute_ID, int m_AttributeSetInstance_ID, Timestamp value,
|
||||
String trxName)
|
||||
{
|
||||
super(ctx, 0, trxName);
|
||||
setM_Attribute_ID(m_Attribute_ID);
|
||||
setM_AttributeSetInstance_ID(m_AttributeSetInstance_ID);
|
||||
setValueDate(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -152,8 +163,18 @@ public class MAttributeInstance extends X_M_AttributeInstance
|
|||
}
|
||||
}
|
||||
setValue(display.toString());
|
||||
} // setValueNumber
|
||||
} // setValueNumber
|
||||
|
||||
public void setValueDate(Timestamp valueDate)
|
||||
{
|
||||
super.setValueDate(valueDate);
|
||||
if (valueDate != null)
|
||||
{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat());
|
||||
setValue(sdf.format(valueDate));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
|
|
|
@ -30,7 +30,7 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20171031L;
|
||||
private static final long serialVersionUID = 20180911L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_Attribute (Properties ctx, int M_Attribute_ID, String trxName)
|
||||
|
@ -83,6 +83,8 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
|
|||
public static final String ATTRIBUTEVALUETYPE_Number = "N";
|
||||
/** List = L */
|
||||
public static final String ATTRIBUTEVALUETYPE_List = "L";
|
||||
/** Date = D */
|
||||
public static final String ATTRIBUTEVALUETYPE_Date = "D";
|
||||
/** Set Attribute Value Type.
|
||||
@param AttributeValueType
|
||||
Type of Attribute Value
|
||||
|
@ -101,6 +103,23 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
|
|||
return (String)get_Value(COLUMNNAME_AttributeValueType);
|
||||
}
|
||||
|
||||
/** Set Date Format.
|
||||
@param DateFormat
|
||||
Date format used in the input format
|
||||
*/
|
||||
public void setDateFormat (String DateFormat)
|
||||
{
|
||||
set_Value (COLUMNNAME_DateFormat, DateFormat);
|
||||
}
|
||||
|
||||
/** Get Date Format.
|
||||
@return Date format used in the input format
|
||||
*/
|
||||
public String getDateFormat ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_DateFormat);
|
||||
}
|
||||
|
||||
/** Set Description.
|
||||
@param Description
|
||||
Optional short description of the record
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.model;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
@ -32,7 +33,7 @@ public class X_M_AttributeInstance extends PO implements I_M_AttributeInstance,
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20171031L;
|
||||
private static final long serialVersionUID = 20180911L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_AttributeInstance (Properties ctx, int M_AttributeInstance_ID, String trxName)
|
||||
|
@ -196,6 +197,20 @@ public class X_M_AttributeInstance extends PO implements I_M_AttributeInstance,
|
|||
return (String)get_Value(COLUMNNAME_Value);
|
||||
}
|
||||
|
||||
/** Set Value Date.
|
||||
@param ValueDate Value Date */
|
||||
public void setValueDate (Timestamp ValueDate)
|
||||
{
|
||||
set_Value (COLUMNNAME_ValueDate, ValueDate);
|
||||
}
|
||||
|
||||
/** Get Value Date.
|
||||
@return Value Date */
|
||||
public Timestamp getValueDate ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_ValueDate);
|
||||
}
|
||||
|
||||
/** Set Value.
|
||||
@param ValueNumber
|
||||
Numeric Value
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,6 +30,7 @@ import org.adempiere.webui.component.NumberBox;
|
|||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
|
@ -303,6 +304,10 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
|
|||
{
|
||||
field = new WNumberEditor(name, false, false, true, DisplayType.Number, name).getComponent();
|
||||
}
|
||||
else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributeValueType))
|
||||
{
|
||||
field = new WDateEditor(name, false, false, true, name).getComponent();
|
||||
}
|
||||
else
|
||||
{
|
||||
field = new WStringEditor(name, false, false, true, 10, 40, null, null).getComponent();
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.compiere.util.DB;
|
|||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -497,12 +498,14 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
for (int i = 0; i < m_editors.size(); i++)
|
||||
{
|
||||
HtmlBasedComponent editor = m_editors.get(i);
|
||||
if (editor instanceof InputElement)
|
||||
if (editor instanceof Listbox)
|
||||
((Listbox)editor).setEnabled(rw);
|
||||
else if (editor instanceof NumberBox)
|
||||
((NumberBox)editor).setEnabled(rw);
|
||||
else if (editor instanceof Datebox)
|
||||
((Datebox)editor).setEnabled(rw);
|
||||
else if (editor instanceof InputElement)
|
||||
((InputElement)editor).setReadonly(!rw);
|
||||
else if (editor instanceof Listbox)
|
||||
((Listbox)editor).setEnabled(rw);
|
||||
else if (editor instanceof NumberBox)
|
||||
((NumberBox)editor).setEnabled(rw);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,6 +574,17 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
else
|
||||
m_editors.add (editor);
|
||||
}
|
||||
else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
|
||||
{
|
||||
Datebox editor = new Datebox();
|
||||
setDateAttribute(attribute, editor);
|
||||
row.appendChild(editor);
|
||||
if(readOnly)
|
||||
editor.setEnabled(false);
|
||||
else
|
||||
m_editors.add(editor);
|
||||
|
||||
}
|
||||
else // Text Field
|
||||
{
|
||||
Textbox editor = new Textbox();
|
||||
|
@ -596,6 +610,11 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
NumberBox editor = (NumberBox) m_editors.get(index);
|
||||
setNumberAttribute(attribute, editor);
|
||||
}
|
||||
else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
|
||||
{
|
||||
Datebox editor = (Datebox)m_editors.get(index);
|
||||
setDateAttribute(attribute, editor);
|
||||
}
|
||||
else // Text Field
|
||||
{
|
||||
Textbox editor = (Textbox) m_editors.get(index);
|
||||
|
@ -617,6 +636,17 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
editor.setValue(Env.ZERO);
|
||||
}
|
||||
|
||||
private void setDateAttribute(MAttribute attribute,Datebox editor)
|
||||
{
|
||||
MAttributeInstance instance = attribute.getMAttributeInstance(m_M_AttributeSetInstance_ID);
|
||||
if(instance != null)
|
||||
editor.setValue(instance.getValueDate());
|
||||
else
|
||||
editor.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setListAttribute(MAttribute attribute, Listbox editor) {
|
||||
boolean found = false;
|
||||
MAttributeInstance instance = attribute.getMAttributeInstance (m_M_AttributeSetInstance_ID);
|
||||
|
@ -774,12 +804,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
for (int i = 0; i < m_editors.size(); i++)
|
||||
{
|
||||
HtmlBasedComponent editor = m_editors.get(i);
|
||||
if (editor instanceof InputElement)
|
||||
{
|
||||
((InputElement)editor).setReadonly(false);
|
||||
((InputElement)editor).setText(null);
|
||||
}
|
||||
else if (editor instanceof Listbox)
|
||||
if (editor instanceof Listbox)
|
||||
{
|
||||
((Listbox)editor).setEnabled(true);
|
||||
((Listbox)editor).setSelectedItem(null);
|
||||
|
@ -789,6 +814,16 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
((NumberBox)editor).setEnabled(true);
|
||||
((NumberBox)editor).setValue(null);
|
||||
}
|
||||
else if (editor instanceof Datebox)
|
||||
{
|
||||
((Datebox)editor).setEnabled(true);
|
||||
((Datebox)editor).setValue(null);
|
||||
}
|
||||
else if (editor instanceof InputElement)
|
||||
{
|
||||
((InputElement)editor).setReadonly(false);
|
||||
((InputElement)editor).setText(null);
|
||||
}
|
||||
}
|
||||
fieldDescription.setText("");
|
||||
}
|
||||
|
@ -798,12 +833,15 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
for (int i = 0; i < m_editors.size(); i++)
|
||||
{
|
||||
HtmlBasedComponent editor = m_editors.get(i);
|
||||
if (editor instanceof InputElement)
|
||||
((InputElement)editor).setReadonly(!check);
|
||||
if (editor instanceof Datebox)
|
||||
((Datebox) editor).setEnabled(check);
|
||||
else if (editor instanceof Listbox)
|
||||
((Listbox)editor).setEnabled(check);
|
||||
((Listbox) editor).setEnabled(check);
|
||||
else if (editor instanceof NumberBox)
|
||||
((NumberBox)editor).setEnabled(check);
|
||||
((NumberBox) editor).setEnabled(check);
|
||||
else if (editor instanceof InputElement)
|
||||
((InputElement) editor).setReadonly(!check);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -897,12 +935,15 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
for (int i = 0; i < m_editors.size(); i++)
|
||||
{
|
||||
HtmlBasedComponent editor = m_editors.get(i);
|
||||
if (editor instanceof InputElement)
|
||||
((InputElement)editor).setReadonly(!rw);
|
||||
else if (editor instanceof Listbox)
|
||||
((Listbox)editor).setEnabled(rw);
|
||||
if (editor instanceof Listbox)
|
||||
((Listbox) editor).setEnabled(rw);
|
||||
else if (editor instanceof NumberBox)
|
||||
((NumberBox)editor).setEnabled(rw);
|
||||
((NumberBox) editor).setEnabled(rw);
|
||||
else if (editor instanceof Datebox)
|
||||
((Datebox) editor).setEnabled(rw);
|
||||
else if (editor instanceof InputElement)
|
||||
((InputElement) editor).setReadonly(!rw);
|
||||
|
||||
}
|
||||
} // cmd_newEdit
|
||||
|
||||
|
@ -940,9 +981,17 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
private boolean saveSelection()
|
||||
{
|
||||
log.info("");
|
||||
|
||||
MAttributeSet as = m_masi.getMAttributeSet();
|
||||
|
||||
if (as == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
String trxName = Trx.createTrxName("WPAttributeDialog_SaveSelection");
|
||||
m_masi.set_TrxName(trxName);
|
||||
as.set_TrxName(trxName);
|
||||
|
||||
//
|
||||
m_changed = false;
|
||||
String mandatory = "";
|
||||
|
@ -975,6 +1024,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
m_changed = true;
|
||||
} // GuaranteeDate
|
||||
|
||||
|
||||
// *** Save Attributes ***
|
||||
// New Instance
|
||||
if (mandatory.isEmpty() && (m_changed || m_masi.getM_AttributeSetInstance_ID() == 0))
|
||||
|
@ -985,7 +1035,9 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
}
|
||||
|
||||
// Save Instance Attributes
|
||||
|
||||
MAttribute[] attributes = as.getMAttributes(!m_productWindow);
|
||||
MAttribute.set_TrxName(attributes, trxName);
|
||||
for (int i = 0; i < attributes.length; i++)
|
||||
{
|
||||
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributes[i].getAttributeValueType()))
|
||||
|
@ -1010,6 +1062,15 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
value = value.setScale(1, BigDecimal.ROUND_HALF_UP);
|
||||
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
|
||||
}
|
||||
else if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributes[i].getAttributeValueType()))
|
||||
{
|
||||
Datebox editor = (Datebox) m_editors.get(i);
|
||||
Date value = editor.getValue();
|
||||
Timestamp ts = value != null ? new Timestamp(value.getTime()) : null;
|
||||
if (attributes[i].isMandatory() && value == null)
|
||||
mandatory += " - " + attributes[i].getName();
|
||||
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, ts);
|
||||
}
|
||||
else
|
||||
{
|
||||
Textbox editor = (Textbox)m_editors.get(i);
|
||||
|
@ -1023,6 +1084,18 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
|
|||
} // for all attributes
|
||||
m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID ();
|
||||
m_M_AttributeSetInstanceName = m_masi.getDescription();
|
||||
|
||||
if (!m_changed || mandatory.length() > 0)
|
||||
{
|
||||
// Rollback
|
||||
Trx.get(trxName, false).rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Commit
|
||||
Trx.get(trxName, false).commit();
|
||||
}
|
||||
Trx.get(trxName, false).close();
|
||||
//
|
||||
if (mandatory.length() > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue