← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6378: (patient) Add relationship between PatientIdentifierType and Program.

 

------------------------------------------------------------
revno: 6378
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-03-26 13:36:24 +0700
message:
  (patient) Add relationship between PatientIdentifierType and Program.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SavePatientIdentifierAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ShowUpdatePatientIdentifierTypeForm.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.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/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.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/form.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/patientHistory.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.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/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.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/patient/PatientIdentifierService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java	2012-03-26 06:36:24 +0000
@@ -66,4 +66,6 @@
     Collection<Patient> getPatientsByIdentifier( String identifier, int min, int max );
     
     int countGetPatientsByIdentifier( String identifier );
+    
+    Collection<PatientIdentifier> getPatientIdentifiers(Collection<PatientIdentifierType> identifierTypes, Patient patient);
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java	2012-03-26 06:36:24 +0000
@@ -62,4 +62,7 @@
     Collection<Patient> getPatientsByIdentifier( String identifier, int min, int max );
     
     int countGetPatientsByIdentifier( String identifier );
+        
+    Collection<PatientIdentifier> get(Collection<PatientIdentifierType> identifierTypes, Patient patient);
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java	2012-02-27 01:07:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java	2012-03-26 06:36:24 +0000
@@ -33,6 +33,7 @@
 
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.program.Program;
 
 @XmlRootElement( name = "patientIdentifierType", namespace = Dxf2Namespace.NAMESPACE )
 @XmlAccessorType( value = XmlAccessType.NONE )
@@ -62,6 +63,8 @@
 
     private String type;
 
+    private Program program;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -183,4 +186,14 @@
         this.type = type;
     }
 
