← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9823: Apply custom registration form for single event with registration program.

 

------------------------------------------------------------
revno: 9823
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-18 16:50:45 +0700
message:
  Apply custom registration form for single event with registration program.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.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-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-27 15:13:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java	2013-02-18 09:50:45 +0000
@@ -42,16 +42,18 @@
 public interface ProgramDataEntryService
 {
     final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
-    
+
     final Pattern IDENTIFIER_PATTERN_FIELD = Pattern.compile( "id=\"(\\d+)-(\\d+)-val\"" );
-    
-    //--------------------------------------------------------------------------
+
+    // --------------------------------------------------------------------------
     // ProgramDataEntryService
-    //--------------------------------------------------------------------------
-    
+    // --------------------------------------------------------------------------
+
     String prepareDataEntryFormForEntry( String htmlCode, Collection<PatientDataValue> dataValues, String disabled,
         I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
         OrganisationUnit organisationUnit );
-    
+
+    String prepareDataEntryFormForAdd( String htmlCode, I18n i18n, ProgramStage programStage );
+
     String prepareDataEntryFormForEdit( String htmlCode );
 }

=== 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	2013-02-08 08:58:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2013-02-18 09:50:45 +0000
@@ -310,6 +310,188 @@
         return populateI18nStrings( sb.toString(), i18n );
     }
 
