← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14509: Fixed bug - Exception thrown when to click on Add/Update TEI form.

 

------------------------------------------------------------
revno: 14509
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-03-28 14:24:57 +0700
message:
  Fixed bug - Exception thrown when to click on Add/Update TEI form.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-03-28 01:51:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-03-28 07:24:57 +0000
@@ -37,6 +37,8 @@
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.jdbc.batchhandler.RelativePeriodsBatchHandler;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,7 +47,9 @@
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -261,7 +265,8 @@
         // orgunit shortname uniqueness
         executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT organisationunit_shortname_key" );
 
-        // update dataset-dataentryform association and programstage-cde association
+        // update dataset-dataentryform association and programstage-cde
+        // association
         if ( updateDataSetAssociation() && updateProgramStageAssociation() )
         {
             // delete table dataentryformassociation
@@ -679,8 +684,10 @@
         executeSql( "ALTER TABLE dataset DROP COLUMN symbol" );
         executeSql( "ALTER TABLE users ALTER COLUMN password DROP NOT NULL" );
 
-        executeSql( "update categorycombo set dimensiontype = '" + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" );
-        executeSql( "update dataelementcategory set dimensiontype = '" + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" );
+        executeSql( "update categorycombo set dimensiontype = '"
+            + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" );
+        executeSql( "update dataelementcategory set dimensiontype = '"
+            + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" );
         executeSql( "update dataset set categorycomboid = " + defaultCategoryComboId + " where categorycomboid is null" );
 
         // set default dataDimension on orgUnitGroupSet and deGroupSet
@@ -709,10 +716,37 @@
 
         upgradeDataValuesWithAttributeOptionCombo();
         upgradeMapViewsToAnalyticalObject();
+        
+        removeNullOptionSet();
 
         log.info( "Tables updated" );
     }
 
+    private OptionService optionService;
+
+    private void removeNullOptionSet()
+    {
+        Collection<OptionSet> optionSets = optionService.getAllOptionSets();
+        for ( OptionSet optionSet : optionSets )
+        {
+            boolean flag = false;
+            Iterator<String> iterOption = optionSet.getOptions().iterator();
+            while ( iterOption.hasNext() )
+            {
+                if ( iterOption.next() == null )
+                {
+                    iterOption.remove();
+                    flag = true;
+                }
+            }
+            if ( flag )
+            {
+                optionService.updateOptionSet( optionSet );
+            }
+
+        }
+    }
+
     private void upgradeDataValuesWithAttributeOptionCombo()
     {
         final String sql = statementBuilder.getNumberOfColumnsInPrimaryKey( "datavalue" );
@@ -721,7 +755,8 @@
 
         if ( no >= 5 )
         {
-            return; // attributeoptioncomboid already part of datavalue primary key
+            return; // attributeoptioncomboid already part of datavalue primary
+                    // key
         }
 
         int optionComboId = getDefaultOptionCombo();
@@ -731,13 +766,14 @@
         executeSql( "alter table datavalue drop constraint datavalue_pkey;" );
 
         executeSql( "alter table datavalue add column attributeoptioncomboid integer;" );
-        executeSql( "update datavalue set attributeoptioncomboid = " + optionComboId + " where attributeoptioncomboid is null;" );
+        executeSql( "update datavalue set attributeoptioncomboid = " + optionComboId
+            + " where attributeoptioncomboid is null;" );
         executeSql( "alter table datavalue alter column attributeoptioncomboid set not null;" );
         executeSql( "alter table datavalue add constraint fk_datavalue_attributeoptioncomboid foreign key (attributeoptioncomboid) references categoryoptioncombo (categoryoptioncomboid) match simple;" );
         executeSql( "alter table datavalue add constraint datavalue_pkey primary key(dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid);" );
 
-        executeSql( "alter table datavalue_audit add constraint fk_datavalueaudit_datavalue foreign key (dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid) " +
-            "references datavalue (dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid) match simple;" );
+        executeSql( "alter table datavalue_audit add constraint fk_datavalueaudit_datavalue foreign key (dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid) "
+            + "references datavalue (dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid) match simple;" );
 
         log.info( "Data value table upgraded with attributeoptioncomboid column" );
     }
@@ -759,8 +795,8 @@
         executeSql( "insert into mapview_periods ( mapviewid, sort_order, periodid ) select mapviewid, 0, periodid from mapview where periodid is not null" );
         executeSql( "alter table mapview drop column periodid" );
 
-        executeSql( "insert into mapview_orgunitlevels ( mapviewid, sort_order, orgunitlevel ) select m.mapviewid, 0, o.level " +
-            "from mapview m join orgunitlevel o on (m.organisationunitlevelid=o.orgunitlevelid) where m.organisationunitlevelid is not null" );
+        executeSql( "insert into mapview_orgunitlevels ( mapviewid, sort_order, orgunitlevel ) select m.mapviewid, 0, o.level "
+            + "from mapview m join orgunitlevel o on (m.organisationunitlevelid=o.orgunitlevelid) where m.organisationunitlevelid is not null" );
         executeSql( "alter table mapview drop column organisationunitlevelid" );
 
         executeSql( "alter table mapview drop column dataelementgroupid" );
@@ -773,7 +809,8 @@
 
     private void upgradeChartRelativePeriods()
     {
-        BatchHandler<RelativePeriods> batchHandler = batchHandlerFactory.createBatchHandler( RelativePeriodsBatchHandler.class ).init();
+        BatchHandler<RelativePeriods> batchHandler = batchHandlerFactory.createBatchHandler(
+            RelativePeriodsBatchHandler.class ).init();
 
         try
         {
@@ -783,23 +820,12 @@
 
             while ( rs.next() )
             {
-                RelativePeriods r = new RelativePeriods(
-                    rs.getBoolean( "reportingmonth" ),
-                    false,
-                    rs.getBoolean( "reportingquarter" ),
-                    rs.getBoolean( "lastsixmonth" ),
-                    rs.getBoolean( "monthsthisyear" ),
-                    rs.getBoolean( "quartersthisyear" ),
-                    rs.getBoolean( "thisyear" ),
-                    false, false,
-                    rs.getBoolean( "lastyear" ),
-                    rs.getBoolean( "last5years" ),
-                    rs.getBoolean( "last12months" ),
-                    rs.getBoolean( "last3months" ),
-                    false,
-                    rs.getBoolean( "last4quarters" ),
-                    rs.getBoolean( "last2sixmonths" ),
-                    false, false, false,
+                RelativePeriods r = new RelativePeriods( rs.getBoolean( "reportingmonth" ), false,
+                    rs.getBoolean( "reportingquarter" ), rs.getBoolean( "lastsixmonth" ),
+                    rs.getBoolean( "monthsthisyear" ), rs.getBoolean( "quartersthisyear" ),
+                    rs.getBoolean( "thisyear" ), false, false, rs.getBoolean( "lastyear" ),
+                    rs.getBoolean( "last5years" ), rs.getBoolean( "last12months" ), rs.getBoolean( "last3months" ),
+                    false, rs.getBoolean( "last4quarters" ), rs.getBoolean( "last2sixmonths" ), false, false, false,
                     false, false, false, false );
 
                 int chartId = rs.getInt( "chartid" );
@@ -808,7 +834,8 @@
                 {
                     int relativePeriodsId = batchHandler.insertObject( r, true );
 
-                    String update = "update chart set relativeperiodsid=" + relativePeriodsId + " where chartid=" + chartId;
+                    String update = "update chart set relativeperiodsid=" + relativePeriodsId + " where chartid="
+                        + chartId;
 
                     executeSql( update );
 
@@ -841,7 +868,8 @@
 
     private void upgradeReportTableRelativePeriods()
     {
-        BatchHandler<RelativePeriods> batchHandler = batchHandlerFactory.createBatchHandler( RelativePeriodsBatchHandler.class ).init();
+        BatchHandler<RelativePeriods> batchHandler = batchHandlerFactory.createBatchHandler(
+            RelativePeriodsBatchHandler.class ).init();
 
         try
         {
@@ -851,27 +879,16 @@
 
             while ( rs.next() )
             {
-                RelativePeriods r = new RelativePeriods(
-                    rs.getBoolean( "reportingmonth" ),
-                    rs.getBoolean( "reportingbimonth" ),
-                    rs.getBoolean( "reportingquarter" ),
-                    rs.getBoolean( "lastsixmonth" ),
-                    rs.getBoolean( "monthsthisyear" ),
-                    rs.getBoolean( "quartersthisyear" ),
-                    rs.getBoolean( "thisyear" ),
-                    rs.getBoolean( "monthslastyear" ),
-                    rs.getBoolean( "quarterslastyear" ),
-                    rs.getBoolean( "lastyear" ),
-                    rs.getBoolean( "last5years" ),
-                    rs.getBoolean( "last12months" ),
-                    rs.getBoolean( "last3months" ),
-                    false,
-                    rs.getBoolean( "last4quarters" ),
-                    rs.getBoolean( "last2sixmonths" ),
-                    rs.getBoolean( "thisfinancialyear" ),
-                    rs.getBoolean( "lastfinancialyear" ),
-                    rs.getBoolean( "last5financialyears" ),
-                    false, false, false, false );
+                RelativePeriods r = new RelativePeriods( rs.getBoolean( "reportingmonth" ),
+                    rs.getBoolean( "reportingbimonth" ), rs.getBoolean( "reportingquarter" ),
+                    rs.getBoolean( "lastsixmonth" ), rs.getBoolean( "monthsthisyear" ),
+                    rs.getBoolean( "quartersthisyear" ), rs.getBoolean( "thisyear" ),
+                    rs.getBoolean( "monthslastyear" ), rs.getBoolean( "quarterslastyear" ),
+                    rs.getBoolean( "lastyear" ), rs.getBoolean( "last5years" ), rs.getBoolean( "last12months" ),
+                    rs.getBoolean( "last3months" ), false, rs.getBoolean( "last4quarters" ),
+                    rs.getBoolean( "last2sixmonths" ), rs.getBoolean( "thisfinancialyear" ),
+                    rs.getBoolean( "lastfinancialyear" ), rs.getBoolean( "last5financialyears" ), false, false, false,
+                    false );
 
                 int reportTableId = rs.getInt( "reporttableid" );
 
@@ -879,7 +896,8 @@
                 {
                     int relativePeriodsId = batchHandler.insertObject( r, true );
 
-                    String update = "update reporttable set relativeperiodsid=" + relativePeriodsId + " where reporttableid=" + reportTableId;
+                    String update = "update reporttable set relativeperiodsid=" + relativePeriodsId
+                        + " where reporttableid=" + reportTableId;
 
                     executeSql( update );
 
@@ -937,40 +955,47 @@
 
                 if ( doIndicators )
                 {
-                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id + ",'dx'," + columnSortOrder + ");" );
+                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id
+                        + ",'dx'," + columnSortOrder + ");" );
                     columnSortOrder++;
                 }
                 else
                 {
-                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id + ",'dx'," + rowSortOrder + ");" );
+                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id
+                        + ",'dx'," + rowSortOrder + ");" );
                     rowSortOrder++;
                 }
 
                 if ( doPeriods )
                 {
-                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id + ",'pe'," + columnSortOrder + ");" );
+                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id
+                        + ",'pe'," + columnSortOrder + ");" );
                     columnSortOrder++;
                 }
                 else
                 {
-                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id + ",'pe'," + rowSortOrder + ");" );
+                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id
+                        + ",'pe'," + rowSortOrder + ");" );
                     rowSortOrder++;
                 }
 
                 if ( doUnits )
                 {
-                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id + ",'ou'," + columnSortOrder + ");" );
+                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id
+                        + ",'ou'," + columnSortOrder + ");" );
                     columnSortOrder++;
                 }
                 else
                 {
-                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id + ",'ou'," + rowSortOrder + ");" );
+                    executeSql( "insert into reporttable_rows (reporttableid, dimension, sort_order) values (" + id
+                        + ",'ou'," + rowSortOrder + ");" );
                     rowSortOrder++;
                 }
 
                 if ( categoryComboId > 0 )
                 {
-                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id + ",'co'," + columnSortOrder + ");" );
+                    executeSql( "insert into reporttable_columns (reporttableid, dimension, sort_order) values (" + id
+                        + ",'co'," + columnSortOrder + ");" );
                 }
             }
 