+    public Program getProgram()
+    {
+        return program;
+    }
+
+    public void setProgram( Program program )
+    {
+        this.program = program;
+    }
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java	2010-12-01 08:10:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java	2012-03-26 06:36:24 +0000
@@ -28,6 +28,8 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.program.Program;
+
 /**
  * @author Abyot Asalefew
  * @version $Id$
@@ -50,4 +52,8 @@
     
     Collection<PatientIdentifierType> getPatientIdentifierTypes( boolean mandatory );
     
+    Collection<PatientIdentifierType> getPatientIdentifierTypes( Program program );
+    
+    Collection<PatientIdentifierType> getPatientIdentifierTypesWithoutProgram();
+    
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2012-03-26 06:36:24 +0000
@@ -3,9 +3,13 @@
 import java.util.Collection;
 
 import org.hisp.dhis.common.GenericNameableObjectStore;
+import org.hisp.dhis.program.Program;
 
 public interface PatientIdentifierTypeStore extends GenericNameableObjectStore<PatientIdentifierType>
 {
-    Collection<PatientIdentifierType> get ( boolean mandatory );
-
+    Collection<PatientIdentifierType> get( boolean mandatory );
+    
+    Collection<PatientIdentifierType> get( Program program );
+    
+    Collection<PatientIdentifierType> getWithoutProgram();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java	2012-03-22 14:17:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java	2012-03-26 06:36:24 +0000
@@ -30,7 +30,6 @@
 import java.util.Collection;
 
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
  * @author Chau Thu Tran

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierService.java	2012-03-26 06:36:24 +0000
@@ -128,4 +128,10 @@
     {
         return patientIdentifierStore.countGetPatientsByIdentifier( identifier );
     }
+    
+    public Collection<PatientIdentifier> getPatientIdentifiers(Collection<PatientIdentifierType> identifierTypes, Patient patient)
+    {
+        return patientIdentifierStore.get( identifierTypes, patient );
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java	2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java	2012-03-26 06:36:24 +0000
@@ -28,6 +28,7 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.program.Program;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -87,4 +88,16 @@
     {
         return patientIdentifierTypeStore.get( mandatory );
     }
+    
+    public Collection<PatientIdentifierType> getPatientIdentifierTypes( Program program )
+    {
+        return patientIdentifierTypeStore.get( program );
+    }
+    
+    public Collection<PatientIdentifierType> getPatientIdentifierTypesWithoutProgram()
+    {
+        return patientIdentifierTypeStore.getWithoutProgram();
+    }
+
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2012-03-26 06:36:24 +0000
@@ -115,4 +115,11 @@
         return rs != null ? rs.intValue() : 0;
     }
 
+    @SuppressWarnings( "unchecked" )
+    public Collection<PatientIdentifier> get( Collection<PatientIdentifierType> identifierTypes, Patient patient )
+    {
+        return getCriteria( Restrictions.in( "identifierType", identifierTypes ), Restrictions.eq( "patient", patient ) )
+            .list();
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java	2012-03-26 06:36:24 +0000
@@ -33,6 +33,7 @@
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeStore;
+import org.hisp.dhis.program.Program;
 
 public class HibernatePatientIdentifierTypeStore
     extends HibernateGenericStore<PatientIdentifierType>
@@ -44,4 +45,15 @@
         return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list();
     }
 
+    @SuppressWarnings( "unchecked" )
+    public Collection<PatientIdentifierType> get( Program program )
+    {
+        return getCriteria( Restrictions.eq( "program", program ) ).list();
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public Collection<PatientIdentifierType> getWithoutProgram()
+    {
+        return getCriteria( Restrictions.isNull( "program" ) ).list();
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml	2012-02-27 01:07:19 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml	2012-03-26 06:36:24 +0000
@@ -14,6 +14,8 @@
 
 	&identifiableProperties;
 	
+	<property name="description" not-null="true" />
+	
     <property name="mandatory" not-null="true" />
 
     <property name="related" not-null="true" />
@@ -21,6 +23,8 @@
     <property name="noChars" />
 
     <property name="type" />
+    
+    <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_identifiertype_program" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2011-09-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2012-03-26 06:36:24 +0000
@@ -117,7 +117,7 @@
 
         patientIdentifier = patientIdentifierService.getPatientIdentifier( patient );
 
-        identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
+        identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram();
 
         identiferMap = new HashMap<Integer, String>();
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2011-10-04 06:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2012-03-26 06:36:24 +0000
@@ -28,10 +28,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
@@ -58,7 +62,9 @@
 
     private ProgramInstanceService programInstanceService;
 
-    private OrganisationUnitSelectionManager selectionManager;
+    private PatientIdentifierTypeService identifierTypeService;
+
+    private PatientIdentifierService patientIdentifierService;
 
     // -------------------------------------------------------------------------
     // Input/Output
@@ -68,16 +74,18 @@
 
     private Integer programId;
 
+    private Map<Integer, String> identiferMap;
+
     private Patient patient;
 
     private Program program;
 
     private ProgramInstance programInstance;
 
-    private Boolean registerEvent;
-
     private Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
 
+    private Collection<PatientIdentifierType> identifierTypes;
+
     // -------------------------------------------------------------------------
     // Getters/Setters
     // -------------------------------------------------------------------------
@@ -87,6 +95,21 @@
         this.patientService = patientService;
     }
 
+    public Map<Integer, String> getIdentiferMap()
+    {
+        return identiferMap;
+    }
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+    {
+        this.identifierTypeService = identifierTypeService;
+    }
+
     public void setProgramService( ProgramService programService )
     {
         this.programService = programService;
@@ -97,9 +120,9 @@
         this.programInstanceService = programInstanceService;
     }
 
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    public Collection<PatientIdentifierType> getIdentifierTypes()
     {
-        this.selectionManager = selectionManager;
+        return identifierTypes;
     }
 
     public void setPatientId( Integer patientId )
@@ -132,11 +155,6 @@
         return programStageInstances;
     }
 
-    public Boolean getRegisterEvent()
-    {
-        return registerEvent;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -160,12 +178,23 @@
             programInstance = programInstances.iterator().next();
 
             programStageInstances = programInstance.getProgramStageInstances();
+
+            // ---------------------------------------------------------------------
+            // Load identifier types of the selected program
+            // ---------------------------------------------------------------------
+
+            identifierTypes = identifierTypeService.getPatientIdentifierTypes( program );
+            identiferMap = new HashMap<Integer, String>();
+
+            Collection<PatientIdentifier> patientIdentifiers = patientIdentifierService.getPatientIdentifiers(
+                identifierTypes, patient );
+
+            for ( PatientIdentifier identifier : patientIdentifiers )
+            {
+                identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() );
+            }
         }
 
-        OrganisationUnit selectedOrgunit = selectionManager.getSelectedOrganisationUnit();
-      
-        registerEvent = program.getOrganisationUnits().contains( selectedOrgunit );
-
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-01-06 06:32:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-03-26 06:36:24 +0000
@@ -95,13 +95,6 @@
         return programs;
     }
 
-    private Boolean registerEvent;
-
-    public Boolean getRegisterEvent()
-    {
-        return registerEvent;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -123,8 +116,6 @@
 
         singleEventPrograms.retainAll( programsbyOrgunit );
 
-        registerEvent = (singleEventPrograms.size() > 0);
-
         return SUCCESS;
     }
 }

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SavePatientIdentifierAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SavePatientIdentifierAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SavePatientIdentifierAction.java	2012-03-26 06:36:24 +0000
@@ -0,0 +1,142 @@
+/*
+ * 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.action.patient;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $SavePatientIdentifierAction.java Mar 26, 2012 11:50:50 AM$
+ */
+public class SavePatientIdentifierAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientService patientService;
+
+    private PatientIdentifierTypeService identifierTypeService;
+
+    private PatientIdentifierService patientIdentifierService;
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer patientId;
+
+    private Integer identifierTypeId;
+
+    private String value;
+
+    private Integer statusCode;
+    
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+    {
+        this.identifierTypeService = identifierTypeService;
+    }
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    public Integer getStatusCode()
+    {
+        return statusCode;
+    }
+
+    public void setIdentifierTypeId( Integer identifierTypeId )
+    {
+        this.identifierTypeId = identifierTypeId;
+    }
+
+    public void setValue( String value )
+    {
+        this.value = value;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Patient patient = patientService.getPatient( patientId );
+        PatientIdentifierType identifierType = identifierTypeService.getPatientIdentifierType( identifierTypeId );
+
+        PatientIdentifier patientIdentifier = patientIdentifierService.getPatientIdentifier( identifierType, patient );
+
+        if ( patientIdentifier == null )
+        {
+            patientIdentifier = new PatientIdentifier();
+            patientIdentifier.setIdentifierType( identifierType );
+            patientIdentifier.setPatient( patient );
+            patientIdentifier.setIdentifier( value.trim() );
+        }
+        else
+        {
+            patientIdentifier.setIdentifier( value.trim() );
+        }
+        
+        patient.getIdentifiers().add( patientIdentifier );
+
+        patientService.updatePatient( patient );
+
+        statusCode = 0;
+        
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java	2011-09-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java	2012-03-26 06:36:24 +0000
@@ -29,9 +29,15 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
@@ -83,6 +89,35 @@
         this.programStageInstanceService = programStageInstanceService;
     }
 