+    @Override
+    public String prepareDataEntryFormForAdd( String htmlCode, I18n i18n, ProgramStage programStage )
+    {
+        // ---------------------------------------------------------------------
+        // Inline Javascript to add to HTML before outputting
+        // ---------------------------------------------------------------------
+
+        final String jQueryCalendar = "<script>datePicker(\"$PROGRAMSTAGEID-$DATAELEMENTID-val\", false);</script>";
+
+        StringBuffer sb = new StringBuffer();
+
+        // ---------------------------------------------------------------------
+        // Pattern to match data elements in the HTML code
+        // ---------------------------------------------------------------------
+
+        Matcher dataElementMatcher = INPUT_PATTERN.matcher( htmlCode );
+        int tabindex = 0;
+
+        // ---------------------------------------------------------------------
+        // Iterate through all matching data element fields
+        // ---------------------------------------------------------------------
+
+        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
+
+        while ( dataElementMatcher.find() )
+        {
+            // -----------------------------------------------------------------
+            // Get HTML input field code
+            // -----------------------------------------------------------------
+
+            String compulsory = "null";
+            boolean allowProvidedElsewhere = false;
+            String inputHTML = dataElementMatcher.group( 1 );
+
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( inputHTML );
+
+            if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
+            {
+                // -------------------------------------------------------------
+                // Get data element ID of data element
+                // -------------------------------------------------------------
+
+                int programStageId = Integer.parseInt( identifierMatcher.group( 1 ) );
+
+                int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
+
+                DataElement dataElement = null;
+
+                String programStageName = programStage.getDisplayName();
+
+                if ( programStageId != programStage.getId() )
+                {
+                    dataElement = dataElementService.getDataElement( dataElementId );
+
+                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
+                    programStageName = otherProgramStage != null ? otherProgramStage.getDisplayName() : "N/A";
+                }
+                else
+                {
+                    dataElement = dataElementMap.get( dataElementId );
+                    if ( dataElement == null )
+                    {
+                        return i18n.getString( "some_data_element_not_exist" );
+                    }
+
+                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
+
+                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
+                    allowProvidedElsewhere = psde.getAllowProvidedElsewhere();
+                }
+
+                if ( dataElement == null )
+                {
+                    continue;
+                }
+
+                // -------------------------------------------------------------
+                // Find type of data element
+                // -------------------------------------------------------------
+
+                String dataElementType = dataElement.getDetailedNumberType();
+
+                // -------------------------------------------------------------
+                // Find existing value of data element in data set
+                // -------------------------------------------------------------
+
+                PatientDataValue patientDataValue = null;
+
+                String dataElementValue = EMPTY;
+
+                // -------------------------------------------------------------
+                // Insert title information - Data element id, name, type, min,
+                // max
+                // -------------------------------------------------------------
+
+                if ( inputHTML.contains( "title=\"\"" ) )
+                {
+                    inputHTML = inputHTML.replace( "title=\"\"",
+                        "title=\"" + dataElement.getId() + "." + dataElement.getName() + " (" + dataElementType
+                            + ")\" " );
+                }
+                else
+                {
+                    inputHTML += "title=\"" + dataElement.getId() + "." + dataElement.getName() + " ("
+                        + dataElementType + ")\" ";
+                }
+
+                // -------------------------------------------------------------
+                // Set field for dataElement
+                // -------------------------------------------------------------
+
+                tabindex++;
+
+                if ( DataElement.VALUE_TYPE_INT.equals( dataElement.getType() )
+                    || DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() )
+                    || DataElement.VALUE_TYPE_USER_NAME.equals( dataElement.getType() ) )
+                {
+                    inputHTML = populateCustomDataEntryForTextBox( dataElement, inputHTML, dataElementValue );
+                }
+                else if ( DataElement.VALUE_TYPE_DATE.equals( dataElement.getType() ) )
+                {
+                    inputHTML = populateCustomDataEntryForDate( inputHTML, dataElementValue );
+                }
+                else if ( DataElement.VALUE_TYPE_TRUE_ONLY.equals( dataElement.getType() ) )
+                {
+                    inputHTML = populateCustomDataEntryForTrueOnly( dataElement, inputHTML, dataElementValue );
+                }
+                else if ( DataElement.VALUE_TYPE_BOOL.equals( dataElement.getType() ) )
+                {
+                    inputHTML = populateCustomDataEntryForBoolean( dataElement, inputHTML, dataElementValue, i18n );
+                }
+
+                // -----------------------------------------------------------
+                // Check if this dataElement is from another programStage then
+                // disable
+                // If programStagsInstance is completed then disabled it
+                // -----------------------------------------------------------
+
+                String disabled = "";
+                if ( programStageId != programStage.getId() )
+                {
+                    disabled = "disabled=\"\"";
+                }
+                else
+                {
+                    if ( DataElement.VALUE_TYPE_DATE.equals( dataElement.getType() ) )
+                    {
+                        inputHTML += jQueryCalendar;
+                    }
+
+                    if ( allowProvidedElsewhere )
+                    {
+                        // Add ProvidedByOtherFacility checkbox
+                        inputHTML = addProvidedElsewherCheckbox( inputHTML, patientDataValue, programStage );
+                    }
+                }
+
+                // -----------------------------------------------------------
+                //
+                // -----------------------------------------------------------
+
+                inputHTML = inputHTML.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
+                inputHTML = inputHTML.replace( "$VALUE", dataElementValue );
+                inputHTML = inputHTML.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
+                inputHTML = inputHTML.replace( "$PROGRAMSTAGENAME", programStageName );
+                inputHTML = inputHTML.replace( "$DATAELEMENTNAME", dataElement.getName() );
+                inputHTML = inputHTML.replace( "$DATAELEMENTTYPE", dataElementType );
+                inputHTML = inputHTML.replace( "$DISABLED", disabled );
+                inputHTML = inputHTML.replace( "$COMPULSORY", compulsory );
+                inputHTML = inputHTML.replace( "$SAVEMODE", "false" );
+                inputHTML = inputHTML.replace( "$TABINDEX", tabindex + "" );
+                inputHTML = inputHTML.replaceAll( "\\$", "\\\\\\$" );
+
+                dataElementMatcher.appendReplacement( sb, inputHTML );
+            }
+        }
+
+        dataElementMatcher.appendTail( sb );
+
+        return populateI18nStrings( sb.toString(), i18n );
+    }
+
     public String prepareDataEntryFormForEdit( String htmlCode )
     {
         // ---------------------------------------------------------------------
@@ -332,7 +514,7 @@
         {
             String inputHTML = inputMatcher.group();
             inputHTML = inputHTML.replace( ">", "" );
-            
+
             // -----------------------------------------------------------------
             // Get HTML input field code
             // -----------------------------------------------------------------
@@ -349,11 +531,11 @@
 
                 int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
                 DataElement dataElement = dataElementService.getDataElement( dataElementId );
-                
+
                 inputHTML = populateCustomDataEntryForTextBox( dataElement, inputHTML );
-                
+
                 inputHTML = inputHTML + ">";
-                
+
                 inputMatcher.appendReplacement( sb, inputHTML );
 
             }
@@ -372,19 +554,21 @@
     {
         if ( dataElement != null )
         {
-            inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, " value=\"[" + dataElement.getDisplayName() +"]\"" )
-                : inputHTML + " value=\"[" + dataElement.getDisplayName() + "]\" ";
+            inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, " value=\"["
+                + dataElement.getDisplayName() + "]\"" ) : inputHTML + " value=\"[" + dataElement.getDisplayName()
+                + "]\" ";
 
-            String displayTitle = dataElement.getId() + " - " + dataElement.getName() + " - " + dataElement.getDetailedNumberType() + " - ";
-            inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, " title=\"" + displayTitle + "\"" )
-                : inputHTML + " title=\"" + displayTitle + "\"";
+            String displayTitle = dataElement.getId() + " - " + dataElement.getName() + " - "
+                + dataElement.getDetailedNumberType() + " - ";
+            inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, " title=\""
+                + displayTitle + "\"" ) : inputHTML + " title=\"" + displayTitle + "\"";
         }
         else
         {
             inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? " value=\"[" + DATA_ELEMENT_DOES_NOT_EXIST + "]\" "
                 : " value=\"[ " + DATA_ELEMENT_DOES_NOT_EXIST + " ]\"";
         }