@@ -1083,7 +1108,7 @@
     {
         try
         {
-            //TODO use jdbcTemplate
+            // TODO use jdbcTemplate
 
             return statementManager.getHolder().executeUpdate( sql );
         }
@@ -1097,11 +1122,9 @@
 
     private Integer getDefaultOptionCombo()
     {
-        String sql =
-            "select coc.categoryoptioncomboid from categoryoptioncombo coc " +
-                "inner join categorycombos_optioncombos cco on coc.categoryoptioncomboid=cco.categoryoptioncomboid " +
-                "inner join categorycombo cc on cco.categorycomboid=cc.categorycomboid " +
-                "where cc.name='default';";
+        String sql = "select coc.categoryoptioncomboid from categoryoptioncombo coc "
+            + "inner join categorycombos_optioncombos cco on coc.categoryoptioncomboid=cco.categoryoptioncomboid "
+            + "inner join categorycombo cc on cco.categorycomboid=cc.categorycomboid " + "where cc.name='default';";
 
         return statementManager.getHolder().queryForInteger( sql );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java	2014-03-27 23:40:38 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java	2014-03-28 07:24:57 +0000
@@ -272,11 +272,16 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private String getAttributeField( String inputHtml, TrackedEntityAttribute attribute, Program program, String value, I18n i18n,
-        int index, String hidden, String style )
+    private String getAttributeField( String inputHtml, TrackedEntityAttribute attribute, Program program,
+        String value, I18n i18n, int index, String hidden, String style )
     {
-        boolean mandatory = program.getAttribute(attribute).isMandatory(); //TODO fix
-                
+        boolean mandatory = false;
+
+        if ( program != null && program.getAttribute( attribute ) != null )
+        {
+            mandatory = program.getAttribute( attribute ).isMandatory();
+        }
+
         inputHtml = TAG_OPEN + "input id=\"attr" + attribute.getId() + "\" name=\"attr" + attribute.getId()
             + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
 
@@ -345,8 +350,8 @@
         {
             inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
         }
-         
-       return inputHtml;
+
+        return inputHtml;
     }
 
     private Object getValueFromProgram( String property, ProgramInstance programInstance )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2014-03-27 14:36:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2014-03-28 07:24:57 +0000
@@ -223,23 +223,16 @@
             .getTrackedEntityAttributeValues( entityInstance );
         attributeValues = new HashSet<TrackedEntityAttributeValue>();
 
-        for ( Program program : programs )
+        for ( TrackedEntityAttributeValue attributeValue : _attributeValues )
         {
-            Collection<TrackedEntityAttribute> atttributes = program.getTrackedEntityAttributes();
-            for ( TrackedEntityAttributeValue attributeValue : _attributeValues )
+            String value = attributeValue.getValue();
+            if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
             {
-                if ( atttributes.contains( attributeValue.getAttribute() ) )
-                {
-                    String value = attributeValue.getValue();
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
-                    }
-
-                    attributeValue.setValue( value );
-                    attributeValues.add( attributeValue );
-                }
+                Date date = format.parseDate( value );
+                value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
             }
+            
+            attributeValues.add( attributeValue );
         }
 
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java	2014-03-19 06:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java	2014-03-28 07:24:57 +0000
@@ -115,6 +115,7 @@
         {
             trackedEntity = trackedEntityService.getTrackedEntity( trackedEntityId );
         }
+
         entityInstance.setTrackedEntity( trackedEntity );
 
         // ---------------------------------------------------------------------
@@ -144,7 +145,7 @@
                 {
                     if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
                     {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
+                       value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
                     }
 
                     attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstance, attribute );
@@ -184,6 +185,11 @@
         this.format = format;
     }
 