+    public Collection<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
+    public Map<Integer, String> getIdentiferMap()
+    {
+        return identiferMap;
+    }
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+    {
+        this.identifierTypeService = identifierTypeService;
+    }
+
+    public void setProgramStageInstances( Collection<ProgramStageInstance> programStageInstances )
+    {
+        this.programStageInstances = programStageInstances;
+    }
+
+    private PatientIdentifierService patientIdentifierService;
+
+    private PatientIdentifierTypeService identifierTypeService;
+
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -93,6 +128,10 @@
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
+    
+    private Collection<PatientIdentifierType> identifierTypes;
+
+    private Map<Integer, String> identiferMap;
 
     private Integer patientId;
 
@@ -100,22 +139,23 @@
     {
         this.patientId = patientId;
     }
-    
+
     private Integer programId;
-    
+
     public void setProgramId( Integer programId )
     {
         this.programId = programId;
     }
-    
+
     private Patient patient;
 
     public Patient getPatient()
     {
         return patient;
     }
+
     private Program program;
-    
+
     public Program getProgram()
     {
         return program;
@@ -219,7 +259,22 @@
                 programStageInstances.add( programStageInstance );
             }
         }
-        
+
+        // ---------------------------------------------------------------------
+        // Load identifier types of the selected program
+        // ---------------------------------------------------------------------
+
+        identifierTypes = identifierTypeService.getPatientIdentifierTypes( program );
+        identiferMap = new HashMap<Integer, String>();
+
+        Collection<PatientIdentifier> patientIdentifiers = patientIdentifierService.getPatientIdentifiers(
+            identifierTypes, patient );
+
+        for ( PatientIdentifier identifier : patientIdentifiers )
+        {
+            identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() );
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2011-09-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2012-03-26 06:36:24 +0000
@@ -105,7 +105,7 @@
 
     public String execute()
     {
-        identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
+        identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram();
 
         noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
 

=== 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-03-23 05:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-03-26 06:36:24 +0000
@@ -608,7 +608,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-		<property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="identifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
 	</bean>
 
 	<bean
@@ -620,6 +621,8 @@
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="identifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.SaveDueDateAction"
@@ -667,6 +670,15 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 	
+	<bean
+		id="org.hisp.dhis.caseentry.action.patient.SavePatientIdentifierAction"
+		class="org.hisp.dhis.caseentry.action.patient.SavePatientIdentifierAction"
+		scope="prototype">
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="identifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
+	</bean>
+	
 	<!--  Relationship -->
 	
 		<bean

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-03-23 03:46:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-03-26 06:36:24 +0000
@@ -286,4 +286,5 @@
 A=Approximated
 some_data_element_not_exist = Some data element is not exist
 orgunit_hiererachy_included_on = Organisation unit hiererachy included on
-level = Level
\ No newline at end of file
+level = Level
+patient_identifier_and_attributes = Beneficiary identifier and attributes

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-03-23 05:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-03-26 06:36:24 +0000
@@ -385,17 +385,9 @@
 				,javascript/entry.js
 				,javascript/relationshipPatient.js
 			</param>
-			<param name="stylesheets">style/patient.css</param>
+			<param name="stylesheets">style/patient.css, style/dataEntry.css</param>
 			<param name="requiredAuthorities">F_PATIENT_MANAGEMENT</param>
 		</action>
-		
-		<action name="selectDataRecordingFromRegistration"
-			class="org.hisp.dhis.caseentry.action.caseentry.DataRecordingSelectAction">
-			<result name="success" type="velocity">/content.vm</result>
-			<param name="page">/dhis-web-caseentry/dataRecordingSelect.vm</param>
-			<param name="stylesheets">style/dataEntry.css</param>
-			<param name="requiredAuthorities">F_NAME_BASED_DATA_ENTRY</param>
-		</action>
 
 		<action name="organisationUnitHasPatients"
 			class="org.hisp.dhis.caseentry.action.patient.VerifyOrganisationUnitHasParentAction">
@@ -560,7 +552,13 @@
 			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_PROGRAM_ENROLLMENT</param>
 		</action>
-
+		
+		<action name="savePatientIdentifier"
+			class="org.hisp.dhis.caseentry.action.patient.SavePatientIdentifierAction">
+			<result name="success" type="velocity">status.vm</result>
+			<param name="requiredAuthorities">F_PATIENT_UPDATE, F_PROGRAM_ENROLLMENT</param>
+		</action>
+		
 		<!-- Relationship -->
 
 		<action name="getPartner"

=== 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-03-22 14:17:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-03-26 06:36:24 +0000
@@ -1,3 +1,4 @@
+<link rel="stylesheet" href="javascript/customcheckbox/prettyCheckboxes.css" type="text/css" media="screen" title="prettyComment main stylesheet" charset="utf-8" />
 
 <script>
 	jQuery("#entryFormContainer").ready(function(){
@@ -26,6 +27,8 @@
 			enable('executionDate');
 		}
 		
+		//initCustomCheckboxes();
+			
 		entryFormContainerOnReady();
 			
 	});