-        
+
         return inputHTML;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	2012-11-01 15:15:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	2013-02-18 09:50:45 +0000
@@ -29,19 +29,27 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientRegistrationForm;
+import org.hisp.dhis.patient.PatientRegistrationFormService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
 import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramDataEntryService;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
@@ -66,13 +74,6 @@
         this.selectionManager = selectionManager;
     }
 
-    private PatientAttributeService patientAttributeService;
-
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
-    {
-        this.patientAttributeService = patientAttributeService;
-    }
-
     private PatientIdentifierTypeService patientIdentifierTypeService;
 
     public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
@@ -87,6 +88,48 @@
         this.programService = programService;
     }
 
+    private PatientRegistrationFormService patientRegistrationFormService;
+
+    public void setPatientRegistrationFormService( PatientRegistrationFormService patientRegistrationFormService )
+    {
+        this.patientRegistrationFormService = patientRegistrationFormService;
+    }
+
+    private ProgramDataEntryService programDataEntryService;
+
+    public void setProgramDataEntryService( ProgramDataEntryService programDataEntryService )
+    {
+        this.programDataEntryService = programDataEntryService;
+    }
+
+    private PatientAttributeService attributeService;
+
+    public void setAttributeService( PatientAttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private PatientAttributeGroupService attributeGroupService;
+
+    public void setAttributeGroupService( PatientAttributeGroupService attributeGroupService )
+    {
+        this.attributeGroupService = attributeGroupService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -95,8 +138,6 @@
 
     private Collection<PatientAttribute> noGroupAttributes = new HashSet<PatientAttribute>();
 
-    private Map<PatientAttributeGroup, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
-
     private Collection<PatientIdentifierType> identifierTypes;
 
     private OrganisationUnit organisationUnit;
@@ -109,58 +150,76 @@
 
     private Collection<User> healthWorkers;
 
+    private String customRegistrationForm;
+
+    private List<PatientAttributeGroup> attributeGroups;
+
+    private Map<Integer, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<Integer, Collection<PatientAttribute>>();
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
-        Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
-        Collection<Program> programs = programService.getAllPrograms();
-        for ( Program program : programs )
-        {
-            identifierTypes.removeAll( program.getPatientIdentifierTypes() );
-            patientAttributes.removeAll( program.getPatientAttributes() );
-        }
-
-        for ( PatientAttribute patientAttribute : patientAttributes )
-        {
-            PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-            if ( attributeGroup != null )
-            {
-                if ( attributeGroupsMap.containsKey( attributeGroup ) )
-                {
-                    Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                    attributes.add( patientAttribute );
-                }
-                else
-                {
-                    Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-                    attributes.add( patientAttribute );
-                    attributeGroupsMap.put( attributeGroup, attributes );
-                }
-            }
-            else
-            {
-                noGroupAttributes.add( patientAttribute );
-            }
-        }
-
+        // Get health workers
         organisationUnit = selectionManager.getSelectedOrganisationUnit();
+        healthWorkers = organisationUnit.getUsers();
+
+        Program program = programService.getProgram( programId );
+        PatientRegistrationForm patientRegistrationForm = patientRegistrationFormService
+            .getPatientRegistrationForm( program );
+
+        if ( patientRegistrationForm != null )
+        {
+            customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd( patientRegistrationForm
+                .getDataEntryForm().getHtmlCode(), healthWorkers, null, null, i18n, format );
+        }
+
+        if ( customRegistrationForm == null )
+        {
+            identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
+
+            Collection<PatientAttribute> patientAttributesInProgram = new HashSet<PatientAttribute>();
+            Collection<Program> programs = programService.getAllPrograms();
+            programs.remove( program );
+            for ( Program p : programs )
+            {
+                identifierTypes.removeAll( p.getPatientIdentifierTypes() );
+                patientAttributesInProgram.addAll( p.getPatientAttributes() );
+            }
+
+            attributeGroups = new ArrayList<PatientAttributeGroup>(
+                attributeGroupService.getAllPatientAttributeGroups() );
+            Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+            for ( PatientAttributeGroup attributeGroup : attributeGroups )
+            {
+                List<PatientAttribute> attributes = attributeGroupService.getPatientAttributes( attributeGroup );
+                attributes.removeAll( patientAttributesInProgram );
+
+                if ( attributes.size() > 0 )
+                {
+                    attributeGroupsMap.put( attributeGroup.getId(), attributes );
+                }
+            }
+
+            noGroupAttributes = attributeService.getPatientAttributesWithoutGroup();
+            noGroupAttributes.removeAll( patientAttributesInProgram );
+        }
 
         // Get data entry form
-
-        Program program = programService.getProgram( programId );
-
         programStage = program.getProgramStages().iterator().next();
+        if ( programStage.getDataEntryForm() != null )
+        {
+            customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForAdd( programStage
+                .getDataEntryForm().getHtmlCode(), i18n, programStage );
+        }
+        else
+        {
+            programStageDataElements = new ArrayList<ProgramStageDataElement>(
+                programStage.getProgramStageDataElements() );
+        }
 
-        programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
-        
-        // Get health workers
-        
-        healthWorkers = organisationUnit.getUsers();
-       
         return SUCCESS;
     }
 
@@ -173,16 +232,16 @@
         return healthWorkers;
     }
 
