← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5915: (patient) remove option-combo from patient-data-value.

 

------------------------------------------------------------
revno: 5915
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-02-11 20:58:02 +0700
message:
  (patient) remove option-combo from patient-data-value.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java
  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/dataentryform/DataEntryFormUpgrader.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java
  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/DefaultProgramValidationService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveDateValueAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.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/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetPSDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientimport/ImportPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm
  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/responseAggDataElement.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.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/caseaggregation/CaseAggregationConditionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java	2012-02-11 13:58:02 +0000
@@ -56,9 +56,9 @@
     
     Collection<CaseAggregationCondition> getAllCaseAggregationCondition( );
    
-    CaseAggregationCondition getCaseAggregationCondition( DataElement dataElement, DataElementCategoryOptionCombo optionCombo);
-    
     Collection<CaseAggregationCondition> getCaseAggregationCondition( DataElement dataElement );
+    
+    CaseAggregationCondition getCaseAggregationCondition( DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
 
     
     Double parseConditition( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit, Period period );
@@ -70,9 +70,7 @@
     Collection<ProgramStageInstance> getProgramStageInstances( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit, Period period );
     
     Collection<DataElement> getDataElementsInCondition( String aggregationExpression );
-    
-    Collection<DataElementCategoryOptionCombo> getOptionCombosInCondition( String aggregationExpression );
-    
+        
     Collection<Program> getProgramsInCondition( String aggregationExpression );
     
     Collection<PatientAttribute> getPatientAttributesInCondition( String aggregationExpression );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStore.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStore.java	2012-02-11 13:58:02 +0000
@@ -43,10 +43,10 @@
     extends GenericStore<CaseAggregationCondition>
 {
     String ID = CaseAggregationConditionStore.class.getName();
-
-    CaseAggregationCondition get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo);
    
     Collection<CaseAggregationCondition> get( DataElement dataElement );
+
+    CaseAggregationCondition get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
     
     List<Integer> executeSQL( String sql );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java	2011-05-05 21:14:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java	2012-02-11 13:58:02 +0000
@@ -30,7 +30,6 @@
 import java.util.Date;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.ProgramStageInstance;
 
@@ -48,8 +47,6 @@
 
     private DataElement dataElement;
 
-    private DataElementCategoryOptionCombo optionCombo;
-
     private ProgramStageInstance programStageInstance;
 
     private OrganisationUnit organisationUnit;
@@ -69,42 +66,38 @@
     }
 
     public PatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit )
+        OrganisationUnit organisationUnit )
     {
         this.programStageInstance = programStageInstance;
         this.dataElement = dataElement;
-        this.optionCombo = optionCombo;
         this.organisationUnit = organisationUnit;
     }
 
     public PatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit, Date timeStamp )
+        OrganisationUnit organisationUnit, Date timeStamp )
     {
         this.programStageInstance = programStageInstance;
         this.dataElement = dataElement;
-        this.optionCombo = optionCombo;
         this.organisationUnit = organisationUnit;
         this.timestamp = timeStamp;
     }
 
     public PatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit, Date timeStamp, String value )
+        OrganisationUnit organisationUnit, Date timeStamp, String value )
     {
         this.programStageInstance = programStageInstance;
         this.dataElement = dataElement;
-        this.optionCombo = optionCombo;
         this.organisationUnit = organisationUnit;
         this.timestamp = timeStamp;
         this.value = value;
     }
 
     public PatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit, Date timeStamp, String value,
+        OrganisationUnit organisationUnit, Date timeStamp, String value,
         boolean providedByAnotherFacility )
     {
         this.programStageInstance = programStageInstance;
         this.dataElement = dataElement;
-        this.optionCombo = optionCombo;
         this.organisationUnit = organisationUnit;
         this.timestamp = timeStamp;
         this.value = value;
@@ -121,7 +114,6 @@
         final int prime = 31;
         int result = 1;
         result = prime * result + ((dataElement == null) ? 0 : dataElement.hashCode());
-        result = prime * result + ((optionCombo == null) ? 0 : optionCombo.hashCode());
         result = prime * result + ((organisationUnit == null) ? 0 : organisationUnit.hashCode());
         result = prime * result + ((programStageInstance == null) ? 0 : programStageInstance.hashCode());
         return result;
@@ -144,13 +136,6 @@
         }
         else if ( !dataElement.equals( other.dataElement ) )
             return false;
-        if ( optionCombo == null )
-        {
-            if ( other.optionCombo != null )
-                return false;
-        }
-        else if ( !optionCombo.equals( other.optionCombo ) )
-            return false;
         if ( organisationUnit == null )
         {
             if ( other.organisationUnit != null )
@@ -192,16 +177,6 @@
         return dataElement;
     }
 
-    public void setOptionCombo( DataElementCategoryOptionCombo optionCombo )
-    {
-        this.optionCombo = optionCombo;
-    }
-
-    public DataElementCategoryOptionCombo getOptionCombo()
-    {
-        return optionCombo;
-    }
-
     public Date getTimestamp()
     {
         return timestamp;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java	2012-02-11 13:58:02 +0000
@@ -31,7 +31,6 @@
 import java.util.Date;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -54,14 +53,9 @@
 
     int deletePatientDataValue( DataElement dataElement );
 
-    int deletePatientDataValue( DataElementCategoryOptionCombo optionCombo );
-
     PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
         OrganisationUnit organisationUnit );
 
-    PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit );
-
     Collection<PatientDataValue> getPatientDataValues( ProgramStageInstance programStageInstance );
     
     Collection<PatientDataValue> getPatientDataValues( ProgramStageInstance programStageInstance, Collection<DataElement> dataElement );
@@ -70,11 +64,6 @@
 
     Collection<PatientDataValue> getPatientDataValues( DataElement dataElement );
 
-    Collection<PatientDataValue> getPatientDataValues( DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo );
-
-    Collection<PatientDataValue> getPatientDataValues( DataElementCategoryOptionCombo optionCombo );
-
     Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit );
 
     Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit,
@@ -85,9 +74,6 @@
 
     Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit, DataElement dataElement );
 
-    Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit,
-        DataElementCategoryOptionCombo optionCombo );
-
     Collection<PatientDataValue> getPatientDataValues( boolean providedByAnotherFacility );
 
     Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit,

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java	2012-02-11 13:58:02 +0000
@@ -32,7 +32,6 @@
 
 import org.hisp.dhis.common.GenericStore;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -52,14 +51,9 @@
 
     int delete( DataElement dataElement );
 
-    int delete( DataElementCategoryOptionCombo optionCombo );
-
     PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement,
         OrganisationUnit organisationUnit );
     
-    PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit );
-
     Collection<PatientDataValue> get( ProgramStageInstance programStageInstance );
     
     Collection<PatientDataValue> get( ProgramStageInstance programStageInstance, Collection<DataElement> dataElements );
@@ -68,10 +62,6 @@
 
     Collection<PatientDataValue> get( DataElement dataElement );
 
-    Collection<PatientDataValue> get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
-
-    Collection<PatientDataValue> get( DataElementCategoryOptionCombo optionCombo );
-
     Collection<PatientDataValue> get( OrganisationUnit organisationUnit );
 
     Collection<PatientDataValue> get( OrganisationUnit organisationUnit,
@@ -82,8 +72,6 @@
 
     Collection<PatientDataValue> get( OrganisationUnit organisationUnit, DataElement dataElement );
 
-    Collection<PatientDataValue> get( OrganisationUnit organisationUnit, DataElementCategoryOptionCombo optionCombo );
-
     Collection<PatientDataValue> get( boolean providedByAnotherFacility );
 
     Collection<PatientDataValue> get( OrganisationUnit organisationUnit, boolean providedByAnotherFacility );

=== 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	2011-07-18 07:54:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java	2012-02-11 13:58:02 +0000
@@ -43,8 +43,7 @@
 {
     final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
     
-    final Pattern IDENTIFIER_PATTERN_TEXTBOX = Pattern.compile( "id=\"(\\d+)-(\\d+)-(\\d+)-val\"" );
-    final Pattern IDENTIFIER_PATTERN_OTHERS = Pattern.compile( "id=\"(\\d+)-(\\d+)-val\"" );
+    final Pattern IDENTIFIER_PATTERN_FIELD = Pattern.compile( "id=\"(\\d+)-(\\d+)-val\"" );
     
     //--------------------------------------------------------------------------
     // ProgramDataEntryService

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java	2011-07-20 03:42:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java	2012-02-11 13:58:02 +0000
@@ -32,6 +32,8 @@
 
     private final Pattern ID_PROGRAM_ENTRY_DATE = Pattern
         .compile( "id=\"value\\[(\\d+)\\].date:value\\[(\\d+)\\].date\"" );
+    
+    private final Pattern IDENTIFIER_PATTERN_TEXTBOX = Pattern.compile( "id=\"(\\d+)-(\\d+)-(\\d+)-val\"" );
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -65,6 +67,8 @@
             customForm = upgradeProgramDataEntryFormForDate( customForm );
 
             customForm = upgradeProgramDataEntryFormForOption( customForm );
+            
+            customForm = upgradeProgramDataEntryForm( customForm );
 
             programDataEntryForm.setHtmlCode( customForm );
 
@@ -164,4 +168,22 @@
 
         return out.toString().replaceAll( "view=\"@@deshortname@@\"", "" );
     }
+    
+    private String upgradeProgramDataEntryForm( String htmlCode )
+    {
+        Matcher matcher = IDENTIFIER_PATTERN_TEXTBOX.matcher( htmlCode );
+
+        StringBuffer out = new StringBuffer();
+
+        while ( matcher.find() )
+        {
+            String upgradedId = "id=\"" + matcher.group( 1 ) + "-" + matcher.group( 2 ) + "-val\"";
+
+            matcher.appendReplacement( out, upgradedId );
+        }
+
+        matcher.appendTail( out );
+        
+        return out.toString();
+    }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java	2012-01-28 18:52:50 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java	2012-02-11 13:58:02 +0000
@@ -521,6 +521,6 @@
         assertEquals( 10.0, aggregatedOrgUnitDataValueService.getAggregatedIndicatorValue( indicatorA, periodA, unitD, groupA ) );
         assertEquals( 22.1, aggregatedOrgUnitDataValueService.getAggregatedIndicatorValue( indicatorA, periodA, unitD, groupB ) );        
         assertEquals( 51.3, aggregatedOrgUnitDataValueService.getAggregatedIndicatorValue( indicatorA, periodD, unitD, groupA ) );        
-        assertEquals( 482.6, aggregatedOrgUnitDataValueService.getAggregatedIndicatorValue( indicatorA, periodD, unitD, groupB ) );
+        assertEquals( 480.6, aggregatedOrgUnitDataValueService.getAggregatedIndicatorValue( indicatorA, periodD, unitD, groupB ) );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2011-11-04 11:27:33 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-02-11 13:58:02 +0000
@@ -53,8 +53,6 @@
 import org.hisp.dhis.api.mobile.model.Task;
 import org.hisp.dhis.api.mobile.model.comparator.ActivityComparator;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttributeService;
@@ -97,8 +95,6 @@
 
     private PatientAttributeService patientAttService;
 
-    private DataElementCategoryService categoryService;
-
     private PatientDataValueService dataValueService;
 
     private PatientMobileSettingService patientMobileSettingService;
@@ -253,8 +249,7 @@
         programStageInstance.setCompleted( true );
         programStageInstanceService.updateProgramStageInstance( programStageInstance );
         // Everything is fine, hence save
-        saveDataValues( activityValue, programStageInstance, dataElementMap, unit,
-            categoryService.getDefaultDataElementCategoryOptionCombo() );
+        saveDataValues( activityValue, programStageInstance, dataElementMap, unit );
 
     }
 