@@ -53,7 +56,8 @@
 							$i18n.getString( "orgunit_provided_service" ): $i18n.getString("other_facility")
 						#end
 					#else
-						$i18n.getString( "provided_elsewhere" ) <input type="checkbox" id='$id' onclick="updateProvidingFacility();" #if($programStageInstance.completed) disabled="disabled" #end >
+						$i18n.getString( "provided_elsewhere" ) 
+						<input type="checkbox" id='$id' onclick="updateProvidingFacility();" #if($programStageInstance.completed) disabled="disabled" #end >
 					#end
 				#end
 			</th>
@@ -65,7 +69,7 @@
 		   $customDataEntryFormCode
 
 			<script type="text/javascript"> 
-				#if( $!programStageInstance.programStage.program.anonymous == 'false' )
+				#if( $!programStageInstance.programStage.program.displayProvidedOtherFacility == 'true' )
 					initCustomCheckboxes();
 				#end
 			</script>

=== 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-03-05 07:32:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-03-26 06:36:24 +0000
@@ -231,7 +231,7 @@
 	var programStageId = byId( 'programStageId' ).value;
 	var checkField = byId( programStageId + '_facility');
     checkField.style.backgroundColor = '#ffffcc';
- 
+	
     var facilitySaver = new FacilitySaver( checkField.checked, '#ccffcc' );
     facilitySaver.save();
     
@@ -581,11 +581,6 @@
 //
 //-----------------------------------------------------------------
 
-function initCustomCheckboxes()
-{
-    jQuery('input[type=checkbox][name="providedByAnotherFacility"]').prettyCheckboxes();
-}
-
 function toggleContentForReportDate(show)
 {
     if( show ){
@@ -681,6 +676,11 @@
     }
 };
 
+function initCustomCheckboxes()
+{
+    jQuery('input[type=checkbox]').prettyCheckboxes();
+}
+
 function entryFormContainerOnReady()
 {
 	var currentFocus = undefined;
@@ -701,9 +701,7 @@
         });
 		
         TOGGLE.init();
-		
-		initCustomCheckboxes();
-		
+				
 		jQuery("#entryForm :input").each(function()
 		{ 
 			if( jQuery(this).attr( 'options' )!= null )
@@ -810,3 +808,25 @@
 			input.focus();
 		});
 }
+
+
+//--------------------------------------------------------------------------------------------
+// Show selected data-recording
+//--------------------------------------------------------------------------------------------
+
+function showSelectedDataRecoding( patientId )
+{
+	showLoader();
+	hideById('searchPatientDiv');
+	hideById('dataEntryFormDiv');
+	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', 
+		{
+			patientId: patientId
+		},
+		function()
+		{
+			showById('dataRecordingSelectDiv');
+			hideLoader();
+			hideById('contentDiv');
+		});
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2012-03-23 05:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2012-03-26 06:36:24 +0000
@@ -15,27 +15,6 @@
 }
 
 //--------------------------------------------------------------------------------------------
-// Show selected data-recording
-//--------------------------------------------------------------------------------------------
-
-function showSelectedDataRecoding( patientId )
-{
-	showLoader();
-	hideById('searchPatientDiv');
-	hideById('dataEntryFormDiv');
-	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', 
-		{
-			patientId: patientId
-		},
-		function()
-		{
-			showById('dataRecordingSelectDiv');
-			hideLoader();
-			hideById('contentDiv');
-		});
-}
-
-//--------------------------------------------------------------------------------------------
 // Show search-form
 //--------------------------------------------------------------------------------------------
 

=== 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-03-12 10:20:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-03-26 06:36:24 +0000
@@ -870,41 +870,6 @@
 	jQuery( '#' + rowId ).remove();
 }		
 
