← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3587: Minor improvement

 

------------------------------------------------------------
revno: 3587
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-12 11:25:07 +0200
message:
  Minor improvement
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java


--
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/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-05-11 21:14:38 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-05-12 09:25:07 +0000
@@ -274,7 +274,14 @@
 
                 if ( dataElement == null )
                 {
-                    return "Data element with id :" + dataElementId + " does not exist in this data set";
+                    return "Data element with id : " + dataElementId + " does not exist";
+                }
+                
+                DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+                
+                if ( categoryOptionCombo == null )
+                {
+                    return "Category option combo with id: " + optionComboId + " does not exist";
                 }
 
                 String dataElementValueType = dataElement.getType();
@@ -312,18 +319,11 @@
 
                 inputHtml = inputHtml.replaceAll( "view=\".*?\"", "" ); // For backwards compatibility
 
-                StringBuilder title = new StringBuilder( "title=\"Name: " ).append( dataElement.getName() ).
-                    append( " Type: " ).append( dataElement.getType() ).append( " Min: " ).append( minValue ).
-                    append( " Max: " ).append( maxValue ).append( "\"" );
+                StringBuilder title = new StringBuilder( "title=\"Name: " ).append( dataElement.getName() ).append( " " ).
+                    append( categoryOptionCombo.getName() ).append( " Type: " ).append( dataElement.getType() ).
+                    append( " Min: " ).append( minValue ).append( " Max: " ).append( maxValue ).append( "\"" );
                 
-                if ( inputHtml.contains( EMPTY_TITLE_TAG ) )
-                {
-                    inputHtml = inputHtml.replace( EMPTY_TITLE_TAG, title );
-                }
-                else
-                {
-                    inputHtml += " " + title;
-                }
+                inputHtml = inputHtml.contains( EMPTY_TITLE_TAG ) ? inputHtml.replace( EMPTY_TITLE_TAG, title ) : inputHtml + " " + title;
 
                 // -------------------------------------------------------------
                 // Append Javascript code and meta data (type/min/max) for