@@ -394,17 +389,15 @@
     }
 
     private void saveDataValues( ActivityValue activityValue, ProgramStageInstance programStageInstance,
-        Map<Integer, DataElement> dataElementMap, OrganisationUnit orgUnit, DataElementCategoryOptionCombo optionCombo )
+        Map<Integer, DataElement> dataElementMap, OrganisationUnit orgUnit )
     {
-
         org.hisp.dhis.dataelement.DataElement dataElement;
         String value;
 
         for ( DataValue dv : activityValue.getDataValues() )
         {
             value = dv.getValue();
-            DataElementCategoryOptionCombo cateOptCombo = categoryService.getDataElementCategoryOptionCombo( dv
-                .getCategoryOptComboID() );
+
             if ( value != null && value.trim().length() == 0 )
             {
                 value = null;
@@ -429,7 +422,7 @@
                         programStageInstanceService.updateProgramStageInstance( programStageInstance );
                     }
 
-                    dataValue = new PatientDataValue( programStageInstance, dataElement, cateOptCombo, orgUnit,
+                    dataValue = new PatientDataValue( programStageInstance, dataElement, orgUnit,
                         new Date(), value, false );
 
                     dataValueService.savePatientDataValue( dataValue );
@@ -444,7 +437,6 @@
                 }
 
                 dataValue.setValue( value );
-                dataValue.setOptionCombo( optionCombo );
                 dataValue.setProvidedByAnotherFacility( false );
                 dataValue.setTimestamp( new Date() );
 
@@ -475,12 +467,6 @@
     }
 
     @Required
-    public void setCategoryService( org.hisp.dhis.dataelement.DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    @Required
     public void setDataValueService( org.hisp.dhis.patientdatavalue.PatientDataValueService dataValueService )
     {
         this.dataValueService = dataValueService;

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-01-05 20:39:23 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-02-11 13:58:02 +0000
@@ -21,7 +21,6 @@
     <property name="patientAttValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
     <property name="patientAttService" ref="org.hisp.dhis.patient.PatientAttributeService" />
     <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-    <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="dataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
     <property name="patientMobileSettingService" ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
     <property name="activityPlanService" ref="org.hisp.dhis.activityplan.ActivityPlanService" />

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java	2011-11-03 02:20:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java	2012-02-11 13:58:02 +0000
@@ -31,7 +31,6 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -104,16 +103,6 @@
             {
                 return ERROR;
             }
-            
-            Collection<DataElementCategoryOptionCombo> optionCombos = aggregationConditionService
-                .getOptionCombosInCondition( condition.getAggregationExpression() );
-
-            optionCombos.retainAll( categoryCombo.getOptionCombos() );
-
-            if ( optionCombos != null && optionCombos.size() > 0 )
-            {
-                return ERROR;
-            }
         }
 
         return null;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-02-10 08:00:11 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-02-11 13:58:02 +0000
@@ -33,8 +33,8 @@
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_PROPERTY;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_PROPERTY;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT;
-import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OPERATOR_AND;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_ID;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_OBJECT;
@@ -48,7 +48,6 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
@@ -104,8 +103,6 @@
 
     private ProgramStageService programStageService;
 
-    private DataElementCategoryService categoryService;
-
     private ProgramService programService;
 
     private PatientAttributeService patientAttributeService;
@@ -140,12 +137,7 @@
     {
         this.programStageService = programStageService;
     }
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
+    
     public void setDataElementService( DataElementService dataElementService )
     {
         this.dataElementService = dataElementService;
@@ -197,17 +189,16 @@
     }
 
     @Override
-    public CaseAggregationCondition getCaseAggregationCondition( DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo )
-    {
-        return aggregationConditionStore.get( dataElement, optionCombo );
-    }
-
-    @Override
     public Collection<CaseAggregationCondition> getCaseAggregationCondition( DataElement dataElement )
     {
         return aggregationConditionStore.get( dataElement );
     }
+    
+    @Override
+    public CaseAggregationCondition getCaseAggregationCondition( DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
+    {
+        return aggregationConditionStore.get( dataElement, optionCombo );
+    }
 
     @Override
     public Double parseConditition( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit,
@@ -332,17 +323,13 @@
                 int dataElementId = Integer.parseInt( ids[1] );
                 DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
-                int categoryOptionId = Integer.parseInt( ids[2] );
-                DataElementCategoryOptionCombo optionCombo = categoryService
-                    .getDataElementCategoryOptionCombo( categoryOptionId );
-
-                if ( programStage == null || dataElement == null || optionCombo == null )
+                if ( programStage == null || dataElement == null )
                 {
                     return INVALID_CONDITION;
                 }
 
                 matcher.appendReplacement( description, "[" + programStage.getName() + SEPARATOR_ID
-                    + dataElement.getName() + optionCombo.getName() + "]" );
+                    + dataElement.getName() + "]" );
             }
             else
             {
@@ -436,40 +423,7 @@
         return dataElements;
     }
 
-    @Override
-    public Collection<DataElementCategoryOptionCombo> getOptionCombosInCondition( String aggregationExpression )
-    {
-        String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "[0-9]+" + SEPARATOR_ID
-            + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + "\\]";
-
-        Collection<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
-
-        // ---------------------------------------------------------------------
-        // parse expressions
-        // ---------------------------------------------------------------------
-
-        Pattern pattern = Pattern.compile( regExp );
-
-        Matcher matcher = pattern.matcher( aggregationExpression );
-
-        while ( matcher.find() )
-        {
-            String match = matcher.group();
-            match = match.replaceAll( "[\\[\\]]", "" );
-
-            String[] info = match.split( SEPARATOR_OBJECT );
-            String[] ids = info[1].split( SEPARATOR_ID );
-
-            int optionComboId = Integer.parseInt( ids[2] );
-            DataElementCategoryOptionCombo optionCombo = categoryService
-                .getDataElementCategoryOptionCombo( optionComboId );
-
-            optionCombos.add( optionCombo );
-        }
-
-        return optionCombos;
-    }
-    
+   
     public Collection<Program> getProgramsInCondition( String aggregationExpression )
     {
         String regExp = "\\[" + OBJECT_PROGRAM + SEPARATOR_OBJECT + "[0-9]+\\]";
@@ -646,20 +600,19 @@
 
                     int programStageId = Integer.parseInt( ids[0] );
                     int dataElementId = Integer.parseInt( ids[1] );
-                    int optionComboId = Integer.parseInt( ids[2] );
 
                     String valueToCompare = expression[i].replace( "[" + match + "]", "" ).trim();
 
                     if ( valueToCompare.equalsIgnoreCase( IS_NULL ) )
                     {
                         condition = getConditionForNotDataElement( programStageId, operator, dataElementId,
-                            optionComboId, orgunitId, startDate, endDate );
+                            orgunitId, startDate, endDate );
 
                         expression[i] = expression[i].replace( valueToCompare, "" );
                     }
                     else
                     {
-                        condition = getConditionForDataElement( programStageId, operator, dataElementId, optionComboId,
+                        condition = getConditionForDataElement( programStageId, operator, dataElementId, 
                             orgunitId, startDate, endDate );
                         if ( !expression[i].contains( "+" ) )
                         {
@@ -727,7 +680,7 @@
     }
 
     private String getConditionForNotDataElement( int programStageId, String operator, int dataElementId,
-        int optionComboId, int orgunitId, String startDate, String endDate )
+       int orgunitId, String startDate, String endDate )
     {
         String sql = "SELECT distinct(pi.patientid) ";
         String condition = "pi.patientid";
@@ -750,14 +703,14 @@
             + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
             + "WHERE pd.organisationunitid = " + orgunitId + " AND ps.programstageid = " + programStageId + " "
             + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
-            + "AND pd.dataelementid = " + dataElementId + " " + "AND pd.categoryoptioncomboid = " + optionComboId
+            + "AND pd.dataelementid = " + dataElementId + " "
             + "  ) ";
         
         return sql;
     }
 
     private String getConditionForDataElement( int programStageId, String operator, int dataElementId,
-        int optionComboId, int orgunitId, String startDate, String endDate )
+        int orgunitId, String startDate, String endDate )
     {
         String sql = "SELECT distinct(pi.patientid) ";
         
@@ -771,7 +724,7 @@
             + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
             + "INNER JOIN programstage_dataelements as psd ON ps.programstageid = psd.programstageid " 
             + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pd.categoryoptioncomboid = " + optionComboId + " AND psd.dataelementid = " + dataElementId + " "
+            + "WHERE psd.dataelementid = " + dataElementId + " "
             + "AND pd.organisationunitid = " + orgunitId + " AND ps.programstageid = " + programStageId + " "
             + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' ";
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java	2012-02-11 13:58:02 +0000
@@ -104,13 +104,6 @@
         }
     }
 
-    @Override
-    public CaseAggregationCondition get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
-    {
-        return (CaseAggregationCondition) getCriteria( Restrictions.eq( "aggregationDataElement", dataElement ),
-            Restrictions.eq( "optionCombo", optionCombo ) ).uniqueResult();
-    }
-
     @SuppressWarnings( "unchecked" )
     @Override
     public Collection<CaseAggregationCondition> get( DataElement dataElement )
@@ -118,4 +111,12 @@
         return getCriteria( Restrictions.eq( "aggregationDataElement", dataElement ) )
             .list();
     }
+    
+    @Override
+    public CaseAggregationCondition get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
+    {
+        return (CaseAggregationCondition)getCriteria( Restrictions.eq( "aggregationDataElement", dataElement ),
+            Restrictions.eq( "optionCombo", optionCombo ))
+            .uniqueResult();
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-01-15 02:14:29 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-02-11 13:58:02 +0000
@@ -63,12 +63,12 @@
     }
 
     private DataElementCategoryService categoryService;
-
+    
     public void setCategoryService( DataElementCategoryService categoryService )
     {
         this.categoryService = categoryService;
     }
-
+    
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -121,6 +121,9 @@
         executeSql( "UPDATE programvalidation SET dateType = false WHERE dateType is null");
         
         executeSql( "UPDATE programstage_dataelements SET showOnReport = false WHERE showOnReport is null");
+        
+        int categoryOptionId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
+        executeSql( "UPDATE dataelement SET categoryoptioncomboid = " + categoryOptionId + " WHERE domain='patient'");
     }
 
     // -------------------------------------------------------------------------