-function showSelectedDataRecoding( patientId )
-{
-	showLoader();
-	setInnerHTML('dataRecordingSelectDiv', "");
-	setInnerHTML('dataEntryFormDiv', "");
-	hideById('searchPatientDiv');
-	hideById('dataEntryFormDiv');
-	
-	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecordingFromRegistration.action', 
-		{
-			patientId: patientId
-		},
-		function()
-		{
-			jQuery('#dataRecordingSelectDiv select[name=programId] option').each(function()
-			{
-				var singleEvent = jQuery(this).attr('singleevent');
-				if( singleEvent == 'false')
-				{
-					jQuery(this).remove();
-				}
-			});
-			
-			jQuery('#backBtnFromEntry').hide();
-			jQuery('#programStageIdTR').attr('class','hidden');
-			jQuery('#dueDateTR').attr('class','hidden');
-			hideById('patientInfoDiv');
-			hideById( 'newEncounterBtn' );
-			
-			showById('dataRecordingSelectDiv');
-			
-			hideLoader();
-		});
-}
-
 function showRepresentativeInfo( patientId)
 {
 	jQuery('#representativeInfo' ).dialog({
@@ -932,3 +897,86 @@
 	showById('enrollBtn');
 }
 
+function toogleDiv( div )
+{
+	jQuery( "#" + div ).slideToggle( "fast" );
+}
+
+//--------------------------------------------------------------------------------------------
+// Show search-form
+//--------------------------------------------------------------------------------------------
+
+function savePatientIdentifier( identifierTypeId, field )
+{
+	var patientId = getFieldValue("patientId");
+	field.style.backgroundColor = '#ffffcc';
+	
+	var valueSaver = new PatientIdentifierSaver( patientId, identifierTypeId, field.value, '#ccffcc' );
+    valueSaver.save();
+}
+
+function PatientIdentifierSaver( patientId_, identifierTypeId_, value_, resultColor_  )
+{
+    var SUCCESS = '#ccffcc';
+    var ERROR = '#ccccff';
+	
+    var patientId = patientId_;
+	var identifierTypeId = identifierTypeId_;
+	var value = value_;
+    var resultColor = resultColor_;
+	
+    this.save = function()
+    {
+		var params  = 'patientId=' + patientId;
+			params += '&identifierTypeId=' + identifierTypeId;
+			params += '&value=' + value;
+		
+		$.ajax({
+			   url: "savePatientIdentifier.action",
+			   data: params,
+			   type: "POST",
+			   dataType: "xml",
+			   success: function(result){
+					handleResponse (result);
+			   },
+			   error: function(request,status,errorThrown) {
+					handleHttpError (request);
+			   }
+			});
+    };
+ 
+    function handleResponse( rootElement )
+    {
+        var codeElement = rootElement.getElementsByTagName( 'code' )[0];
+        var code = parseInt( codeElement.firstChild.nodeValue );
+        if ( code == 0 )
+        {
+            markValue( resultColor );
+        }
+        else
+        {
+            if(value!="")
+            {
+                markValue( ERROR );
+                window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+            }
+            else
+            {
+                markValue( resultColor );
+            }
+        }
+    }
+ 
+    function handleHttpError( errorCode )
+    {
+        markValue( ERROR );
+        window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
+    }
+ 
+    function markValue( color )
+    {
+		var programStageId = getFieldValue('programStageId');
+        var element = byId( 'iden' + identifierTypeId );
+        element.style.backgroundColor = color;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm	2012-03-09 07:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm	2012-03-26 06:36:24 +0000
@@ -1,6 +1,4 @@
-
-<h3>$i18n.getString('patient_details_and_history')</h3>
-
+<p></p>
 <div style="margin-bottom:15px">
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportPatientHistory( '$patient.id', 'xls' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportPatientHistory( '$patient.id', 'pdf' )" style="width:140px">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-03-26 06:36:24 +0000
@@ -1,7 +1,35 @@
-<input type='hidden' id='registerEvent' name='registerEvent' value='$registerEvent'>
+<hr>
+<!-- IDENTIFIERS -->
+#if( $identifierTypes.size() > 0)
+	<h3>$i18n.getString('patient_identifier_and_attributes') <img src='../images/down.png' onclick='toogleDiv( "enrollmentInforDiv" );'></h3>
+	<table class='mainPageTable' id='enrollmentInforDiv' name='enrollmentInforDiv' >
+		<col id="stageCol">    
+		<col id="entryCol">    
+		<tr>
+			<th>$i18n.getString( "patient_identifier" )</th>                   
+			<th>$i18n.getString( "value" )</th>        
+		</tr>
+		
+		#set( $tabIndex = 1 )
+		#set( $mark = false )
+		#foreach ($identifierType in $identifierTypes)
+			#set( $identifier = $identiferMap.get( $identifierType.id ) )
+			<tr #alternate( $mark )>
+				<td class='text-column'><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>       
+					<td class="input-column">
+					<input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value='$identifier' class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" onchange='savePatientIdentifier( $identifierType.id, this);' onkeypress="return keyPress(event, this)" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" /></td>
+			</tr>
+		#set( $tabIndex = $tabIndex + 1 )
+		#set( $mark = !$mark  )
+		#end
+	</table>
+#end
+
+<!-- Program-stage-instance list -->
 
 #if( $programStageInstances.size() > 0 )
-	<table class='mainPageTable'>
+<h3>$i18n.getString('program_stage') <img src='../images/down.png' onclick='toogleDiv( "progarmStageListDiv" );'></h3>
+	<table class='mainPageTable hidden' id='progarmStageListDiv' name='progarmStageListDiv' >
 		<col id="noCol">
 		<col id="stageCol">    
 		<col id="entryCol">    

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2012-03-14 02:44:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2012-03-26 06:36:24 +0000
@@ -34,7 +34,7 @@
 	<div id="tabs">
 		<ul>
 			<li><a href="#tab-1">$i18n.getString("enroll_to_program")</a></li>
-			<li><a href="#tab-2">$i18n.getString("register_event")</a></li>
+			<li><a href="#tab-2">$i18n.getString("name_based_data_entry")</a></li>
 		</ul>
 		
 		<!-- Enroll program TAB -->
@@ -110,14 +110,10 @@
 	datePickerValid( 'dateOfIncident' );
 	
 	$( "#tabs" ).tabs( "option", "selected", 0 );
-	#if($registerEvent == 'true')
-		$('#tabs').bind('tabsselect', function(event, ui) {
-			if( ui.index == 1 )
-			{
-				showSelectedDataRecoding( getFieldValue('patientId') );
-			}
-		});
-	#else
-		$("#tabs").tabs("option", "disabled", [1]);
-	#end
+	$('#tabs').bind('tabsselect', function(event, ui) {
+		if( ui.index == 1 )
+		{
+			showSelectedDataRecoding( getFieldValue('patientId') );
+		}
+	});
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm	2011-10-03 06:48:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm	2012-03-26 06:36:24 +0000
@@ -6,6 +6,7 @@
 	"mandatory": "$!{patientIdentifierType.mandatory}",
 	"related": "$!{patientIdentifierType.related}",
 	"noChars": "$!{patientIdentifierType.noChars}",
-	"type": "$!{patientIdentifierType.type}"
+	"type": "$!{patientIdentifierType.type}",
+	"program": "$!encoder.jsonEncode( ${patientIdentifierType.program.name} )"
   }
 }
\ 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/patientidentifiertype/AddPatientIdentifierTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java	2012-02-27 01:07:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java	2012-03-26 06:36:24 +0000
@@ -29,6 +29,8 @@
 
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -45,6 +47,8 @@
 
     private PatientIdentifierTypeService patientIdentifierTypeService;
 
+    private ProgramService programService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -61,6 +65,8 @@
 
     private String type;
 
+    private Integer programId;
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
@@ -85,6 +91,11 @@
         this.description = description;
     }
 
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
     {
         this.patientIdentifierTypeService = patientIdentifierTypeService;
@@ -100,6 +111,11 @@
         this.related = related;
     }
 
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -107,16 +123,18 @@
     public String execute()
         throws Exception
     {
-        PatientIdentifierType patientIdentifierType = new PatientIdentifierType();
-        patientIdentifierType.setName( name );
-        System.out.println("\n\n ==== \n description : " + description );
-        patientIdentifierType.setDescription( description );
-        patientIdentifierType.setRelated( related.booleanValue() );
-        patientIdentifierType.setMandatory( mandatory.booleanValue() );
-        patientIdentifierType.setNoChars( noChars );
-        patientIdentifierType.setType( type );
-
-        patientIdentifierTypeService.savePatientIdentifierType( patientIdentifierType );
+        PatientIdentifierType identifierType = new PatientIdentifierType();
+        identifierType.setName( name );
+        identifierType.setDescription( description );
+        identifierType.setRelated( related.booleanValue() );
+        identifierType.setMandatory( mandatory.booleanValue() );
+        identifierType.setNoChars( noChars );
+        identifierType.setType( type );
+
+        Program program = (programId != null) ? programService.getProgram( programId ) : null;
+        identifierType.setProgram( program );
+
+        patientIdentifierTypeService.savePatientIdentifierType( identifierType );
 
         return SUCCESS;
     }

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ShowUpdatePatientIdentifierTypeForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ShowUpdatePatientIdentifierTypeForm.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ShowUpdatePatientIdentifierTypeForm.java	2012-03-26 06:36:24 +0000
@@ -0,0 +1,113 @@
+/*
+ * 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.patient.action.patientidentifiertype;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ShowUpdatePatientIdentifierTypeForm.java Mar 26, 2012 07:25:51 AM$
+ */
+public class ShowUpdatePatientIdentifierTypeForm
+implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    private ProgramService programService;
+    
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private PatientIdentifierType patientIdentifierType;
+    
+    private Collection<Program> programs;
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public PatientIdentifierType getPatientIdentifierType()
+    {
+        return patientIdentifierType;
+    }
+
+    public Collection<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        patientIdentifierType = patientIdentifierTypeService.getPatientIdentifierType( id );
+
+        programs = programService.getAllPrograms();
+        
+        return SUCCESS;
+    }
+}
+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java	2011-05-25 06:27:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java	2012-03-26 06:36:24 +0000
@@ -29,6 +29,8 @@
 
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -45,6 +47,8 @@
 
     private PatientIdentifierTypeService patientIdentifierTypeService;
 