+    public void setTrackedEntityId( Integer trackedEntityId )
+    {
+        this.trackedEntityId = trackedEntityId;
+    }
+
     public void setTrackedEntityService( TrackedEntityService trackedEntityService )
     {
         this.trackedEntityService = trackedEntityService;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-03-20 05:43:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-03-28 07:24:57 +0000
@@ -76,7 +76,7 @@
 															 inherit="$!attribute.inherit" #if($value=='true') checked #end
 															 onclick="toggleUnderAge(this);" class='underAge' />
 											 #elseif( $attribute.valueType == "age" || $attribute.valueType == "number" ) 
-													 <input type='text' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
+													 <input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
 											 #else 
 													 <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$mandatory  #if($attribute.valueType=='NUMBER'),number:true #end }}" />
 											 #end
@@ -133,7 +133,9 @@
 						<input type="checkbox" value='true' id="attr$attribute.id" name="attr$attribute.id" 
 							inherit="$!attribute.inherit" #if($value=='true') checked #end
 							onclick="toggleUnderAge(this);" class='underAge' />
-					#else  
+					#elseif( $attribute.valueType == "age" || $attribute.valueType == "number" ) 
+						<input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
+					#else 
 						<input type="text"  id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value="$!attributeValue" class="{validate:{required:$mandatory  #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
 					#end
 				</td>