@@ -165,8 +168,6 @@
     {
         StatementHolder holder = statementManager.getHolder();
 
-        int optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
-
         try
         {
             Statement statement = holder.getStatement();
@@ -192,10 +193,8 @@
                 while ( resultSet.next() )
                 {
                     max++;
-                    String leftSide = "[" + resultSet.getString( 2 ) + "." + resultSet.getString( 3 ) + "."
-                        + optionCombo + "]";
-                    String rightSide = "[" + resultSet.getString( 4 ) + "." + resultSet.getString( 5 ) + "."
-                        + optionCombo + "]";
+                    String leftSide = "[" + resultSet.getString( 2 ) + "." + resultSet.getString( 3 ) + "." + "]";
+                    String rightSide = "[" + resultSet.getString( 4 ) + "." + resultSet.getString( 5 ) + "." + "]";
                     String operator = resultSet.getInt( 6 ) > 0 ? ">" : (resultSet.getInt( 6 ) < 0) ? "<" : "==";
 
                     String fomular = leftSide + operator + rightSide;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java	2011-12-07 02:20:11 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java	2012-02-11 13:58:02 +0000
@@ -32,7 +32,6 @@
 import org.hibernate.Query;
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttribute;
@@ -115,13 +114,6 @@
             Restrictions.ilike( "value", "%" + searchText + "%" ) ).list();
     }
 
-    public int delete( DataElementCategoryOptionCombo optionCombo )
-    {
-        Query query = getQuery( "delete from PatientDataValue where optionCombo = :optionCombo" );
-        query.setEntity( "optionCombo", optionCombo );
-        return query.executeUpdate();
-    }
-
     public int countByPatientAttributeoption( PatientAttributeOption attributeOption )
     {
         Number rs = (Number) getCriteria( Restrictions.eq( "patientAttributeOption", attributeOption ) ).setProjection(

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java	2012-02-11 13:58:02 +0000
@@ -31,7 +31,6 @@
 import java.util.Date;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -83,11 +82,6 @@
         return patientDataValueStore.delete( dataElement );
     }
 
-    public int deletePatientDataValue( DataElementCategoryOptionCombo optionCombo )
-    {
-        return patientDataValueStore.delete( optionCombo );
-    }
-
     public void updatePatientDataValue( PatientDataValue patientDataValue )
     {
         if ( patientDataValue.getValue() == null )
@@ -110,12 +104,6 @@
     {
         return patientDataValueStore.get( programStageInstance, dataElement, organisationUnit );
     }
-    
-    public PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit )
-    {
-        return patientDataValueStore.get( programStageInstance, dataElement, optionCombo, organisationUnit );
-    }
 
     public Collection<PatientDataValue> getPatientDataValues( ProgramStageInstance programStageInstance )
     {
@@ -137,17 +125,6 @@
         return patientDataValueStore.get( dataElement );
     }
 
-    public Collection<PatientDataValue> getPatientDataValues( DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo )
-    {
-        return patientDataValueStore.get( dataElement, optionCombo );
-    }
-
-    public Collection<PatientDataValue> getPatientDataValues( DataElementCategoryOptionCombo optionCombo )
-    {
-        return patientDataValueStore.get( optionCombo );
-    }
-
     public Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit )
     {
         return patientDataValueStore.get( organisationUnit );
@@ -170,12 +147,6 @@
         return patientDataValueStore.get( organisationUnit, dataElement );
     }
 
-    public Collection<PatientDataValue> getPatientDataValues( OrganisationUnit organisationUnit,
-        DataElementCategoryOptionCombo optionCombo )
-    {
-        return patientDataValueStore.get( organisationUnit, optionCombo );
-    }
-
     public Collection<PatientDataValue> getPatientDataValues( boolean providedByAnotherFacility )
     {
         return patientDataValueStore.get( providedByAnotherFacility );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java	2012-02-11 13:58:02 +0000
@@ -84,7 +84,7 @@
         Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
     }
 
-    private void aggregate( DataElement dataElement, Collection<Integer> categoryOptionCombos, Period period,
+    private void aggregate( DataElement dataElement, Period period,
         Collection<Integer> patients )
     {
         // ---------------------------------------------------------------------
@@ -104,19 +104,6 @@
             + "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() ) + " " + "AND datetime <= "
             + DateUtils.getMediumDateString( period.getEndDate() ) + " " + "AND patientid IN ("
             + TextUtils.getCommaDelimitedString( patients ) + ") " + "AND value='T'";
-
-        // ---------------------------------------------------------------------
-        // count - int
-        // ---------------------------------------------------------------------
-
-        for ( Integer categoryOptionComboId : categoryOptionCombos )
-        {
-            sql = "SELECT count( * ) " + "FROM patientdatavalue " + "WHERE dataelementid = '" + dataElement.getId()
-                + "' " + "AND categoryoptioncomboid = '" + categoryOptionComboId + " " + "AND datetime > '"
-                + DateUtils.getMediumDateString( period.getStartDate() ) + " " + "AND datetime <= "
-                + DateUtils.getMediumDateString( period.getEndDate() ) + " " + "AND patientid IN ("
-                + TextUtils.getCommaDelimitedString( patients ) + ")";
-        }
     }
 
     private Collection<Period> filterPeriods( Collection<Period> periods, PeriodType periodType )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java	2012-02-11 13:58:02 +0000
@@ -34,14 +34,12 @@
 import org.hibernate.Query;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 import org.hisp.dhis.patientdatavalue.PatientDataValueStore;
 import org.hisp.dhis.program.ProgramStageInstance;
-
 /**
  * @author Abyot Asalefew Gizaw
  * @version $Id$
@@ -69,13 +67,6 @@
         return query.executeUpdate();
     }
 
-    public int delete( DataElementCategoryOptionCombo optionCombo )
-    {
-        Query query = getQuery( "delete from PatientDataValue where optionCombo = :optionCombo" );
-        query.setEntity( "optionCombo", optionCombo );
-        return query.executeUpdate();
-    }
-
     public PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement,
         OrganisationUnit organisationUnit )
     {
@@ -84,14 +75,6 @@
             .uniqueResult();
     }
 
-    public PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement,
-        DataElementCategoryOptionCombo optionCombo, OrganisationUnit organisationUnit )
-    {
-        return (PatientDataValue) getCriteria( Restrictions.eq( "programStageInstance", programStageInstance ),
-            Restrictions.eq( "dataElement", dataElement ), Restrictions.eq( "optionCombo", optionCombo ),
-            Restrictions.eq( "organisationUnit", organisationUnit ) ).uniqueResult();
-    }
-
     @SuppressWarnings( "unchecked" )
     public Collection<PatientDataValue> get( ProgramStageInstance programStageInstance )
     {
@@ -127,19 +110,6 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<PatientDataValue> get( DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
-    {
-        return getCriteria( Restrictions.eq( "dataElement", dataElement ), Restrictions.eq( "optionCombo", optionCombo ) )
-            .list();
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public Collection<PatientDataValue> get( DataElementCategoryOptionCombo optionCombo )
-    {
-        return getCriteria( Restrictions.eq( "optionCombo", optionCombo ) ).list();
-    }
-
-    @SuppressWarnings( "unchecked" )
     public Collection<PatientDataValue> get( OrganisationUnit organisationUnit )
     {
         return getCriteria( Restrictions.eq( "organisationUnit", organisationUnit ) ).list();
@@ -169,14 +139,6 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<PatientDataValue> get( OrganisationUnit organisationUnit,
-        DataElementCategoryOptionCombo optionCombo )
-    {
-        return getCriteria( Restrictions.eq( "organisationUnit", organisationUnit ),
-            Restrictions.eq( "optionCombo", optionCombo ) ).list();
-    }
-
-    @SuppressWarnings( "unchecked" )
     public Collection<PatientDataValue> get( boolean providedByAnotherFacility )
     {
         return getCriteria( Restrictions.eq( "providedByAnotherFacility", providedByAnotherFacility ) ).list();

=== 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-02-06 02:56:02 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-02-11 13:58:02 +0000
@@ -35,8 +35,6 @@
 
 import org.apache.commons.lang.BooleanUtils;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -104,13 +102,6 @@
         this.programStageDataElementService = programStageDataElementService;
     }
 
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -182,7 +173,7 @@
             String inputHTML = inputMatcher.group();
             inputHTML = inputHTML.replace( ">", "" );
 
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_TEXTBOX.matcher( dataElementCode );
+            Matcher identifierMatcher = ProgramDataEntryService.IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -194,20 +185,14 @@
                 int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
                 DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
-                int optionComboId = Integer.parseInt( identifierMatcher.group( 3 ) );
-                DataElementCategoryOptionCombo optionCombo = categoryService
-                    .getDataElementCategoryOptionCombo( optionComboId );
-
-                String displayValue = (dataElement == null || optionCombo == null) ? " value=\""
-                    + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " value=\"[ " + dataElement.getName() + " "
-                    + optionCombo.getName() + " ]\"";
+                String displayValue = (dataElement == null ) ? " value=\""
+                    + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " value=\"[ " + dataElement.getName() + " ]\"";
                 inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
                     : inputHTML + " " + displayValue;
 
-                String displayTitle = (dataElement == null || optionCombo == null) ? " title=\""
-                    + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " title=\"" + dataElement.getId() + "."
-                    + dataElement.getName() + "-" + optionComboId + "." + optionCombo.getName() + "-"
-                    + dataElement.getDetailedNumberType() + "\" ";
+                String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" "
+                    : " title=\"" + dataElement.getId() + "." + dataElement.getName() + "-"
+                        + dataElement.getDetailedNumberType() + "\" ";
                 inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
                     : inputHTML + " " + displayTitle;
 
@@ -251,7 +236,7 @@
 
             String dataElementCode = inputMatcher.group( 1 );
 
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_OTHERS.matcher( dataElementCode );
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -319,7 +304,7 @@
 
             String dataElementCode = inputMatcher.group( 1 );
 
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_OTHERS.matcher( dataElementCode );
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -391,7 +376,7 @@
 
             String compulsory = "null";
             String dataElementCode = dataElementMatcher.group( 1 );
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_OTHERS.matcher( dataElementCode );
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
                 // -------------------------------------------------------------
@@ -598,7 +583,7 @@
         // Inline Javascript to add to HTML before outputting
         // ---------------------------------------------------------------------
 
-        final String jsCodeForInputs = " $DISABLED onchange=\"saveVal( $DATAELEMENTID, $OPTIONCOMBOID )\" data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE', provided:'$PROVIDED'}\" onkeypress=\"return keyPress(event, this)\" style=\" text-align:center;\"  ";
+        final String jsCodeForInputs = " $DISABLED onchange=\"saveVal( $DATAELEMENTID )\" data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE', provided:'$PROVIDED'}\" onkeypress=\"return keyPress(event, this)\" style=\" text-align:center;\"  ";
 
         StringBuffer sb = new StringBuffer();
 
@@ -624,7 +609,7 @@
             String compulsory = "null";
             String dataElementCode = dataElementMatcher.group( 1 );
 
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_TEXTBOX.matcher( dataElementCode );
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -636,8 +621,6 @@
 
                 int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
 
-                int optionComboId = Integer.parseInt( identifierMatcher.group( 3 ) );
-
                 DataElement dataElement = null;
 
                 String programStageName = programStage.getName();
@@ -667,6 +650,7 @@
                     continue;
                 }
 
+
                 if ( !DataElement.VALUE_TYPE_INT.equals( dataElement.getType() )
                     && !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
                 {
@@ -700,13 +684,13 @@
                         mapDataValue.put( programStageId, patientDataValues );
                     }
 
-                    patientDataValue = getValue( patientDataValues, dataElementId, optionComboId );
+                    patientDataValue = getValue( patientDataValues, dataElementId );
 
                     dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
                 }
                 else
                 {
-                    patientDataValue = getValue( dataValues, dataElementId, optionComboId );
+                    patientDataValue = getValue( dataValues, dataElementId );
 
                     dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
                 }
@@ -715,30 +699,26 @@
                 // Insert title information - Data element id, name, type, min,
                 // max
                 // -------------------------------------------------------------
-                
-                DataElementCategoryOptionCombo optionCombo = categoryService
-                    .getDataElementCategoryOptionCombo( optionComboId );
 
                 if ( dataElementCode.contains( "title=\"\"" ) )
                 {
                     dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"" + dataElement.getId() + "."
-                        + dataElement.getName() + "-" + optionComboId + optionCombo.getName() + "-" + dataElementType
-                        + "\" " );
+                        + dataElement.getName() + " (" + dataElementType + ")\" " );
                 }
                 else
                 {
-                    dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + "-"
-                        + optionComboId + optionCombo.getName() + "-" + dataElementType + "\" ";
+                    dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + " (" + dataElementType + ")\" ";
                 }
 
                 // -------------------------------------------------------------
                 // Insert value of data element in output code
                 // -------------------------------------------------------------
+
                 String appendCode = dataElementCode;
-
+                
                 if ( dataElement.getOptionSet() != null )
                 {
-                    appendCode = appendCode.replaceFirst( "input", "select" );
+                    appendCode = appendCode.replaceFirst( "input", "select options='true'" );
                     appendCode = appendCode.replace( "name=\"entryfield\"", jsCodeForInputs );
 
                     appendCode += ">";
@@ -817,7 +797,6 @@
                 appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
                 appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
                 appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
-                appendCode = appendCode.replace( "$OPTIONCOMBOID", String.valueOf( optionComboId ) );
                 appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
                 appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
                 appendCode = appendCode.replace( "$DISABLED", disabled );
@@ -879,7 +858,7 @@
             String compulsory = "null";
             String dataElementCode = dataElementMatcher.group( 1 );
 
-            Matcher identifierMatcher = IDENTIFIER_PATTERN_OTHERS.matcher( dataElementCode );
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -1064,28 +1043,6 @@
 
     /**
      * Returns the value of the PatientDataValue in the Collection of DataValues
-     * with the given data element identifier and category option combo id.
-     */
-    private PatientDataValue getValue( Collection<PatientDataValue> dataValues, int dataElementId,
-        int categoryOptionComboId )
-    {
-        for ( PatientDataValue dataValue : dataValues )
-        {
-            if ( dataValue.getOptionCombo() != null )
-            {
-                if ( dataValue.getDataElement().getId() == dataElementId
-                    && dataValue.getOptionCombo().getId() == categoryOptionComboId )
-                {
-                    return dataValue;
-                }
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns the value of the PatientDataValue in the Collection of DataValues
      * with the given data element identifier.
      */
     private PatientDataValue getValue( Collection<PatientDataValue> dataValues, int dataElementId )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-01-15 14:53:46 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-02-11 13:58:02 +0000
@@ -27,18 +27,18 @@
 
 package org.hisp.dhis.program;
 
-import static org.hisp.dhis.program.ProgramValidation.OBJECT_PROGRAM_STAGE_DATAELEMENT;
-import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_ID;
-import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_OBJECT;
-import static org.hisp.dhis.program.ProgramValidation.BEFORE_CURRENT_DATE;
-import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_CURRENT_DATE;
 import static org.hisp.dhis.program.ProgramValidation.AFTER_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_DUE_DATE;
 import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_CURRENT_DATE;
 import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_CURRENT_DATE;
 import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_DUE_DATE;
-import static org.hisp.dhis.program.ProgramValidation.AFTER_DUE_DATE;
-import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_DUE_DATE;
-import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS;
+import static org.hisp.dhis.program.ProgramValidation.OBJECT_PROGRAM_STAGE_DATAELEMENT;
+import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_ID;
+import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_OBJECT;
 
 import java.util.Collection;
 import java.util.Date;
@@ -48,8 +48,6 @@
 import java.util.regex.Pattern;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -77,8 +75,6 @@
 
     private PatientDataValueService valueService;
 
-    private DataElementCategoryService categoryService;
-
     // -------------------------------------------------------------------------
     // Setters
     // -------------------------------------------------------------------------
@@ -88,11 +84,6 @@
         this.validationStore = validationStore;
     }
 
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
     public void setProgramStageService( ProgramStageService programStageService )
     {
         this.programStageService = programStageService;
@@ -356,11 +347,7 @@
         int dataElementId = Integer.parseInt( ids[1] );
         DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
-        int optionComboId = Integer.parseInt( ids[2] );
-        DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
-
-        PatientDataValue dataValue = valueService.getPatientDataValue( programStageInstance, dataElement, optionCombo,
-            orgunit );
+        PatientDataValue dataValue = valueService.getPatientDataValue( programStageInstance, dataElement, orgunit );
 
         return dataValue;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2012-02-11 13:58:02 +0000
@@ -156,8 +156,6 @@
 		</property>
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 	</bean>
 	
 	<bean id="org.hisp.dhis.activityplan.ActivityPlanService"
@@ -181,7 +179,6 @@
         <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />     	
         <property name="dataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
         <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />     	
-        <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
         <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
         <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" /> 
         <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />      	     	
@@ -233,8 +230,6 @@
 			ref="org.hisp.dhis.program.ProgramStageService" />
 		<property name="dataElementService"
 			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		<property name="valueService"
 			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 	</bean>

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml	2012-02-08 08:57:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientdatavalue/hibernate/PatientDataValue.hbm.xml	2012-02-11 13:58:02 +0000
@@ -11,9 +11,7 @@
         column="programstageinstanceid" foreign-key="fk_patientdatavalue_programstageinstanceid" />
       <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
         foreign-key="fk_patientdatavalue_dataelementid" />
-      <key-many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="categoryoptioncomboid"
-      	foreign-key="fk_patientdatavalue_categoryoptioncomboid" />
-      <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit"
+       <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit"
         column="organisationunitid" foreign-key="fk_patientdatavalue_organisationunitid" />
     </composite-id>
     

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/PatientDataValueStoreTest.java	2012-02-11 13:58:02 +0000
@@ -29,7 +29,6 @@
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -55,9 +54,7 @@
     
     private Patient patientA;
     private Patient patientB;
-    
-    private DataElementCategoryOptionCombo categoryOptionCombo;
-    
+        
     private PatientDataValue valueA;
     private PatientDataValue valueB;
     private PatientDataValue valueC;    
@@ -92,9 +89,7 @@
         
         patientService.savePatient( patientA );
         patientService.savePatient( patientB );
-        
-        categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-        
+                
         //TODO Add values
     }
     

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngineTest.java	2012-02-11 13:58:02 +0000
@@ -29,7 +29,6 @@
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -62,8 +61,6 @@
     private Patient patientA;
     private Patient patientB;
     
-    private DataElementCategoryOptionCombo categoryOptionCombo;
-    
     private PatientDataValue valueA;
     private PatientDataValue valueB;
     private PatientDataValue valueC;    
@@ -101,7 +98,6 @@
         patientService.savePatient( patientA );
         patientService.savePatient( patientB );
         
-        categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
     }
     
     @Test

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-02-09 04:47:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-02-11 13:58:02 +0000
@@ -88,7 +88,7 @@
 
     private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
 
-    private Map<String, PatientDataValue> patientDataValueMap;
+    private Map<Integer, PatientDataValue> patientDataValueMap;
 
     private OrganisationUnit organisationUnit;
 
@@ -158,7 +158,7 @@
         return programStageDataElements;
     }
 
-    public Map<String, PatientDataValue> getPatientDataValueMap()
+    public Map<Integer, PatientDataValue> getPatientDataValueMap()
     {
         return patientDataValueMap;
     }
@@ -206,11 +206,11 @@
                 Collection<PatientDataValue> patientDataValues = patientDataValueService
                     .getPatientDataValues( programStageInstance );
 
-                patientDataValueMap = new HashMap<String, PatientDataValue>( patientDataValues.size() );
+                patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
 
                 for ( PatientDataValue patientDataValue : patientDataValues )
                 {
-                    String key = patientDataValue.getDataElement().getId() + "-" + patientDataValue.getOptionCombo().getId();
+                    int key = patientDataValue.getDataElement().getId() ;
                     patientDataValueMap.put( key, patientDataValue );
                 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java	2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java	2012-02-11 13:58:02 +0000
@@ -165,9 +165,9 @@
         return dataElements;
     }
     
-    private Map<String, PatientDataValue> patientDataValueMap;
+    private Map<Integer, PatientDataValue> patientDataValueMap;
 
-    public Map<String, PatientDataValue> getPatientDataValueMap()
+    public Map<Integer, PatientDataValue> getPatientDataValueMap()
     {
         return patientDataValueMap;
     }
@@ -260,11 +260,11 @@
         Collection<PatientDataValue> patientDataValues = patientDataValueService
             .getPatientDataValues( programStageInstance );
 
-        patientDataValueMap = new HashMap<String, PatientDataValue>( patientDataValues.size() );
+        patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
 
         for ( PatientDataValue patientDataValue : patientDataValues )
         {
-            String key = patientDataValue.getDataElement().getId()+"-" + patientDataValue.getOptionCombo().getId();
+            int key = patientDataValue.getDataElement().getId() ;
             patientDataValueMap.put( key, patientDataValue );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveDateValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveDateValueAction.java	2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveDateValueAction.java	2012-02-11 13:58:02 +0000
@@ -32,7 +32,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
@@ -149,8 +148,6 @@
 
         DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
-        DataElementCategoryOptionCombo optionCombo = dataElement.getCategoryCombo().getOptionCombos().iterator().next();
-
         PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance,
             dataElement, organisationUnit );
 
@@ -173,7 +170,7 @@
         {
             LOG.debug( "Adding PatientDataValue, value added" );
 
-            patientDataValue = new PatientDataValue( programStageInstance, dataElement, optionCombo, organisationUnit,
+            patientDataValue = new PatientDataValue( programStageInstance, dataElement, organisationUnit,
                 new Date(), value, providedByAnotherFacility );
 
             patientDataValueService.savePatientDataValue( patientDataValue );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-02-08 08:57:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-02-11 13:58:02 +0000
@@ -33,8 +33,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
@@ -78,14 +76,7 @@
     {
         this.patientDataValueService = patientDataValueService;
     }
-
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
+    
     private SelectedStateManager selectedStateManager;
 
     public void setSelectedStateManager( SelectedStateManager selectedStateManager )
@@ -163,12 +154,8 @@
 
         DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
-        DataElementCategoryOptionCombo optionCombo = null;
-
-        optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( optionComboId );
-
         PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance,
-            dataElement, optionCombo, organisationUnit );
+            dataElement, organisationUnit );
         
         if ( programStageInstance.getExecutionDate() == null )
         {
@@ -180,7 +167,7 @@
         {
             LOG.debug( "Adding PatientDataValue, value added" );
 
-            patientDataValue = new PatientDataValue( programStageInstance, dataElement, optionCombo, organisationUnit,
+            patientDataValue = new PatientDataValue( programStageInstance, dataElement, organisationUnit,
                 new Date(), value, providedByAnotherFacility );
 
             patientDataValueService.savePatientDataValue( patientDataValue );
@@ -190,7 +177,6 @@
             LOG.debug( "Updating PatientDataValue, value added/changed" );
 
             patientDataValue.setValue( value );
-            patientDataValue.setOptionCombo( optionCombo );
             patientDataValue.setProvidedByAnotherFacility( providedByAnotherFacility );
             patientDataValue.setTimestamp( new Date() );
 

=== removed directory 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen'
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java	1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.caseentry.screen;
-
-import java.util.Collection;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageInstance;
-
-/**
- * @author Abyot Asalefew
- * @version $Id$
- */
-public interface DataEntryScreenManager
-{
-    String getScreenType( ProgramStage programStage );
-
-    boolean hasMixOfDimensions( ProgramStage programStage );
-
-    boolean hasMultiDimensionalDataElement( ProgramStage programStage );
-
-    String populateCustomDataEntryScreenForMultiDimensional( String dataEntryFormCode,
-        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
-        ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit );
-
-    Collection<ProgramStageDataElement> getProgramStageDataElements( String htmlCode );
-}

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	1970-01-01 00:00:00 +0000
@@ -1,1285 +0,0 @@
-package org.hisp.dhis.caseentry.screen;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang.BooleanUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageDataElementService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.program.ProgramStageService;
-
-/**
- * @author Viet Nguyen
- */
-public class DefaultDataEntryScreenManager
-    implements DataEntryScreenManager
-{
-    private static final Log log = LogFactory.getLog( DefaultDataEntryScreenManager.class );
-
-    private static final String DEFAULT_FORM = "defaultform";
-
-    private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform";
-
-    private static final String EMPTY = "";
-
-    private static final String UNKNOW_CLINIC = "unknow_clinic";
-
-    private static final String NOTAVAILABLE = "not_available";
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private PatientDataValueService patientDataValueService;
-
-    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
-    {
-        this.patientDataValueService = patientDataValueService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private ProgramStageInstanceService programStageInstanceService;
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
-    private ProgramStageService programStageService;
-
-    public void setProgramStageService( ProgramStageService programStageService )
-    {
-        this.programStageService = programStageService;
-    }
-
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation methods
-    // -------------------------------------------------------------------------
-
-    public boolean hasMixOfDimensions( ProgramStage programStage )
-    {
-        Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-        if ( dataElements.size() > 0 )
-        {
-            Iterator<DataElement> dataElementIterator = dataElements.iterator();
-
-            DataElementCategoryCombo catCombo = dataElementIterator.next().getCategoryCombo();
-
-            for ( DataElement de : dataElements )
-            {
-                if ( catCombo != de.getCategoryCombo() )
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    public boolean hasMultiDimensionalDataElement( ProgramStage programStage )
-    {
-        Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
-        for ( DataElement element : dataElements )
-        {
-            if ( element.isMultiDimensional() )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    public String getScreenType( ProgramStage dataSet )
-    {
-        return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM;
-    }
-
-    public String populateCustomDataEntryScreenForMultiDimensional( String dataEntryFormCode,
-        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
-        ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit )
-    {
-        Map<Integer, Collection<PatientDataValue>> mapDataValue = new HashMap<Integer, Collection<PatientDataValue>>();
-
-        String result = "";
-
-        result = populateCustomDataEntryForTextBox( dataEntryFormCode, dataValues, disabled, i18n,
-            programStage, programStageInstance, organisationUnit, mapDataValue );
-
-        result = populateCustomDataEntryForBoolean( result, dataValues, disabled, i18n,
-            programStage, programStageInstance, organisationUnit, mapDataValue );
-
-        result = populateCustomDataEntryForMutiDimentionalString( result, dataValues,
-            disabled, i18n, programStage, programStageInstance, organisationUnit, mapDataValue );
-
-        result = populateCustomDataEntryForDate( result, dataValues, disabled, i18n,
-            programStage, programStageInstance, organisationUnit, mapDataValue );
-
-        result = populateI18nStrings( result, i18n );
-
-        return result;
-    }
-
-    private String populateCustomDataEntryForTextBox( String dataEntryFormCode,
-        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
-        OrganisationUnit organisationUnit, Map<Integer, Collection<PatientDataValue>> mapDataValue )
-    {
-        // ---------------------------------------------------------------------
-        // Inline Javascript to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String jsCodeForInputs = " $DISABLED onchange=\"saveValueCustom( this )\" data=\"{compulsory:$COMPULSORY, optionComboId:$OPTIONCOMBOID, dataElementId:$DATAELEMENTID, dataElementName:'$DATAELEMENTNAME', dataElementType:'$DATAELEMENTTYPE', programStageId:$PROGRAMSTAGEID, programStageName: '$PROGRAMSTAGENAME', orgUnitName:'$ORGUNITNAME'}\"  onkeypress=\"return keyPress(event, this)\"   ";
-
-        // ---------------------------------------------------------------------
-        // Metadata code to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        StringBuffer sb = new StringBuffer();
-
-        // ---------------------------------------------------------------------
-        // Pattern to match data elements in the HTML code
-        // ---------------------------------------------------------------------
-
-        Pattern dataElementPattern = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
-        Matcher dataElementMatcher = dataElementPattern.matcher( dataEntryFormCode );
-
-        // ---------------------------------------------------------------------
-        // Pattern to extract data element ID from data element field
-        // ---------------------------------------------------------------------
-
-        Pattern identifierPattern = Pattern
-            .compile( "\"value\\[([\\p{Digit}.]*)\\].value:value\\[([\\p{Digit}.]*)\\].value:value\\[([\\p{Digit}.]*)\\].value\"" );
-
-        // ---------------------------------------------------------------------
-        // Iterate through all matching data element fields
-        // ---------------------------------------------------------------------
-
-        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
-
-        while ( dataElementMatcher.find() )
-        {
-            // -----------------------------------------------------------------
-            // Get HTML input field code
-            // -----------------------------------------------------------------
-
-            String compulsory = "null";
-            String dataElementCode = dataElementMatcher.group( 1 );
-
-            Matcher identifierMatcher = identifierPattern.matcher( dataElementCode );
-
-            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 ) );
-
-                int optionComboId = Integer.parseInt( identifierMatcher.group( 3 ) );
-
-                DataElement dataElement = null;
-
-                String programStageName = programStage.getName();
-
-                if ( programStageId != programStage.getId() )
-                {
-                    dataElement = dataElementService.getDataElement( dataElementId );
-
-                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                    programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
-
-                }
-                else
-                {
-                    dataElement = dataElementMap.get( dataElementId );
-                    if ( dataElement == null )
-                    {
-                        return i18n.getString( "program_stage_lack_data_elements" );
-                    }
-
-                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
-                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
-                }
-
-                if ( dataElement == null )
-                {
-                    continue;
-                }
-                if ( !DataElement.VALUE_TYPE_INT.equals( dataElement.getType() )
-                    && !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
-                {
-                    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;
-
-                if ( programStageId != programStage.getId() )
-                {
-                    Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
-
-                    if ( patientDataValues == null )
-                    {
-                        ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                        ProgramStageInstance otherProgramStageInstance = programStageInstanceService
-                            .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
-                        patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
-                        mapDataValue.put( programStageId, patientDataValues );
-                    }
-
-                    patientDataValue = getValue( patientDataValues, dataElementId, optionComboId );
-
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-                else
-                {
-                    patientDataValue = getValue( dataValues, dataElementId );
-
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-
-                // -------------------------------------------------------------
-                // Insert value of data element in output code
-                // -------------------------------------------------------------
-
-                if ( dataElementCode.contains( "value=\"\"" ) )
-                {
-                    dataElementCode = dataElementCode.replace( "value=\"\"", "value=\"" + dataElementValue + "\"" );
-                }
-                else
-                {
-                    dataElementCode += "value=\"" + dataElementValue + "\"";
-                }
-
-                // -------------------------------------------------------------
-                // Remove placeholder view attribute from input field
-                // -------------------------------------------------------------
-
-                dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
-
-                // -------------------------------------------------------------
-                // Append Javascript code and meta data (type/min/max) for
-                // persisting to output code, and insert value and type for
-                // fields
-                // -------------------------------------------------------------
-
-                String appendCode = dataElementCode;
-
-                appendCode += jsCodeForInputs;
-
-                appendCode += " />";
-
-                // -----------------------------------------------------------
-                // Check if this dataElement is from another programStage then
-                // disable
-                // If programStagsInstance is completed then disabled it
-                // -----------------------------------------------------------
-
-                disabled = "";
-                if ( programStageId == programStage.getId() && !programStageInstance.isCompleted() )
-                {
-                    // -----------------------------------------------------------
-                    // Add ProvidedByOtherFacility checkbox
-                    // -----------------------------------------------------------
-
-                    appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
-
-                }
-                else
-                {
-                    disabled = "disabled=\"\"";
-                }
-
-                // -----------------------------------------------------------
-                // 
-                // -----------------------------------------------------------
-
-                String orgUnitName = i18n.getString( NOTAVAILABLE );
-                if ( patientDataValue != null )
-                {
-                    if ( patientDataValue.isProvidedByAnotherFacility() )
-                    {
-                        orgUnitName = i18n.getString( UNKNOW_CLINIC );
-                    }
-                    else
-                    {
-                        orgUnitName = patientDataValue.getOrganisationUnit().getName();
-                    }
-                }
-
-                appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
-                appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
-                appendCode = appendCode.replace( "$OPTIONCOMBOID", String.valueOf( optionComboId ) );
-                appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
-                appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
-                appendCode = appendCode.replace( "$DISABLED", disabled );
-                appendCode = appendCode.replace( "$COMPULSORY", compulsory );
-                appendCode = appendCode.replace( "$SAVEMODE", "false" );
-
-                dataElementMatcher.appendReplacement( sb, appendCode );
-            }
-        }
-
-        dataElementMatcher.appendTail( sb );
-
-        return sb.toString();
-    }
-
-    private String populateCustomDataEntryForBoolean( String dataEntryFormCode,
-        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
-        ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
-        Map<Integer, Collection<PatientDataValue>> mapDataValue )
-    {
-
-        // ---------------------------------------------------------------------
-        // Inline Javascript to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String jsCodeForBoolean = " name=\"entryselect\" data=\"{compulsory:$COMPULSORY, dataElementId:$DATAELEMENTID, dataElementName:'$DATAELEMENTNAME', dataElementType:'$DATAELEMENTTYPE', programStageId:$PROGRAMSTAGEID, programStageName: '$PROGRAMSTAGENAME', orgUnitName:'$ORGUNITNAME'}\" $DISABLED onchange=\"saveChoiceCustom( $PROGRAMSTAGEID, $DATAELEMENTID,this)\"";
-
-        // ---------------------------------------------------------------------
-        // Metadata code to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String metaDataCode = "<span id=\"value[$DATAELEMENTID].name\" style=\"display:none\">$DATAELEMENTNAME</span>"
-            + "<span id=\"value[$DATAELEMENTID].type\" style=\"display:none\">$DATAELEMENTTYPE</span>";
-        StringBuffer sb = new StringBuffer();
-
-        // ---------------------------------------------------------------------
-        // Pattern to match data elements in the HTML code
-        // ---------------------------------------------------------------------
-
-        Pattern dataElementPattern = Pattern.compile( "(<select.*?)[/]?</select>", Pattern.DOTALL );
-        Matcher dataElementMatcher = dataElementPattern.matcher( dataEntryFormCode );
-
-        // ---------------------------------------------------------------------
-        // Pattern to extract data element ID from data element field
-        // ---------------------------------------------------------------------
-
-        Pattern identifierPattern = Pattern.compile( "value\\[(.*)\\].boolean:value\\[(.*)\\].boolean" );
-
-        // ---------------------------------------------------------------------
-        // Iterate through all matching data element fields
-        // ---------------------------------------------------------------------
-
-        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
-
-        while ( dataElementMatcher.find() )
-        {
-            // -----------------------------------------------------------------
-            // Get HTML input field code
-            // -----------------------------------------------------------------
-
-            String compulsory = "null";
-            String dataElementCode = dataElementMatcher.group( 1 );
-            Matcher identifierMatcher = identifierPattern.matcher( dataElementCode );
-            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.getName();
-
-                if ( programStageId != programStage.getId() )
-                {
-                    dataElement = dataElementService.getDataElement( dataElementId );
-
-                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                    programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
-                }
-                else
-                {
-                    dataElement = dataElementMap.get( dataElementId );
-                    if ( dataElement == null )
-                    {
-                        return i18n.getString( "program_stage_lack_data_elements" );
-                    }
-
-                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
-                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
-                }
-
-                if ( dataElement == null )
-                {
-                    continue;
-                }
-
-                if ( !DataElement.VALUE_TYPE_BOOL.equals( dataElement.getType() ) )
-                {
-                    continue;
-                }
-                // -------------------------------------------------------------
-                // Find type of data element
-                // -------------------------------------------------------------
-
-                String dataElementType = dataElement.getType();
-
-                // -------------------------------------------------------------
-                // Find existing value of data element in data set
-                // -------------------------------------------------------------
-
-                PatientDataValue patientDataValue = null;
-
-                String dataElementValue = EMPTY;
-
-                if ( programStageId != programStage.getId() )
-                {
-                    Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
-
-                    if ( patientDataValues == null )
-                    {
-                        ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                        ProgramStageInstance otherProgramStageInstance = programStageInstanceService
-                            .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
-                        patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
-                        mapDataValue.put( programStageId, patientDataValues );
-                    }
-
-                    patientDataValue = getValue( patientDataValues, dataElementId );
-
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-                else
-                {
-
-                    patientDataValue = getValue( dataValues, dataElementId );
-                    
-                    if ( patientDataValue != null )
-                    {
-                        dataElementValue = patientDataValue.getValue();
-                    }
-                }
-
-                String appendCode = dataElementCode;
-                appendCode = appendCode.replace( "name=\"entryselect\"", jsCodeForBoolean );
-
-                // -------------------------------------------------------------
-                // Insert value of data element in output code
-                // -------------------------------------------------------------
-
-                if ( patientDataValue != null )
-                {
-
-                    if ( dataElementValue.equalsIgnoreCase( "true" ) )
-                    {
-                        appendCode = appendCode.replace( "<option value=\"true\">", "<option value=\""
-                            + i18n.getString( "true" ) + "\" selected>" );
-                    }
-
-                    if ( dataElementValue.equalsIgnoreCase( "false" ) )
-                    {
-                        appendCode = appendCode.replace( "<option value=\"false\">", "<option value=\""
-                            + i18n.getString( "false" ) + "\" selected>" );
-                    }
-
-                }
-
-                appendCode += "</select>";
-
-                // -------------------------------------------------------------
-                // Remove placeholder view attribute from input field
-                // -------------------------------------------------------------
-
-                dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
-
-                // -------------------------------------------------------------
-                // Insert title information - Data element id, name, type, min,
-                // max
-                // -------------------------------------------------------------
-
-                if ( dataElementCode.contains( "title=\"\"" ) )
-                {
-                    dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"-- ID:" + dataElement.getId()
-                        + " Name:" + dataElement.getShortName() + " Type:" + dataElement.getType() + "\"" );
-                }
-                else
-                {
-                    dataElementCode += "title=\"-- ID:" + dataElement.getId() + " Name:" + dataElement.getShortName()
-                        + " Type:" + dataElement.getType() + "\"";
-                }
-
-                // -------------------------------------------------------------
-                // Append Javascript code and meta data (type/min/max) for
-                // persisting to output code, and insert value and type for
-                // fields
-                // -------------------------------------------------------------
-
-                appendCode += metaDataCode;
-
-                // -----------------------------------------------------------
-                // Check if this dataElement is from another programStage then
-                // disable
-                // If programStagsInstance is completed then disabled it
-                // -----------------------------------------------------------
-
-                disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
-                {
-                    disabled = "disabled";
-                }
-                else
-                {
-                    // -----------------------------------------------------------
-                    // Add ProvidedByOtherFacility checkbox
-                    // -----------------------------------------------------------
-                    appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
-                }
-
-                // -----------------------------------------------------------
-                // 
-                // -----------------------------------------------------------
-                
-                String orgUnitName = i18n.getString( NOTAVAILABLE );
-                if ( patientDataValue != null )
-                {
-                    if ( patientDataValue.isProvidedByAnotherFacility() )
-                    {
-                        orgUnitName = i18n.getString( UNKNOW_CLINIC );
-                    }
-                    else
-                    {
-                        orgUnitName = patientDataValue.getOrganisationUnit().getName();
-                    }
-                }
-
-                appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
-                appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
-                appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
-                appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
-                appendCode = appendCode.replace( "$DISABLED", disabled );
-                appendCode = appendCode.replace( "$COMPULSORY", compulsory );
-                appendCode = appendCode.replace( "i18n_yes", i18n.getString( "yes" ) );
-                appendCode = appendCode.replace( "i18n_no", i18n.getString( "no" ) );
-                appendCode = appendCode.replace( "i18n_select_value", i18n.getString( "select_value" ) );
-                appendCode = appendCode.replace( "$SAVEMODE", "false" );
-
-                appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
-
-                dataElementMatcher.appendReplacement( sb, appendCode );
-            }
-        }
-
-        dataElementMatcher.appendTail( sb );
-
-        return sb.toString();
-    }
-
-    private String populateCustomDataEntryForMutiDimentionalString( String dataEntryFormCode,
-        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
-        ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
-        Map<Integer, Collection<PatientDataValue>> mapDataValue )
-    {
-
-        // ---------------------------------------------------------------------
-        // Inline Javascript to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String jsCodeForCombo = " name=\"entryselect\" $DISABLED data=\"{compulsory:$COMPULSORY, dataElementId:$DATAELEMENTID, dataElementName:'$DATAELEMENTNAME', dataElementType:'$DATAELEMENTTYPE', programStageId:$PROGRAMSTAGEID, programStageName: '$PROGRAMSTAGENAME', orgUnitName:'$ORGUNITNAME'}\" onchange=\"saveChoiceCustom( $PROGRAMSTAGEID, $DATAELEMENTID,this)\"";
-        
-        // ---------------------------------------------------------------------
-        // Metadata code to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String metaDataCode = "<span id=\"value[$DATAELEMENTID].name\" style=\"display:none\">$DATAELEMENTNAME</span>"
-            + "<span id=\"value[$DATAELEMENTID].type\" style=\"display:none\">$DATAELEMENTTYPE</span>";
-        StringBuffer sb = new StringBuffer();
-
-        // ---------------------------------------------------------------------
-        // Pattern to match data elements in the HTML code
-        // ---------------------------------------------------------------------
-
-        Pattern dataElementPattern = Pattern.compile( "(<select.*?)[/]?</select>", Pattern.DOTALL );
-        Matcher dataElementMatcher = dataElementPattern.matcher( dataEntryFormCode );
-
-        // ---------------------------------------------------------------------
-        // Pattern to extract data element ID from data element field
-        // ---------------------------------------------------------------------
-
-        Pattern identifierPattern = Pattern
-            .compile( "\"value\\[([\\p{Digit}.]*)\\].combo:value\\[([\\p{Digit}.]*)\\].combo\"" );
-
-        // ---------------------------------------------------------------------
-        // Iterate through all matching data element fields
-        // ---------------------------------------------------------------------
-
-        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
-
-        while ( dataElementMatcher.find() )
-        {
-            // -----------------------------------------------------------------
-            // Get HTML input field code
-            // -----------------------------------------------------------------
-
-            String dataElementCode = dataElementMatcher.group( 1 );
-            
-            Matcher identifierMatcher = identifierPattern.matcher( dataElementCode );
-
-            String compulsory = "null";
-
-            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.getName();
-
-                if ( programStageId != programStage.getId() )
-                {
-                    dataElement = dataElementService.getDataElement( dataElementId );
-
-                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                    programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
-                }
-                else
-                {
-                    dataElement = dataElementMap.get( dataElementId );
-                    if ( dataElement == null )
-                    {
-                        return i18n.getString( "program_stage_lack_data_elements" );
-                    }
-
-                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
-                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
-                }
-
-                if ( dataElement == null )
-                {
-                    continue;
-                }
-                if ( !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
-                {
-                    continue;
-                }
-                
-                // -------------------------------------------------------------
-                // Find type of data element
-                // -------------------------------------------------------------
-
-                String dataElementType = dataElement.getType();
-
-                // -------------------------------------------------------------
-                // Find existing value of data element in data set
-                // -------------------------------------------------------------
-                
-                PatientDataValue patientDataValue = null;
-                String dataElementValue = EMPTY;
-                if ( programStageId != programStage.getId() )
-                {
-                    Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
-
-                    if ( patientDataValues == null )
-                    {
-                        ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                        ProgramStageInstance otherProgramStageInstance = programStageInstanceService
-                            .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
-                        patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
-                        mapDataValue.put( programStageId, patientDataValues );
-                    }
-
-                    patientDataValue = getValue( patientDataValues, dataElementId );
-                    
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-                else
-                {
-                    patientDataValue = getValue( dataValues, dataElementId );
-
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-
-                String appendCode = dataElementCode;
-                appendCode = appendCode.replace( "name=\"entryselect\"", jsCodeForCombo );
-                
-                // -------------------------------------------------------------
-                // Insert value of data element in output code
-                // -------------------------------------------------------------
-                
-                if ( patientDataValue != null )
-                {
-                   appendCode = appendCode.replace( "id=\"combo[" + patientDataValue.getOptionCombo().getId()
-                        + "].combo\"", "id=\"combo[" + patientDataValue.getOptionCombo().getId()
-                        + "].combo\" selected=\"selected\"" );
-                }
-
-                appendCode += "</select>";
-                
-                // -------------------------------------------------------------
-                // Remove placeholder view attribute from input field
-                // -------------------------------------------------------------
-
-                dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
-
-                // -------------------------------------------------------------
-                // Insert title information - Data element id, name, type, min,
-                // max
-                // -------------------------------------------------------------
-
-                if ( dataElementCode.contains( "title=\"\"" ) )
-                {
-                    dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"-- ID:" + dataElement.getId()
-                        + " Name:" + dataElement.getShortName() + " Type:" + dataElement.getType() + "\"" );
-                }
-                else
-                {
-                    dataElementCode += "title=\"-- ID:" + dataElement.getId() + " Name:" + dataElement.getShortName()
-                        + " Type:" + dataElement.getType() + "\"";
-                }
-
-                // -------------------------------------------------------------
-                // Append Javascript code and meta data (type/min/max) for
-                // persisting to output code, and insert value and type for
-                // fields
-                // -------------------------------------------------------------
-
-                appendCode += metaDataCode;
-
-                // -----------------------------------------------------------
-                // Check if this dataElement is from another programStage then
-                // disable
-                // If programStagsInstance is completed then disabled it
-                // -----------------------------------------------------------
-               
-                disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
-                {
-                    disabled = "disabled";
-                }
-                else
-                {
-                    // -----------------------------------------------------------
-                    // Add ProvidedByOtherFacility checkbox
-                    // -----------------------------------------------------------
-                   
-                    appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
-                }
-
-                // -----------------------------------------------------------
-                // 
-                // -----------------------------------------------------------
-                
-                String orgUnitName = i18n.getString( NOTAVAILABLE );
-                if ( patientDataValue != null )
-                {
-                    if ( patientDataValue.isProvidedByAnotherFacility() )
-                    {
-                        orgUnitName = i18n.getString( UNKNOW_CLINIC );
-                    }
-                    else
-                    {
-                        orgUnitName = patientDataValue.getOrganisationUnit().getName();
-                    }
-                }
-
-                appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
-                appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
-                appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
-                appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
-                appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
-                appendCode = appendCode.replace( "$DISABLED", disabled );
-                appendCode = appendCode.replace( "$COMPULSORY", compulsory );
-                appendCode = appendCode.replace( "i18n_select_value", i18n.getString( "select_value" ) );
-                appendCode = appendCode.replace( "$SAVEMODE", "false" );
-                appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
-
-                dataElementMatcher.appendReplacement( sb, appendCode );
-            }
-        }
-
-        dataElementMatcher.appendTail( sb );
-
-        return sb.toString();
-    }
-
-    private String populateCustomDataEntryForDate( String dataEntryFormCode, Collection<PatientDataValue> dataValues,
-        String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
-        OrganisationUnit organisationUnit, Map<Integer, Collection<PatientDataValue>> mapDataValue )
-    {
-
-        // ---------------------------------------------------------------------
-        // Inline Javascript to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String jsCodeForDate = " name=\"entryfield\" $DISABLED onchange=\"saveDateCustom( this )\" data=\"{compulsory:$COMPULSORY, dataElementId:$DATAELEMENTID, dataElementName:'$DATAELEMENTNAME', dataElementType:'$DATAELEMENTTYPE', programStageId:$PROGRAMSTAGEID, programStageName: '$PROGRAMSTAGENAME', orgUnitName:'$ORGUNITNAME'}\"";
-       
-        // ---------------------------------------------------------------------
-        // Metadata code to add to HTML before outputting
-        // ---------------------------------------------------------------------
-
-        final String jQueryCalendar = "<script> "
-            + "datePicker(\"value\\\\\\\\[$PROGRAMSTAGEID\\\\\\\\]\\\\\\\\.date\\\\\\\\:value\\\\\\\\[$DATAELEMENTID\\\\\\\\]\\\\\\\\.date\", false)"
-            + ";</script>";
-
-        final String metaDataCode = "<span id=\"value[$DATAELEMENTID].name\" style=\"display:none\">$DATAELEMENTNAME</span>"
-            + "<span id=\"value[$DATAELEMENTID].type\" style=\"display:none\">$DATAELEMENTTYPE</span>";
-        StringBuffer sb = new StringBuffer();
-
-        // ---------------------------------------------------------------------
-        // Pattern to match data elements in the HTML code
-        // ---------------------------------------------------------------------
-
-        Pattern dataElementPattern = Pattern.compile( "(<input.*?)[/]?/>" );
-        Matcher dataElementMatcher = dataElementPattern.matcher( dataEntryFormCode );
-
-        // ---------------------------------------------------------------------
-        // Pattern to extract data element ID from data element field
-        // ---------------------------------------------------------------------
-
-        Pattern identifierPattern = Pattern
-            .compile( "id=\"value\\[([\\p{Digit}.]*)\\].date:value\\[([\\p{Digit}.]*)\\].date\"" );
-
-        // ---------------------------------------------------------------------
-        // Iterate through all matching data element fields
-        // ---------------------------------------------------------------------
-
-        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStageInstance.getProgramStage() );
-
-        while ( dataElementMatcher.find() )
-        {
-            // -----------------------------------------------------------------
-            // Get HTML input field code
-            // -----------------------------------------------------------------
-            
-            String compulsory = "null";
-            String dataElementCode = dataElementMatcher.group( 1 );
-           
-            Matcher identifierMatcher = identifierPattern.matcher( dataElementCode );
-
-            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.getName();
-
-                if ( programStageId != programStage.getId() )
-                {
-                    dataElement = dataElementService.getDataElement( dataElementId );
-
-                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                    programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
-                }
-                else
-                {
-                    dataElement = dataElementMap.get( dataElementId );
-                    if ( dataElement == null )
-                    {
-                        return i18n.getString( "program_stage_lack_data_elements" );
-                    }
-
-                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
-                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
-                }
-
-                if ( dataElement == null )
-                {
-                    continue;
-                }
-                if ( !DataElement.VALUE_TYPE_DATE.equals( dataElement.getType() ) )
-                {
-                    continue;
-                }
-                // -------------------------------------------------------------
-                // Find type of data element
-                // -------------------------------------------------------------
-
-                String dataElementType = dataElement.getType();
-
-                // -------------------------------------------------------------
-                // Find existing value of data element in data set
-                // -------------------------------------------------------------
-
-                PatientDataValue patientDataValue = null;
-                String dataElementValue = EMPTY;
-
-                if ( programStageId != programStage.getId() )
-                {
-                    Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
-
-                    if ( patientDataValues == null )
-                    {
-                        ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
-                        ProgramStageInstance otherProgramStageInstance = programStageInstanceService
-                            .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
-                        patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
-                        mapDataValue.put( programStageId, patientDataValues );
-                    }
-
-                    patientDataValue = getValue( patientDataValues, dataElementId );
-                    
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-                else
-                {
-                    patientDataValue = getValue( dataValues, dataElementId );
-
-                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
-                }
-
-                // -------------------------------------------------------------
-                // Insert value of data element in output code
-                // -------------------------------------------------------------
-
-                if ( dataElementCode.contains( "value=\"\"" ) )
-                {
-                    dataElementCode = dataElementCode.replace( "value=\"\"", "value=\"" + dataElementValue + "\"" );
-                }
-                else
-                {
-                    dataElementCode += "value=\"" + dataElementValue + "\"";
-                }
-
-                // -------------------------------------------------------------
-                // Remove placeholder view attribute from input field
-                // -------------------------------------------------------------
-
-                dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
-                
-                // -------------------------------------------------------------
-                // Append Javascript code and meta data (type/min/max) for
-                // persisting to output code, and insert value and type for
-                // fields
-                // -------------------------------------------------------------
-
-                String appendCode = dataElementCode + "/>";
-                appendCode = appendCode.replace( "name=\"entryfield\"", jsCodeForDate );
-                
-                appendCode += metaDataCode;
-
-                // -------------------------------------------------------------
-                // Check if this dataElement is from another programStage then
-                // disable
-                // If programStagsInstance is completed then disabled it
-                // -------------------------------------------------------------
-                
-                disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
-                {
-                    disabled = "disabled=\"\"";
-                }
-                else
-                {
-                    appendCode += jQueryCalendar;
-
-                    // ---------------------------------------------------------
-                    // Add ProvidedByOtherFacility checkbox
-                    // ---------------------------------------------------------
-                    
-                    appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
-
-                }
-
-                // -------------------------------------------------------------
-                // Get Org Unit name
-                // -------------------------------------------------------------
-                
-                String orgUnitName = i18n.getString( NOTAVAILABLE );
-                if ( patientDataValue != null )
-                {
-                    if ( patientDataValue.isProvidedByAnotherFacility() )
-                    {
-                        orgUnitName = i18n.getString( UNKNOW_CLINIC );
-                    }
-                    else
-                    {
-                        orgUnitName = patientDataValue.getOrganisationUnit().getName();
-                    }
-                }
-
-                appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
-
-                appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
-
-                appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
-
-                appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
-
-                appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
-
-                appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
-
-                appendCode = appendCode.replace( "$DISABLED", disabled );
-
-                appendCode = appendCode.replace( "$COMPULSORY", compulsory );
-
-                appendCode = appendCode.replace( "$SAVEMODE", "false" );
-
-                appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
-
-                dataElementMatcher.appendReplacement( sb, appendCode );
-            }
-        }
-
-        dataElementMatcher.appendTail( sb );
-
-        return sb.toString();
-    }
-
-    @Override
-    public Collection<ProgramStageDataElement> getProgramStageDataElements( String htmlCode )
-    {
-        Set<ProgramStageDataElement> result = new HashSet<ProgramStageDataElement>();
-
-        Pattern identifierPattern = Pattern
-            .compile( "id=\"value\\[([\\p{Digit}.]*)\\].(value|boolean|combo|date):value\\[([\\p{Digit}.]*)\\].(value|boolean|combo|date)\"" );
-
-        Matcher matcher = identifierPattern.matcher( htmlCode );
-
-        while ( matcher.find() )
-        {
-            String replaceString = matcher.group();
-            replaceString = replaceString.replaceAll( "[\\\"\\=\\.\\[\\]]|value|date|id|combo|boolean", "" );
-
-            Integer programStageId = Integer.parseInt( replaceString.split( ":" )[0] );
-            Integer dataElementId = Integer.parseInt( replaceString.split( ":" )[1] );
-
-            ProgramStage programStage = programStageService.getProgramStage( programStageId );
-
-            if ( programStage == null )
-            {
-                log.error( "program stage id : " + programStageId + " does not exist" );
-            }
-
-            DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
-            if ( dataElement == null )
-            {
-                log.error( "data element id : " + programStageId + " does not exist" );
-            }
-
-            ProgramStageDataElement programStageDataElement = programStageDataElementService.get( programStage,
-                dataElement );
-
-            result.add( programStageDataElement );
-        }
-
-        return result;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Supportive methods
-    // -------------------------------------------------------------------------
-
-    /**
-     * Returns the value of the PatientDataValue in the Collection of DataValues
-     * with the given data element identifier and category option combo id.
-     */
-    private PatientDataValue getValue( Collection<PatientDataValue> dataValues, int dataElementId,
-        int categoryOptionComboId )
-    {
-        for ( PatientDataValue dataValue : dataValues )
-        {
-            if ( dataValue.getOptionCombo() != null )
-            {
-                if ( dataValue.getDataElement().getId() == dataElementId
-                    && dataValue.getOptionCombo().getId() == categoryOptionComboId )
-                {
-                    return dataValue;
-                }
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns the value of the PatientDataValue in the Collection of DataValues
-     * with the given data element identifier.
-     */
-    private PatientDataValue getValue( Collection<PatientDataValue> dataValues, int dataElementId )
-    {
-        for ( PatientDataValue dataValue : dataValues )
-        {
-            if ( dataValue.getDataElement().getId() == dataElementId )
-            {
-                return dataValue;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns a Map of all DataElements in the given ProgramStage where the key
-     * is the DataElement identifier and the value is the DataElement.
-     */
-    private Map<Integer, DataElement> getDataElementMap( ProgramStage programStage )
-    {
-        Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
-        if ( programStage == null )
-        {
-            return null;
-        }
-        Map<Integer, DataElement> map = new HashMap<Integer, DataElement>();
-
-        for ( DataElement element : dataElements )
-        {
-            map.put( element.getId(), element );
-        }
-
-        return map;
-    }
-
-    /**
-     * Append a ProvidedByOtherFacility Checkbox to the html code
-     * 
-     * @param appendCode: current html code
-     * @param patientDataValue: currrent PatientDataValue
-     * @return full html code after append the check box
-     */
-    private String addProvidedByOtherFacilityCheckbox( String appendCode, PatientDataValue patientDataValue )
-    {
-        appendCode += "<label for=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" title=\"is provided by another Facility ?\" ></label><input name=\"providedByAnotherFacility\"  title=\"is provided by another Facility ?\"  id=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\"  type=\"checkbox\" ";
-
-        if ( patientDataValue != null && patientDataValue.isProvidedByAnotherFacility() )
-        {
-            appendCode += " checked=\"checked\" ";
-        }
-        appendCode += "onChange=\"updateProvidingFacilityCustom( $PROGRAMSTAGEID, $DATAELEMENTID, this )\"  >";
-
-        return appendCode;
-
-    }
-
-    /**
-     * Replaces i18n string in the custom form code.
-     * 
-     * @param dataEntryFormCode the data entry form html.
-     * @param i18n the I18n object.
-     * @return internationalized data entry form html.
-     */
-    private String populateI18nStrings( String dataEntryFormCode, I18n i18n )
-    {
-        StringBuffer sb = new StringBuffer();
-
-        // ---------------------------------------------------------------------
-        // Pattern to match i18n strings in the HTML code
-        // ---------------------------------------------------------------------
-
-        Pattern i18nPattern = Pattern.compile( "(<i18n.*?)[/]?</i18n>", Pattern.DOTALL );
-        Matcher i18nMatcher = i18nPattern.matcher( dataEntryFormCode );
-
-        // ---------------------------------------------------------------------
-        // Iterate through all matching i18n element fields
-        // ---------------------------------------------------------------------
-
-        while ( i18nMatcher.find() )
-        {
-            String i18nCode = i18nMatcher.group( 1 );
-
-            i18nCode = i18nCode.replaceAll( "<i18n>", "" );
-
-            i18nCode = i18n.getString( i18nCode );
-
-            i18nMatcher.appendReplacement( sb, i18nCode );
-        }
-
-        i18nMatcher.appendTail( sb );
-
-        String result = sb.toString();
-
-        result.replaceAll( "</i18n>", "" );
-
-        return result;
-    }
-}

=== 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	2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-02-11 13:58:02 +0000
@@ -73,8 +73,6 @@
 		class="org.hisp.dhis.caseentry.action.caseentry.SaveValueAction"
 		scope="prototype">
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="dataElementCategoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="patientDataValueService"
@@ -106,23 +104,6 @@
 			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.caseentry.screen.DataEntryScreenManager"
-		class="org.hisp.dhis.caseentry.screen.DefaultDataEntryScreenManager"
-		scope="prototype">
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="programStageInstanceService">
-			<ref bean="org.hisp.dhis.program.ProgramStageInstanceService" />
-		</property>
-		<property name="programStageService">
-			<ref bean="org.hisp.dhis.program.ProgramStageService" />
-		</property>
-		<property name="patientDataValueService">
-			<ref bean="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-		</property>
-		<property name="programStageDataElementService"
-			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
-	</bean>
-
 	<bean
 		id="org.hisp.dhis.caseentry.action.caseentry.LoadProgramStagesAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.LoadProgramStagesAction"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-02-09 04:47:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-02-11 13:58:02 +0000
@@ -27,14 +27,6 @@
 		}
 		
 		entryFormContainerOnReady();
-		
-		jQuery("#entryForm :input").each(function()
-		{ 
-			if( jQuery(this).attr( 'options' )!= null )
-			{
-				autocompletedField(jQuery(this).attr('id'));
-			}
-		});
 			
 	});
 </script>
@@ -78,81 +70,74 @@
 		#set( $mark = true )
 		#set( $tabIndex = 1 )
 		#foreach( $programStageDataElement in $programStageDataElements )
-			#foreach( $optionCombo in $!programStageDataElement.dataElement.categoryCombo.optionCombos )
-				#set( $dataElementRowCount = $dataElementRowCount + 1 )    
-				#set( $mark = !$mark )
-				#set( $patientDataValue = false )
-				#set( $key = $programStageDataElement.dataElement.id + '-' + $optionCombo.id)
-				#set( $patientDataValue = $patientDataValueMap.get( $key ) )    
-				<tr #alternate( $mark )>
-					##dataElementRowCount
-					<td>$dataElementRowCount</td>        
-					##data element name
-					<td class='text-column'>
-						<span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
-							$encoder.htmlEncode( $programStageDataElement.dataElement.name ) 
-							#if( $!programStageDataElement.dataElement.categoryCombo.optionCombos.size() > 1 ) 
-								$encoder.htmlEncode( $optionCombo.name ) 
-							#end
-							#if ( $programStageDataElement.compulsory )
-								<em title="$i18n.getString( "required" )" class="required">*</em>
-							#end        
-						</span>
-						##type        
-						<span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>       
-					</td>        
-					##entry        
-					<td>   
-						#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
-						#if( $!programStageDataElement.dataElement.optionSet )
-							#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-' + $optionCombo.id + '-val' )
-							<select name="entryselect" options='$programStageDataElement.dataElement.optionSet.options' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" onchange="saveVal( $programStageDataElement.dataElement.id, $optionCombo.id )" tabindex="$tabIndex">              
-								<option value="">[$i18n.getString( "select_value" )]</option>
-								#foreach( $option in $programStageDataElement.dataElement.optionSet.options )
-									<option value="$option" #if( $patientDataValue.value == $option ) selected="selected" #end>$encoder.htmlEncode( $option )</option>
-								#end
-							</select>
-						#elseif( $programStageDataElement.dataElement.type == "bool" )
-							<select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex"> 
-								<option value="">[$i18n.getString( "select_value" )]</option>
-								<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
-								<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
-							</select> 
-						#elseif( $programStageDataElement.dataElement.type == "date" )
-							<input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveDate( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
-							#if(!$programStageInstance.completed)
-								<script type="text/javascript">
-									datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
-								</script>   
-							#end
+			#set( $dataElementRowCount = $dataElementRowCount + 1 )    
+			#set( $mark = !$mark )
+			#set( $patientDataValue = false )
+			#set( $key = $programStageDataElement.dataElement.id )
+			#set( $patientDataValue = $patientDataValueMap.get( $key ) )    
+			<tr #alternate( $mark )>
+				##dataElementRowCount
+				<td>$dataElementRowCount</td>        
+				##data element name
+				<td class='text-column'>
+					<span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+						$encoder.htmlEncode( $programStageDataElement.dataElement.name ) 
+						#if ( $programStageDataElement.compulsory )
+							<em title="$i18n.getString( "required" )" class="required">*</em>
+						#end        
+					</span>
+					##type        
+					<span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>       
+				</td>        
+				##entry        
+				<td>   
+					#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+					#if( $!programStageDataElement.dataElement.optionSet )
+						<select name="entryselect" options='true' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" onchange="saveVal( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">              
+							<option value="">[$i18n.getString( "select_value" )]</option>
+							#foreach( $option in $programStageDataElement.dataElement.optionSet.options )
+								<option value="$option" #if( $patientDataValue.value == $option ) selected="selected" #end>$encoder.htmlEncode( $option )</option>
+							#end
+						</select>
+					#elseif( $programStageDataElement.dataElement.type == "bool" )
+						<select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex"> 
+							<option value="">[$i18n.getString( "select_value" )]</option>
+							<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+							<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+						</select> 
+					#elseif( $programStageDataElement.dataElement.type == "date" )
+						<input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveDate( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+						#if(!$programStageInstance.completed)
+							<script type="text/javascript">
+								datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+							</script>   
+						#end
+					#else
+						<input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
+					#end
+				</td>  
+				
+				##providedByAnotherFacility 
+				#set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
+				#if($programStageInstance.programInstance.program.anonymous == 'false') 					
+				<td>   
+					#if ( $patientDataValue.value )        
+						#if( !$patientDataValue.providedByAnotherFacility )
+							$patientDataValue.organisationUnit.name
+							<input  name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
 						#else
-							#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-' + $optionCombo.id + '-val' )
-							<input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id, $optionCombo.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
+							$i18n.getString("other_facility")
+							<input  name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
 						#end
-					</td>  
-					
-					##providedByAnotherFacility 
-					#set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
-					#if($programStageInstance.programInstance.program.anonymous == 'false') 					
-					<td>   
-						#if ( $patientDataValue.value )        
-							#if( !$patientDataValue.providedByAnotherFacility )
-								$patientDataValue.organisationUnit.name
-								<input  name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
-							#else
-								$i18n.getString("other_facility")
-								<input  name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
-							#end
-						 #else
-							<input name="providedByAnotherFacility" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
-						 #end                         
-					</td>
-					#else
-						<input name="providedByAnotherFacility" id="$id" type="hidden">
-					#end					
-				</tr>
-				#set( $tabIndex = $tabIndex + 1 )
-			#end
+					 #else
+						<input name="providedByAnotherFacility" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
+					 #end                         
+				</td>
+				#else
+					<input name="providedByAnotherFacility" id="$id" type="hidden">
+				#end					
+			</tr>
+			#set( $tabIndex = $tabIndex + 1 )
 		#end
 		</table>
 	#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-02-09 04:47:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-02-11 13:58:02 +0000
@@ -141,10 +141,10 @@
 //Save value
 //------------------------------------------------------------------------------
 
-function saveVal( dataElementId, optionComboId )
+function saveVal( dataElementId )
 {
 	var programStageId = byId('programStageId').value;
-	var fieldId = programStageId + '-' + dataElementId + '-' + optionComboId + '-val';
+	var fieldId = programStageId + '-' + dataElementId + '-val';
 	
 	var field = byId( fieldId ); 
 	var fieldValue = jQuery.trim( field.value );
@@ -202,7 +202,7 @@
     	
     }
     
-	var valueSaver = new ValueSaver( dataElementId, optionComboId,  fieldValue, providedByAnotherFacility, type, '#ccffcc'  );
+	var valueSaver = new ValueSaver( dataElementId, fieldValue, providedByAnotherFacility, type, '#ccffcc'  );
     valueSaver.save();
 }
 
@@ -230,7 +230,7 @@
 	field.style.backgroundColor = '#ffffcc';
 	var providedByAnotherFacility = document.getElementById( programStageId + '_' + dataElementId + '_facility' ).checked;
  
-	var valueSaver = new ValueSaver( dataElementId, 0, field.options[field.selectedIndex].value, providedByAnotherFacility, 'bool', '#ccffcc' );
+	var valueSaver = new ValueSaver( dataElementId, field.options[field.selectedIndex].value, providedByAnotherFacility, 'bool', '#ccffcc' );
     valueSaver.save();
 }
 
@@ -382,13 +382,12 @@
 // Save value for dataElement of type text, number, boolean, combo
 //-----------------------------------------------------------------
 
-function ValueSaver( dataElementId_, selectedOption_, value_, providedByAnotherFacility_, dataElementType_, resultColor_  )
+function ValueSaver( dataElementId_, value_, providedByAnotherFacility_, dataElementType_, resultColor_  )
 {
     var SUCCESS = '#ccffcc';
     var ERROR = '#ccccff';
 	
     var dataElementId = dataElementId_;
-    var selectedOption = selectedOption_;
 	var value = value_;
     var providedByAnotherFacility = providedByAnotherFacility_;
 	var type = dataElementType_;
@@ -397,7 +396,6 @@
     this.save = function()
     {
 		var params = 'dataElementId=' + dataElementId;
-			params += '&optionComboId=' + selectedOption;
 			params += '&value=' + value;
 			params += '&providedByAnotherFacility=' + providedByAnotherFacility;
 			
@@ -440,17 +438,7 @@
     function markValue( color )
     {
 		var programStageId = getFieldValue('programStageId');
-        var element;
-     
-        if( selectedOption )
-        {
-            element = byId( programStageId + "-" + dataElementId + "-" + selectedOption +'-val' );
-        }
-        else
-        {
-            element = byId( programStageId + "-" + dataElementId + '-val' );
-        }
-             
+        var element = byId( programStageId + "-" + dataElementId + '-val' );
         element.style.backgroundColor = color;
     }
 }
@@ -788,6 +776,15 @@
         });
 		
         TOGGLE.init();
+		
+		
+		/*jQuery("#entryForm :input").each(function()
+		{ 
+			if( jQuery(this).attr( 'options' )!= null )
+			{
+				autocompletedField(jQuery(this).attr('id'));
+			}
+		});*/
     }
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-02-09 03:25:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-02-11 13:58:02 +0000
@@ -885,10 +885,8 @@
 			});
 			
 			jQuery('#backBtnFromEntry').hide();
-			hideById('dueDateLabel');
-			hideById('dueDate');
-			hideById('programStageIdLabel');
-			hideById('programStageId');
+			jQuery('#programStageIdTR').attr('class','hidden');
+			jQuery('#dueDateTR').attr('class','hidden');
 			hideById('patientInfoDiv');
 			hideById( 'newEncounterBtn' );
 			

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js	2012-01-15 02:14:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js	2012-02-11 13:58:02 +0000
@@ -65,7 +65,7 @@
 		.load( 'viewAnonymousEvents.action?programStageInstanceId=' + programStageInstanceId ,{}
 		,function( )
 		{
-			
+			showById('entryFormContainer');
 		}).dialog({
 			title: i18n_reports,
 			maximize: true, 
@@ -75,4 +75,6 @@
 			width: 800,
 			height: 400
 		});
-}
\ No newline at end of file
+}
+
+function entryFormContainerOnReady (){}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java	2012-02-11 13:58:02 +0000
@@ -31,10 +31,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 
@@ -70,48 +67,31 @@
     // Input & Output
     // -------------------------------------------------------------------------
 
-    private List<String> optionComboNames;
-
-    public List<String> getOptionComboNames()
-    {
-        return optionComboNames;
-    }
-
-    private List<String> optionComboIds;
-
-    public List<String> getOptionComboIds()
-    {
-        return optionComboIds;
-    }
-
-    private List<String> optionComboType;
-
-    public List<String> getOptionComboType()
-    {
-        return optionComboType;
-    }
-
     private Integer psId;
 
     public void setPsId( Integer psId )
     {
         this.psId = psId;
     }
+    
+    public Integer getPsId()
+    {
+        return psId;
+    }
 
     private List<DataElement> dataElementList;
 
+    public List<DataElement> getDataElementList()
+    {
+        return dataElementList;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        optionComboNames = new ArrayList<String>();
-
-        optionComboIds = new ArrayList<String>();
-
-        optionComboType = new ArrayList<String>();
-
         dataElementList = new ArrayList<DataElement>( programStageDataElementService
             .getListDataElement( programStageService.getProgramStage( psId ) ) );
 
@@ -123,29 +103,9 @@
             {
                 DataElement de = deIterator.next();
 
-                if ( de.getType().equals( DataElement.VALUE_TYPE_INT ) )
+                if ( !de.getType().equals( DataElement.VALUE_TYPE_INT ) )
                 {
-                    DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
-
-                    List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
-                        dataElementCategoryCombo.getOptionCombos() );
-
-                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-
-                    while ( optionComboIterator.hasNext() )
-                    {
-                        DataElementCategoryOptionCombo decoc = optionComboIterator.next();
-
-                        optionComboIds.add( "[" + CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT + ":"
-                            + psId + "." + de.getId() + "." + decoc.getId() + "]" );
-
-                        optionComboNames.add( de.getName() + " " + decoc.getName() );
-
-                        if ( de.isMultiDimensional() )
-                            optionComboType.add( "1:" + de.getType() );
-                        else
-                            optionComboType.add( "0:" + de.getType() );
-                    }
+                    deIterator.remove();
                 }
             }
         }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetPSDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetPSDataElementsAction.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetPSDataElementsAction.java	2012-02-11 13:58:02 +0000
@@ -28,13 +28,9 @@
 package org.hisp.dhis.patient.action.caseaggregation;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
-import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 
@@ -93,13 +89,23 @@
     {
         this.psId = psId;
     }
+    
+    public Integer getPsId()
+    {
+        return psId;
+    }
 
     private List<DataElement> dataElementList;
 
+    public List<DataElement> getDataElementList()
+    {
+        return dataElementList;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
-
+   
     public String execute()
     {
         optionComboNames = new ArrayList<String>();
@@ -111,38 +117,6 @@
         dataElementList = new ArrayList<DataElement>( programStageDataElementService
             .getListDataElement( programStageService.getProgramStage( psId ) ) );
 
-        if ( dataElementList != null && !dataElementList.isEmpty() )
-        {
-            Iterator<DataElement> deIterator = dataElementList.iterator();
-
-            while ( deIterator.hasNext() )
-            {
-                DataElement de = deIterator.next();
-
-                DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
-
-                List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
-                    dataElementCategoryCombo.getOptionCombos() );
-
-                Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-
-                while ( optionComboIterator.hasNext() )
-                {
-                    DataElementCategoryOptionCombo decoc = optionComboIterator.next();
-
-                    optionComboIds.add( "[" + CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT + ":" + psId
-                        + "." + de.getId() + "." + decoc.getId() + "]" );
-
-                    optionComboNames.add( de.getName() + " " + decoc.getName() );
-
-                    if ( de.isMultiDimensional() )
-                        optionComboType.add( "1:" + de.getType() );
-                    else
-                        optionComboType.add( "0:" + de.getType() );
-                }
-            }
-        }
-
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientimport/ImportPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientimport/ImportPatientAction.java	2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientimport/ImportPatientAction.java	2012-02-11 13:58:02 +0000
@@ -36,7 +36,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -50,11 +49,9 @@
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patient.Patient;
@@ -78,6 +75,7 @@
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.DateUtils;
 import org.hisp.dhis.system.util.StreamUtils;
 import org.w3c.dom.Document;
@@ -685,38 +683,7 @@
 
             DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( infor[1] ) );
 
-            int optionComboId = Integer.parseInt( infor[2] );
-            DataElementCategoryOptionCombo optionCombo = null;
-
-            if ( optionComboId == 0 )
-            {
-                String[] temp = value.trim().split( ":" );
-                if ( temp.length == 2 )
-                {
-                    optionComboId = Integer.parseInt( temp[1] );
-                }
-                else
-                {
-                    value = (value.equalsIgnoreCase( "yes" )) ? "true" : "false";
-                    optionComboId = dataElement.getCategoryCombo().getOptionCombos().iterator().next().getId();
-                }
-            }
-
-            Set<DataElementCategoryOptionCombo> options = dataElement.getCategoryCombo().getOptionCombos();
-            if ( options != null && options.size() > 0 )
-            {
-                Iterator<DataElementCategoryOptionCombo> i = options.iterator();
-                while ( i.hasNext() )
-                {
-                    DataElementCategoryOptionCombo tmpOption = i.next();
-                    if ( tmpOption.getId() == optionComboId )
-                    {
-                        optionCombo = tmpOption;
-                    }
-                }
-            }
-
-            if ( stage != null && dataElement != null && optionCombo != null )
+            if ( stage != null && dataElement != null )
             {
                 ProgramStageInstance stageInstance = programStageInstanceService.getProgramStageInstance(
                     programInstance, stage );
@@ -724,7 +691,6 @@
                 PatientDataValue dataValue = new PatientDataValue();
 
                 dataValue.setDataElement( dataElement );
-                dataValue.setOptionCombo( optionCombo );
                 dataValue.setProgramStageInstance( stageInstance );
                 dataValue.setOrganisationUnit( orgunit );
                 dataValue.setTimestamp( new Date() );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java	2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java	2012-02-11 13:58:02 +0000
@@ -35,7 +35,6 @@
 import java.util.Map;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.program.ProgramValidation;
@@ -62,20 +61,6 @@
         this.programStageService = programStageService;
     }
 
-//    private ProgramStageDataElementService programStageDataElementService;
-//
-//    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-//    {
-//        this.programStageDataElementService = programStageDataElementService;
-//    }
-    
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
     private ProgramValidationService programValidationService;
 
     public void setProgramValidationService( ProgramValidationService programValidationService )
@@ -99,13 +84,6 @@
         return psId;
     }
 
-    private int optionComboId;
-
-    public int getOptionComboId()
-    {
-        return optionComboId;
-    }
-
     private List<DataElement> dataElementList = new ArrayList<DataElement>();
 
     public List<DataElement> getDataElementList()
@@ -129,9 +107,7 @@
         Collection<ProgramStageDataElement> psDataElements = programStageService.getProgramStage( psId ).getProgramStageDataElements();
         
         if ( psDataElements != null && !psDataElements.isEmpty() )
-        {
-            optionComboId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
-           
+        {           
             Iterator<ProgramStageDataElement> iter = psDataElements.iterator();
 
             while ( iter.hasNext() )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-02-11 13:58:02 +0000
@@ -871,8 +871,6 @@
 		<property name="programStageService">
 			<ref bean="org.hisp.dhis.program.ProgramStageService" />
 		</property>
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		<property name="programValidationService"
 			ref="org.hisp.dhis.program.ProgramValidationService" />
 	</bean>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm	2012-02-08 12:47:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm	2012-02-11 13:58:02 +0000
@@ -15,7 +15,7 @@
 <table> 
 	<thead>
       <tr>
-        <th colspan="2">$i18n.getString( "case_aggregation_condition_detail" )</th>
+        <th colspan="3">$i18n.getString( "case_aggregation_condition_detail" )</th>
       </tr>
     </thead>
 	
@@ -64,7 +64,7 @@
 <table>
 	<thead>
 		<tr>
-			<th colspan="3">$i18n.getString( "condition_detail" )</th>
+			<th colspan="4">$i18n.getString( "condition_detail" )</th>
 		</tr>
 	</thead>
 	
@@ -229,7 +229,7 @@
 		<td colspan='4'>
 			<fieldset style="border: 1px solid #3f5d8e;">
 				<legend>$i18n.getString( "condition" )</legend>
-				<textarea id="aggregationCondition" name="aggregationCondition" style="width:62.5em; height:10em" class="{validate:{required:true}}" onkeyup='getConditionDescription();'></textarea>
+				<textarea id="aggregationCondition" name="aggregationCondition" style="width:80.5em; height:10em" class="{validate:{required:true}}" onkeyup='getConditionDescription();'></textarea>
 			</fieldset>
 		</td>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	2012-01-15 14:53:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	2012-02-11 13:58:02 +0000
@@ -13,7 +13,7 @@
 	#set( $mark = false )
 	#set( $index = 0 )
 	#foreach( $dataElement in $dataElementList )
-		#set( $id= '[DE:' + $psId + '.' + $dataElement.id + '.' + $optionComboId + ']')
+		#set( $id= '[DE:' + $psId + '.' + $dataElement.id + ']')
 		#set( $validationId= $id + '.validation' )
 		#set( $index = $index + 1 )
 		<tr #alternate($mark) >

=== 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-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2012-02-11 13:58:02 +0000
@@ -76,20 +76,13 @@
 	var dataElementIdsStore = jQuery( "#otherProgramStageDataElements #dataElementIdsStore" );
 	dataElementIdsStore.empty();
 	
-	jQuery( "#otherProgramStageDataElements #optionComboIds" ).empty();
 	if( id != '' ){
 		jQuery.post("getSelectedDataElements.action",{
 			associationId: id
 		}, function( xml ){			
 			jQuery( xml ).find( 'dataElement' ).each( function(i, item ){
-				jQuery( item ).find( 'optionCombo' ).each( function(i, optionCombo ){	
-					dataElements.append("<option value='" + jQuery( item ).find( "json" ).text() 
-						+ "' optionCombo='{\"id\":\"" + jQuery( optionCombo ).find( "optionComboid" ).text() 
-						+"\",\"name\":\"" + jQuery( optionCombo ).find( "optionComboname" ).text() + "\" }'>" 
-						+ jQuery( item ).find( "name" ).text() + jQuery( optionCombo ).find( "optionComboname" ).text() 
-						+ "</option>");
-					dataElementIdsStore.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
-				});
+				dataElements.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
+				dataElementIdsStore.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
 			});
 		});
 	}
@@ -141,7 +134,6 @@
 {
 	var oEditor = jQuery("#designTextarea").ckeditorGet();
 	var dataElement = JSON.parse( jQuery( source + ' #dataElementIds').val() );
-	var optionCombo = JSON.parse( jQuery( source + ' #dataElementIds option:selected').attr('optionCombo') );
 
 	if( dataElement == null )
 	{
@@ -151,8 +143,6 @@
 		jQuery( source + " #message_").html( "" );
 	}
 
-	var categoryOptionCombos = getSelectedValues( source + ' #optionComboIds' );
-
 	var dataElementId = dataElement.id;	
 	var dataElementName = dataElement.name;	
 	var dataElementType = dataElement.type;
@@ -164,21 +154,18 @@
 	{
 		var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
 		var displayName = dataElementName;
-		htmlCode = "<input name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
+		htmlCode = "<input title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
 	} 
 	else if ( dataElementType == "date" )
 	{
 		var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
 		var displayName = dataElementName;
-		htmlCode = "<input name=\"entryfield\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
+		htmlCode = "<input title=\"" + titleValue + " \"name=\"entryfield\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
 	} 
 	else if ( dataElementType == "int" || dataElementType == "string" ) 
 	{
-		var optionComboName = optionCombo.name;
-		var optionComboId = optionCombo.id;
-		var titleValue = "-- " + dataElementId + "." + dataElementName + "-" + optionComboId + "." + optionComboName+" ("+dataElementType+") --";
-		var displayName = dataElementName + "-" + optionComboName;
-		id = programStageId + "-" + dataElementId + "-" + optionComboId + "-val";
+		var titleValue = "-- " + dataElementId + "." + dataElementName +" (" + dataElementType + ") --";
+		var displayName = dataElementName;
 		htmlCode += "<input title=\"" + titleValue + "\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + id + "\" />";
 	}
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm	2011-07-22 03:53:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm	2012-02-11 13:58:02 +0000
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <dataelements>
-	#foreach( $ocName in $optionComboNames )
-	#set( $count = $velocityCount - 1 )
+	#foreach( $dataElement in $dataElementList )
 		<dataelement>
-  			<id>$optionComboIds.get($count)</id>
-  			<name>$encoder.xmlEncode( $ocName )</name>
+			<id>[DE:$psId.$dataElement.id]</id>
+			<name>$encoder.xmlEncode( $dataElement.name )</name>
 		</dataelement>	
 	#end
 </dataelements>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2012-02-11 13:58:02 +0000
@@ -137,9 +137,7 @@
 			<td>	
 				<select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" ondblclick="insertDataElement( '#dataElementSelection', '$programStage.id')">
 					#foreach( $de in $dataElements)
-						#foreach( $optionCombo in $de.categoryCombo.optionCombos)
-							<option value='$de.toJSON()' optionCombo='{"id":"$optionCombo.id","name":"$optionCombo.name" }' >$encoder.htmlEncode( $de.name ) $optionCombo.name</option>
-						#end
+					<option value='$de.toJSON()'>$encoder.htmlEncode( $de.name )</option>
 					#end
 				</select>
 				<select id="dataElementIdsStore" multiple="multiple" style="display:none">