+    private ProgramService programService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -63,6 +67,8 @@
 
     private String type;
 
+    private Integer programId;
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
@@ -87,6 +93,11 @@
         this.name = name;
     }
 
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
     {
         this.patientIdentifierTypeService = patientIdentifierTypeService;
@@ -107,6 +118,11 @@
         this.related = related;
     }
 
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -123,10 +139,13 @@
             identifierType.setRelated( related.booleanValue() );
             identifierType.setNoChars( noChars );
             identifierType.setType( type );
+
+            Program program = (programId != null) ? programService.getProgram( programId ) : null;
+            identifierType.setProgram( program );
+
             patientIdentifierTypeService.updatePatientIdentifierType( identifierType );
         }
 
         return SUCCESS;
     }
-
 }
\ No newline at end of file

=== 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-03-23 05:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-03-26 06:36:24 +0000
@@ -515,6 +515,9 @@
 		<property name="patientIdentifierTypeService">
 			<ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		</property>
+		<property name="programService">
+			<ref bean="org.hisp.dhis.program.ProgramService" />
+		</property>
 	</bean>
 
 	<bean
@@ -550,6 +553,9 @@
 		<property name="patientIdentifierTypeService">
 			<ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		</property>
+		<property name="programService">
+			<ref bean="org.hisp.dhis.program.ProgramService" />
+		</property>
 	</bean>
 	<bean
 		id="org.hisp.dhis.patient.action.patientidentifiertype.ValidatePatientIdentifierTypeAction"
