← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7744: Exception when to load data entry form of stage with new patient data elements added; Remove text...

 

------------------------------------------------------------
revno: 7744
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-07-27 22:13:24 +0700
message:
  Exception when to load data entry form of stage with new patient data elements added; Remove textarea field in design data entry form of stage and create textarea field for long-text data elements when to load data entry form.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js


--
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-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java	2012-07-10 11:18:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java	2012-07-27 15:13:24 +0000
@@ -41,7 +41,7 @@
  */
 public interface ProgramDataEntryService
 {
-    final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?|<textarea.*?)[/]?>", Pattern.DOTALL );
+    final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
     
     final Pattern IDENTIFIER_PATTERN_FIELD = Pattern.compile( "id=\"(\\d+)-(\\d+)-val\"" );
     

=== 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	2012-07-26 15:00:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-07-27 15:13:24 +0000
@@ -156,7 +156,7 @@
         
         executeSql( "ALTER TABLE organisationunit DROP COLUMN hasPatients" );
         
-        executeSql( "update dataelement set texttype='text' where valuetype='string'" );
+        executeSql( "update dataelement set texttype='text' where valuetype='string' and texttype is null" );
         
         // ---------------------------------------------------------------------
         // Update tables for dimensional model

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-07-13 06:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-07-27 15:13:24 +0000
@@ -276,7 +276,7 @@
                     {
                         inputHTML += jQueryCalendar;
                     }
-                    
+
                     if ( !programStageInstance.isCompleted() && allowProvidedElsewhere )
                     {
                         // Add ProvidedByOtherFacility checkbox
@@ -289,7 +289,7 @@
                 // -----------------------------------------------------------
 
                 inputHTML = inputHTML.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
-                inputHTML = inputHTML.replace( "$VALUE",dataElementValue );
+                inputHTML = inputHTML.replace( "$VALUE", dataElementValue );
                 inputHTML = inputHTML.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
                 inputHTML = inputHTML.replace( "$PROGRAMSTAGENAME", programStageName );
                 inputHTML = inputHTML.replace( "$DATAELEMENTNAME", dataElement.getName() );
@@ -532,10 +532,13 @@
         {
             inputHTML += jsCodeForOnchange;
         }
-
-        if( DataElement.VALUE_TYPE_LONG_TEXT.equals( dataElement.getDetailedTextType() ))
-            inputHTML += " >$VALUE";
-        
+System.out.println("\n\n === \n dataElement.getDetailedTextType() : " + dataElement.getDetailedTextType() );
+        if ( DataElement.VALUE_TYPE_LONG_TEXT.equals( dataElement.getDetailedTextType() ) )
+        {
+            inputHTML = inputHTML.replaceFirst( "input", "textarea" );
+            inputHTML += " >$VALUE</textarea>";
+        }
+System.out.println("\n\n inputHTML: " + inputHTML );        
         return inputHTML;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2012-07-10 11:18:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2012-07-27 15:13:24 +0000
@@ -258,8 +258,14 @@
         dataElement.setActive( true );
         dataElement.setDomainType( domainType );
         dataElement.setType( valueType );
-        dataElement.setNumberType( numberType );
-        dataElement.setTextType ( textType );
+        if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) )
+        {
+            dataElement.setTextType( textType );
+        }
+        else
+        {
+            dataElement.setNumberType( numberType );
+        }
         dataElement.setAggregationOperator( aggregationOperator );
         dataElement.setUrl( url );
         dataElement.setZeroIsSignificant( zeroIsSignificant );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2012-07-10 11:18:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2012-07-27 15:13:24 +0000
@@ -288,8 +288,16 @@
         dataElement.setActive( active );
         dataElement.setDomainType( domainType );
         dataElement.setType( valueType );
-        dataElement.setNumberType( numberType );
-        dataElement.setTextType( textType );
+        if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) )
+        {
+            dataElement.setTextType( textType );
+            dataElement.setNumberType( null );
+        }
+        else
+        {
+            dataElement.setNumberType( numberType );
+            dataElement.setTextType( null );
+        }
         dataElement.setAggregationOperator( aggregationOperator );
         dataElement.setUrl( url );
         dataElement.setZeroIsSignificant( zeroIsSignificant );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-06-04 10:03:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-07-27 15:13:24 +0000
@@ -131,9 +131,9 @@
     {
         this.compulsories = compulsories;
     }
-    
+
     private List<Boolean> allowProvidedElsewhere = new ArrayList<Boolean>();
-    
+
     public void setAllowProvidedElsewhere( List<Boolean> allowProvidedElsewhere )
     {
         this.allowProvidedElsewhere = allowProvidedElsewhere;
@@ -184,7 +184,8 @@
             DataElement dataElement = dataElementService.getDataElement( selectedDataElementsValidator.get( i ) );
             ProgramStageDataElement programStageDataElement = new ProgramStageDataElement( programStage, dataElement,
                 this.compulsories.get( i ), new Integer( i ) );
-            programStageDataElement.setAllowProvidedElsewhere( allowProvidedElsewhere.get( i ) );
+            Boolean allowed = allowProvidedElsewhere.get( i ) == null ? false : allowProvidedElsewhere.get( i );
+            programStageDataElement.setAllowProvidedElsewhere( allowed );
             programStageDataElementService.addProgramStageDataElement( programStageDataElement );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2012-06-04 10:03:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2012-07-27 15:13:24 +0000
@@ -189,7 +189,8 @@
 
                 programStageDataElement.setSortOrder( new Integer( i ) );
 
-                programStageDataElement.setAllowProvidedElsewhere( allowProvidedElsewhere.get( i ) );
+                Boolean allowed = allowProvidedElsewhere.get( i ) == null ? false : allowProvidedElsewhere.get( i );
+                programStageDataElement.setAllowProvidedElsewhere( allowed );
                 
                 programStageDataElementService.updateProgramStageDataElement( programStageDataElement );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2012-07-12 10:38:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2012-07-27 15:13:24 +0000
@@ -162,13 +162,7 @@
 		var displayName = dataElementName;
 		htmlCode = "<input type=\"checkbox\" title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" title=\"" + displayName + "\">";
 	} 
-	else if ( dataElementType == "longText" )
-	{
-		var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
-		var displayName = dataElementName;
-		htmlCode = "<textarea title=\"" + titleValue + " \"name=\"entryfield\" id=\"" + id + "\" title=\"" + displayName + "\" ></textarea>";
-	}
-	else if ( dataElementType == "int" || dataElementType == "text" ) 
+	else if ( dataElementType == "int" || dataElementType == "text" || dataElementType == "longText" ) 
 	{
 		var titleValue = "-- " + dataElementId + "." + dataElementName +" (" + dataElementType + ") --";
 		var displayName = dataElementName;