← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16754: Data value, removed the max length constraint on value and comment in database, service layer and...

 

------------------------------------------------------------
revno: 16754
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-19 16:10:47 +0200
message:
  Data value, removed the max length constraint on value and comment in database, service layer and data entry. This allows for entering long text such as narratives directly e.g. using custom forms.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css


--
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-09-15 20:06:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-09-19 14:10:47 +0000
@@ -736,6 +736,9 @@
         executeSql( "alter table indicator drop column sortorder" );
         executeSql( "alter table dataset drop column sortorder" );
         
+        executeSql( "alter table datavalue alter column value type character varying" );
+        executeSql( "alter table datavalue alter column comment type character varying" );
+        
         upgradeDataValuesWithAttributeOptionCombo();
         upgradeCompleteDataSetRegistrationsWithAttributeOptionCombo();
         upgradeMapViewsToAnalyticalObject();

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java	2014-07-21 09:45:25 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java	2014-09-19 14:10:47 +0000
@@ -28,21 +28,29 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_AVERAGE;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_BOOL;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_DATE;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_INT;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_NEGATIVE_INT;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_NUMBER;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_PERCENTAGE;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_POSITIVE_INT;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_TRUE_ONLY;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_UNIT_INTERVAL;
+import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT;
+
+import java.awt.geom.Point2D;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.apache.commons.validator.routines.DateValidator;
 import org.apache.commons.validator.routines.EmailValidator;
 import org.apache.commons.validator.routines.UrlValidator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.datavalue.DataValue;
 
-import java.awt.geom.Point2D;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.hisp.dhis.dataelement.DataElement.*;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -244,7 +252,6 @@
      * 
      * <ul>
      * <li>data_element_or_type_null_or_empty</li>
-     * <li>value_length_greater_than_max_length</li>
      * <li>value_not_numeric</li>
      * <li>value_not_unit_interval</li>
      * <li>value_not_percentage</li>
@@ -272,16 +279,8 @@
             return "data_element_or_type_null_or_empty";
         }
 
-        List<String> types = Arrays.asList( VALUE_TYPE_STRING, VALUE_TYPE_INT, VALUE_TYPE_NUMBER, 
-            VALUE_TYPE_POSITIVE_INT, VALUE_TYPE_NEGATIVE_INT, VALUE_TYPE_ZERO_OR_POSITIVE_INT );
-
         String type = dataElement.getDetailedNumberType();
 
-        if ( types.contains( type ) && value.length() > 255 )
-        {
-            return "value_length_greater_than_max_length";
-        }
-
         if ( VALUE_TYPE_NUMBER.equals( type ) && !MathUtils.isNumeric( value ) )
         {
             return "value_not_numeric";
@@ -366,11 +365,6 @@
             return null;
         }
         
-        if ( comment.length() > 360 )
-        {
-            return "comment_too_long";
-        }
-        
         return null;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2014-09-17 11:43:40 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2014-09-19 14:10:47 +0000
@@ -181,10 +181,6 @@
     {
         if ( type == 'string' || type == 'int' || type == 'number' || type == 'posInt' || type == 'negInt' || type == 'zeroPositiveInt' || type == 'unitInterval' || type == 'percentage' )
         {
-            if ( value.length > 255 )
-            {
-                return dhis2.de.alertField( fieldId, i18n_value_too_long + '\n\n' + dataElementName );
-            }
             if ( type == 'int' && !dhis2.validation.isInt( value ) )
             {
                 return dhis2.de.alertField( fieldId, i18n_value_must_integer + '\n\n' + dataElementName );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2014-09-10 03:45:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2014-09-19 14:10:47 +0000
@@ -5,14 +5,6 @@
 	
     var commentValue = $( '#commentTextArea' ).val();
 
-    if ( commentValue.length > 360 )
-    {
-        markComment( dhis2.de.cst.colorYellow );
-        window.alert(i18n_value_too_long + " for comment field");
-
-        return;
-    }
-
     var commentSaver = new CommentSaver( currentDataElementId, currentOptionComboId, commentValue );
 
     commentSaver.save();

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2014-09-17 10:40:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2014-09-19 14:10:47 +0000
@@ -149,7 +149,7 @@
   min-width: 264px;
   min-height: 45px;
   text-align: left;
-  padding: 2px;
+  padding: 4px;
   box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06);
 }