@@ -560,6 +566,18 @@
 		</property>
 	</bean>
 
+	<bean
+		id="org.hisp.dhis.patient.action.patientidentifiertype.ShowUpdatePatientIdentifierTypeForm"
+		class="org.hisp.dhis.patient.action.patientidentifiertype.ShowUpdatePatientIdentifierTypeForm"
+		scope="prototype">
+		<property name="patientIdentifierTypeService">
+			<ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		</property>
+		<property name="programService">
+			<ref bean="org.hisp.dhis.program.ProgramService" />
+		</property>
+	</bean>
+	
 	<!-- Case Aggregation Mapping -->
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-03-23 05:58:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-03-26 06:36:24 +0000
@@ -4,9 +4,10 @@
 "http://struts.apache.org/dtds/struts-2.0.dtd";>
 <struts>
 
-  <include file="dhis-web-commons.xml" />
+	<include file="dhis-web-commons.xml" />
 
-  <package name="dhis-web-maintenance-patient" extends="dhis-web-commons" namespace="/dhis-web-maintenance-patient">
+	<package name="dhis-web-maintenance-patient" extends="dhis-web-commons"
+		namespace="/dhis-web-maintenance-patient">
 
 		<action name="index" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -104,7 +105,7 @@
 				/dhis-web-commons/ajax/jsonPatientAttributes.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="getProgramAttributeWithoutGroup"
 			class="org.hisp.dhis.patient.action.patientattribute.GetPatientAttributesWithoutGroupAction">
 			<result name="success" type="velocity-json">
@@ -224,7 +225,7 @@
 			<param name="requiredAuthorities">F_PROGRAM_ADD</param>
 		</action>
 
-		
+
 		<action name="showAddProgramForm"
 			class="org.hisp.dhis.patient.action.program.ShowAddProgramFormAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -528,8 +529,7 @@
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
 		</action>
 
-		<action name="showAddPatientAttributeGroupForm"
-			class="org.hisp.dhis.patient.action.NoAction">
+		<action name="showAddPatientAttributeGroupForm" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/addPatientAttributeGroupForm.vm</param>
 			<param name="javascripts">javascript/patientAttributeGroup.js</param>
@@ -581,7 +581,8 @@
 
 		<!-- Patient Identifier Type -->
 
-		<action name="showAddPatientIdentifierTypeForm" class="org.hisp.dhis.patient.action.NoAction">
+		<action name="showAddPatientIdentifierTypeForm"
+			class="org.hisp.dhis.patient.action.program.GetProgramListAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">
 				/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm</param>
@@ -602,7 +603,7 @@
 		</action>
 
 		<action name="showUpdatePatientIdentifierTypeForm"
-			class="org.hisp.dhis.patient.action.patientidentifiertype.GetPatientIdentifierTypeAction">
+			class="org.hisp.dhis.patient.action.patientidentifiertype.ShowUpdatePatientIdentifierTypeForm">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">
 				/dhis-web-maintenance-patient/updatePatientIdentifierType.vm</param>