+    public String getCustomRegistrationForm()
+    {
+        return customRegistrationForm;
+    }
+
     public Collection<PatientIdentifierType> getIdentifierTypes()
     {
         return identifierTypes;
     }
 
-    public Map<PatientAttributeGroup, Collection<PatientAttribute>> getAttributeGroupsMap()
-    {
-        return attributeGroupsMap;
-    }
-
     public void setProgramId( Integer programId )
     {
         this.programId = programId;
@@ -212,4 +271,14 @@
     {
         return programStageDataElements;
     }
+
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+
+    public Map<Integer, Collection<PatientAttribute>> getAttributeGroupsMap()
+    {
+        return attributeGroupsMap;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-02-18 08:23:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-02-18 09:50:45 +0000
@@ -144,9 +144,8 @@
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="optionService" ref="org.hisp.dhis.option.OptionService" />
 	</bean>
-	
-	<bean
-		id="org.hisp.dhis.caseentry.action.caseentry.GetUsernameListAction"
+
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetUsernameListAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.GetUsernameListAction"
 		scope="prototype">
 		<property name="userService" ref="org.hisp.dhis.user.UserService" />
@@ -201,11 +200,17 @@
 		scope="prototype">
 		<property name="selectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="patientAttributeService"
-			ref="org.hisp.dhis.patient.PatientAttributeService" />
 		<property name="patientIdentifierTypeService"
 			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="patientRegistrationFormService"
+			ref="org.hisp.dhis.patient.PatientRegistrationFormService" />
+		<property name="programDataEntryService"
+			ref="org.hisp.dhis.program.ProgramDataEntryService" />
+		<property name="attributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="attributeGroupService"
+			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.SaveValuesAction"
@@ -284,7 +289,8 @@
 		id="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationFormAction"
 		class="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationFormAction"
 		scope="prototype">
-		<property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+		<property name="aggregationConditionService"
+			ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
 	</bean>
 
 	<bean
@@ -433,8 +439,7 @@
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="patientRegistrationFormService"
 			ref="org.hisp.dhis.patient.PatientRegistrationFormService" />
-		<property name="programInstanceService"
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="attributeGroupService">
 			<ref bean="org.hisp.dhis.patient.PatientAttributeGroupService" />
 		</property>
@@ -1056,8 +1061,7 @@
 			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		<property name="relationshipTypeService"
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
-		<property name="programService"
-			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
 	<!-- Comment -->

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2013-01-23 10:27:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2013-02-18 09:50:45 +0000
@@ -1,3 +1,6 @@
+#if( $customDataEntryFormCode )
+	$customDataEntryFormCode
+#else
 <tbody id="entryForm">
 	<tr>
 		<th colspan='2'>$programStage.program.displayName</th>
@@ -87,7 +90,7 @@
 	#set( $tabIndex = $tabIndex + 1 )
 #end	
 </tbody>
-
+#end
 <script>
 	entryFormContainerOnReady();
 </script>