@@ -696,10 +697,10 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 		</action>
 
-		<action name="getDataElementsByDataset"
-			class="org.hisp.dhis.commons.action.GetDataSetAction">
+		<action name="getDataElementsByDataset" class="org.hisp.dhis.commons.action.GetDataSetAction">
 			<result name="success" type="velocity-json">
-				/dhis-web-maintenance-patient/responseAggerateDataElement.vm</result>
+				/dhis-web-maintenance-patient/responseAggerateDataElement.vm
+			</result>
 		</action>
 
 		<action name="getProgramStages"
@@ -715,7 +716,7 @@
 				/dhis-web-maintenance-patient/responsePSDataElement.vm
 			</result>
 		</action>
-		
+
 		<action name="getAggPSDataElements"
 			class="org.hisp.dhis.patient.action.caseaggregation.GetAggPSDataElementsAction">
 			<result name="success" type="velocity-xml">
@@ -745,7 +746,7 @@
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="testCaseAggregationCondition"
 			class="org.hisp.dhis.patient.action.caseaggregation.TestCaseAggregationConditionAction">
 			<result name="success" type="velocity-json">
@@ -760,7 +761,7 @@
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/caseAggregationList.vm</param>
 		</action>
-		
+
 		<!-- Validation - PatientValidationCriteria -->
 
 		<action name="validationCriteria"
@@ -863,7 +864,7 @@
 			<param name="stylesheets">style/basic.css</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="defineDateProgramValidationForm"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -917,20 +918,20 @@
 				/dhis-web-commons/ajax/jsonProgramValidation.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="getDateDataElements"
 			class="org.hisp.dhis.patient.action.validation.GetDateDataElementsAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/dateProgramValidationForm.vm</param>
 		</action>
-		
+
 		<action name="addDateProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.AddProgramValidationAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="updateDateProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.UpdateProgramValidationAction">
 			<result name="success" type="velocity-json">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2012-03-26 06:36:24 +0000
@@ -64,6 +64,20 @@
 			</td>
 			<td></td>
 		</tr>
+		
+		<tr>
+			<td><label for="programId">$i18n.getString( "program" )</label></td>
+			<td>
+				<select type="text" name="programId" id="programId" value="$!patientIdentifierType.program" >
+					<option value=''>$i18n.getString('all')</option>
+					#foreach( $program in $programs)
+						<option value='$program.id'>$program.name</option>
+					#end
+				</select>
+			</td>		
+			<td></td>				
+		</tr> 
+		
 		<tbody>
 		<tr>
 			<td></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-03-21 05:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-03-26 06:36:24 +0000
@@ -36,16 +36,15 @@
 				de.add(option, null);  			
 			}
 			
-			autoCompletedField( '' );
+			autoCompletedField();
 		});
 }
 
-function autoCompletedField( id )
+function autoCompletedField( )
 {
 	var select = jQuery( "#aggregationDataElementId" );
 	$( "#dataElementsButton" ).unbind('click');
 	enable( 'dataElementsButton' );
-	hideById( id );
 	var selected = select.children( ":selected" );
 	var value = selected.val() ? selected.text() : "";
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js	2012-03-13 09:47:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js	2012-03-26 06:36:24 +0000
@@ -21,6 +21,9 @@
 			var valueType = json.patientIdentifierType.type;
 			setInnerHTML( 'typeField', valueTypeMap[valueType] );
 			
+			var valueType = json.patientIdentifierType.type;
+			setInnerHTML( 'programField', json.patientIdentifierType.program );
+			
 			showDetails();
 	});
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm	2012-01-11 07:42:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatientIdentifierType.vm	2012-03-26 06:36:24 +0000
@@ -55,6 +55,7 @@
 				<p><label class="bold">$i18n.getString( "related" ):</label><br><span id="relatedField"></span></p>
 				<p><label class="bold">$i18n.getString( "no_of_char" ):</label><br><span id="noCharsField"></span></p>
 				<p><label class="bold">$i18n.getString( "type" ):</label><br><span id="typeField"></span></p>
+				<p><label class="bold">$i18n.getString( "program" ):</label><br><span id="programField"></span></p>
 			</div>
 		</td>
   </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2012-03-26 06:36:24 +0000
@@ -65,6 +65,20 @@
 			</td>		
 			<td></td>				
 		</tr>
+		
+		<tr>
+			<td><label for="programId">$i18n.getString( "program" )</label></td>
+			<td>
+				<select type="text" name="programId" id="programId" value="$!patientIdentifierType.program" >
+					<option value=''>$i18n.getString('all')</option>
+					#foreach( $program in $programs)
+						<option value='$program.id' #if($patientIdentifierType.program.id==$program.id) selected #end>$program.name</option>
+					#end
+				</select>
+			</td>		
+			<td></td>				
+		</tr> 
+		
 	</tbody>
 	<tr>
 		<td></td>