← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13573: Remove name property of Patient object. In Add/Update program form, add validation for checking a...

 

------------------------------------------------------------
revno: 13573
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-01-05 21:04:13 +0700
message:
  Remove name property of Patient object. In Add/Update program form, add validation for checking at least an attribute/identifier selected for a program.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.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/program/hibernate/HibernateProgramInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientReminderServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchRelationshipPatientAction.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/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java
  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/webapp/dhis-web-caseentry/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.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/javascript/singleEvent.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatientDetails.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatients.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responseRelationshipPatients.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.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/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2014-01-03 10:31:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2014-01-05 14:04:13 +0000
@@ -95,6 +95,8 @@
 
     private Integer sortOrderInVisitSchedule;
 
+    private Boolean displayedInList = false;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -276,6 +278,23 @@
         this.sortOrderInVisitSchedule = sortOrderInVisitSchedule;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Boolean getDisplayedInList()
+    {
+        return displayedInList;
+    }
+
+    public void setDisplayedInList( Boolean displayedInList )
+    {
+        this.displayedInList = displayedInList;
+    }
+
+    // -------------------------------------------------------------------------
+    // Static methods
+    // -------------------------------------------------------------------------
+    
     public static Date getDateFromAge( int age )
     {
         Calendar todayCalendar = Calendar.getInstance();
@@ -288,7 +307,7 @@
 
         return todayCalendar.getTime();
     }
-    
+
     public static int getAgeFromDate( Date date )
     {
         Calendar birthCalendar = Calendar.getInstance();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java	2013-11-11 02:42:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java	2014-01-05 14:04:13 +0000
@@ -47,8 +47,6 @@
 
     public static final String INCIDENT_DATE_TO_COMPARE = "dateofincident";
 
-    public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-name}";
-
     public static final String TEMPLATE_MESSSAGE_PROGRAM_NAME = "{program-name}";
 
     public static final String TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME = "{program-stage-name}";

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-12-16 04:27:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2014-01-05 14:04:13 +0000
@@ -103,26 +103,6 @@
     Collection<Patient> getAllPatients();
 
     /**
-     * Retrieve patients by full name (performs partial search )
-     * 
-     * @param name fullName
-     * @return Patient List
-     */
-    Collection<Patient> getPatientsByNames( String name, Integer min, Integer max );
-
-    /**
-     * Retrieve patients base on full-name or identifier value with result
-     * limited
-     * 
-     * @param searchText value
-     * @param min
-     * @param max
-     * 
-     * @return Patient List
-     */
-    Collection<Patient> getPatients( String searchText, Integer min, Integer max );
-
-    /**
      * Retrieve patients for mobile base on identifier value
      * 
      * @param searchText value
@@ -162,17 +142,6 @@
     Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program );
 
     /**
-     * Retrieve patients base on organisationUnit and identifier value name
-     * 
-     * @param organisationUnit
-     * @param searchText identifier value
-     * @param min
-     * @param max
-     * @return
-     */
-    Collection<Patient> getPatientsLikeName( OrganisationUnit organisationUnit, String name, Integer min, Integer max );
-
-    /**
      * Retrieve patients base on PatientIdentifierType or Attribute or Patient's
      * name
      * 
@@ -212,25 +181,7 @@
      * @return Patient List
      * **/
     Collection<Patient> getRepresentatives( Patient patient );
-
-    /**
-     * Search Patient base on identifier value and get number of result
-     * 
-     * @param searchText
-     * 
-     * @return number of patients
-     */
-    int countGetPatients( String searchText );
-
-    /**
-     * Search Patient base on name and get number of result
-     * 
-     * @param name
-     * 
-     * @return number of patients
-     */
-    int countGetPatientsByName( String name );
-
+    
     /**
      * Register a new patient
      * 
@@ -345,7 +296,7 @@
      * @param statusEnrollment The status of program of patients. There are
      *        three status, includes Active enrollments only, Completed
      *        enrollments only and Active and completed enrollments
-     * @parma min
+     * @param min
      * @param max
      * 
      * @return List of patient
@@ -405,18 +356,6 @@
     Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max );
 
     /**
-     * Search patients who registered into a certain organisation unit by
-     * full-name
-     * 
-     * @param fullName The full name of patient
-     * @param organisationUnit Organisation Unit where patients registered
-     *        private information
-     * 
-     * @return List of patient
-     */
-    Collection<Patient> getPatientByFullname( String fullName, OrganisationUnit organisationUnit );
-
-    /**
      * Get events of patients who meet the criteria for searching
      * 
      * @param program Program. It's is used for getting identifier-types of this

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2014-01-05 14:04:13 +0000
@@ -48,17 +48,6 @@
     final int MAX_RESULTS = 50000;
 
     /**
-     * Search patients by full name (performs partial search )
-     * 
-     * @param name Full name of patients
-     * @param min
-     * @param max
-     * 
-     * @return List of patients
-     */
-    Collection<Patient> getByNames( String name, Integer min, Integer max );
-
-    /**
      * Search patients who registered in a certain organisation unit
      * 
      * @param organisationUnit Organisation unit where patients registered
@@ -70,20 +59,6 @@
     Collection<Patient> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max );
 
     /**
-     * Search patients who registered in a certain organisation unit by full
-     * name (performs partial search)
-     * 
-     * @param organisationUnit Organisation unit where patients registered
-     * @param nameLike A string for searching by full name
-     * @param min
-     * @param max
-     * 
-     * @return List of patient
-     */
-    Collection<Patient> getByOrgUnitAndNameLike( OrganisationUnit organisationUnit, String nameLike, Integer min,
-        Integer max );
-
-    /**
      * Search patients registered into a certain organisation unit and enrolled
      * into a program with active status
      * 
@@ -169,18 +144,6 @@
     Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max );
 
     /**
-     * Search patients who registered into a certain organisation unit by
-     * full-name
-     * 
-     * @param fullName The full name of patient
-     * @param organisationUnit Organisation Unit where patients registered
-     *        private information
-     * 
-     * @return List of patient
-     */
-    Collection<Patient> getByFullName( String name, OrganisationUnit organisationUnit );
-
-    /**
      * Search events of patients who meet the criteria for searching
      * 
      * @param searchKeys The key for searching patients by attribute values,

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2014-01-02 13:13:21 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2014-01-05 14:04:13 +0000
@@ -116,14 +116,6 @@
     }
 
     @Override
-    public Persons getPersons( OrganisationUnit organisationUnit, String nameLike )
-    {
-        List<Patient> patients = new ArrayList<Patient>( patientService.getPatientsLikeName( organisationUnit,
-            nameLike, 0, Integer.MAX_VALUE ) );
-        return getPersons( patients );
-    }
-
-    @Override
     public Persons getPersons( Program program )
     {
         List<Patient> patients = new ArrayList<Patient>( patientService.getPatients( program ) );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2013-12-30 11:47:50 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2014-01-05 14:04:13 +0000
@@ -53,8 +53,6 @@
 
     Persons getPersons( OrganisationUnit organisationUnit );
 
-    Persons getPersons( OrganisationUnit organisationUnit, String nameLike );
-
     Persons getPersons( Program program );
 
     Persons getPersons( OrganisationUnit organisationUnit, Program program );
@@ -69,9 +67,11 @@
     // CREATE
     // -------------------------------------------------------------------------
 
-    ImportSummaries savePersonXml( InputStream inputStream ) throws IOException;
+    ImportSummaries savePersonXml( InputStream inputStream )
+        throws IOException;
 
-    ImportSummaries savePersonJson( InputStream inputStream ) throws IOException;
+    ImportSummaries savePersonJson( InputStream inputStream )
+        throws IOException;
 
     ImportSummary savePerson( Person person );
 
@@ -79,9 +79,11 @@
     // UPDATE
     // -------------------------------------------------------------------------
 
-    ImportSummary updatePersonXml( String id, InputStream inputStream ) throws IOException;
+    ImportSummary updatePersonXml( String id, InputStream inputStream )
+        throws IOException;
 
-    ImportSummary updatePersonJson( String id, InputStream inputStream ) throws IOException;
+    ImportSummary updatePersonJson( String id, InputStream inputStream )
+        throws IOException;
 
     ImportSummary updatePerson( Person person );
 

=== 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	2013-12-30 12:23:52 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2014-01-05 14:04:13 +0000
@@ -494,7 +494,7 @@
         if ( isNumber( keyword ) == false )
         {
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-            List<Patient> patients = (List<Patient>) patientService.getPatientByFullname( keyword, organisationUnit );
+            List<Patient> patients = new ArrayList<Patient>();
 
             if ( patients.size() > 1 )
             {
@@ -1308,7 +1308,7 @@
 
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
             String fullName = enrollmentRelationship.getPersonBName();
-            List<Patient> patients = (List<Patient>) patientService.getPatientByFullname( fullName, organisationUnit );
+            List<Patient> patients = new ArrayList<Patient>();
 
             // remove the own searcher
             patients = removeIfDuplicated( patients, enrollmentRelationship.getPersonAId() );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientReminderService.java	2014-01-05 14:04:13 +0000
@@ -56,7 +56,6 @@
         Patient patient = programInstance.getPatient();
         String templateMessage = patientReminder.getTemplateMessage();
 
-        String patientName = patient.getName();
         String organisationunitName = patient.getOrganisationUnit().getName();
         String programName = programInstance.getProgram().getName();
         String daysSinceEnrollementDate = DateUtils.daysBetween( new Date(), programInstance.getEnrollmentDate() ) + "";
@@ -64,11 +63,6 @@
         String incidentDate = format.formatDate( programInstance.getDateOfIncident() );
         String erollmentDate = format.formatDate( programInstance.getEnrollmentDate() );
 
-        if ( patientName != null )
-        {
-            templateMessage = templateMessage.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
-        }
-
         templateMessage = templateMessage.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
         templateMessage = templateMessage
             .replace( PatientReminder.TEMPLATE_MESSSAGE_ORGUNIT_NAME, organisationunitName );
@@ -89,17 +83,12 @@
         Patient patient = programStageInstance.getProgramInstance().getPatient();
         String templateMessage = patientReminder.getTemplateMessage();
 
-        String patientName = patient.getName();
         String organisationunitName = patient.getOrganisationUnit().getName();
         String programName = programStageInstance.getProgramInstance().getProgram().getName();
         String programStageName = programStageInstance.getProgramStage().getName();
         String daysSinceDueDate = DateUtils.daysBetween( new Date(), programStageInstance.getDueDate() ) + "";
         String dueDate = format.formatDate( programStageInstance.getDueDate() );
 
-        if ( patientName != null )
-        {
-            templateMessage = templateMessage.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
-        }
         templateMessage = templateMessage.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
         templateMessage = templateMessage.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME,
             programStageName );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2014-01-05 14:04:13 +0000
@@ -198,52 +198,10 @@
     }
 
     @Override
-    public Collection<Patient> getPatients( String searchText, Integer min, Integer max )
-    {
-        int countPatientName = patientStore.countGetPatientsByName( searchText );
-
-        Set<Patient> patients = new HashSet<Patient>();
-
-        if ( max < countPatientName )
-        {
-            patients.addAll( getPatientsByNames( searchText, min, max ) );
-
-            min = min - patients.size();
-        }
-        else
-        {
-            if ( min <= countPatientName )
-            {
-                patients.addAll( getPatientsByNames( searchText, min, countPatientName ) );
-
-                min = 0;
-                max = max - countPatientName;
-
-                Collection<Patient> patientsByIdentifier = patientIdentifierService.getPatientsByIdentifier(
-                    searchText, min, max );
-
-                patients.addAll( patientsByIdentifier );
-            }
-            else
-            {
-                min = 0;
-                max = max - countPatientName;
-
-                Collection<Patient> patientsByIdentifier = patientIdentifierService.getPatientsByIdentifier(
-                    searchText, min, max );
-
-                patients.addAll( patientsByIdentifier );
-            }
-        }
-        return patients;
-    }
-
-    @Override
     public Collection<Patient> getPatientsForMobile( String searchText, int orgUnitId )
     {
         Set<Patient> patients = new HashSet<Patient>();
         patients.addAll( patientIdentifierService.getPatientsByIdentifier( searchText, 0, Integer.MAX_VALUE ) );
-        patients.addAll( getPatientsByNames( searchText, 0, Integer.MAX_VALUE ) );
         patients.addAll( getPatientsByPhone( searchText, 0, Integer.MAX_VALUE ) );
 
         // if an org-unit has been selected, filter out every patient that has a
@@ -285,13 +243,6 @@
     }
 
     @Override
-    public Collection<Patient> getPatientsLikeName( OrganisationUnit organisationUnit, String name, Integer min,
-        Integer max )
-    {
-        return patientStore.getByOrgUnitAndNameLike( organisationUnit, name, min, max );
-    }
-
-    @Override
     public Collection<Patient> getPatient( Integer identifierTypeId, Integer attributeId, String value )
     {
         if ( attributeId != null )
@@ -319,8 +270,7 @@
             }
         }
 
-        return patientStore.getByNames( value, null, null );
-
+        return null;
     }
 
     @Override
@@ -359,25 +309,6 @@
     }
 
     @Override
-    public Collection<Patient> getPatientsByNames( String name, Integer min, Integer max )
-    {
-        return patientStore.getByNames( name.toLowerCase(), min, max );
-    }
-
-    @Override
-    public int countGetPatients( String searchText )
-    {
-        return patientStore.countGetPatientsByName( searchText )
-            + patientIdentifierService.countGetPatientsByIdentifier( searchText );
-    }
-
-    @Override
-    public int countGetPatientsByName( String name )
-    {
-        return patientStore.countGetPatientsByName( name );
-    }
-
-    @Override
     public int countGetPatientsByOrgUnit( OrganisationUnit organisationUnit )
     {
         return patientStore.countListPatientByOrgunit( organisationUnit );
@@ -515,7 +446,7 @@
         Collection<Patient> patients = patientStore.search( searchKeys, orgunits, followup, null, null,
             statusEnrollment, min, max );
         Set<String> phoneNumbers = new HashSet<String>();
-		
+
         for ( Patient patient : patients )
         {
             Collection<PatientAttributeValue> attributeValues = patient.getAttributeValues();
@@ -639,12 +570,6 @@
     }
 
     @Override
-    public Collection<Patient> getPatientByFullname( String fullName, OrganisationUnit organisationUnit )
-    {
-        return patientStore.getByFullName( fullName, organisationUnit );
-    }
-
-    @Override
     public int validatePatient( Patient patient, Program program )
     {
         return patientStore.validate( patient, program );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2014-01-05 14:04:13 +0000
@@ -101,17 +101,6 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public Collection<Patient> getByNames( String fullName, Integer min, Integer max )
-    {
-        if ( min == null || max == null )
-        {
-            return getAllLikeNameOrderedName( fullName, 0, Integer.MAX_VALUE );
-        }
-
-        return getAllLikeNameOrderedName( fullName, min, max );
-    }
-
-    @Override
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max )
     {
@@ -130,26 +119,6 @@
 
     @Override
     @SuppressWarnings( "unchecked" )
-    public Collection<Patient> getByOrgUnitAndNameLike( OrganisationUnit organisationUnit, String nameLike,
-        Integer min, Integer max )
-    {
-        String hql = "select p from Patient p where p.organisationUnit = :organisationUnit "
-            + " and lower(p.name) like :nameLike" + " order by p.name";
-
-        Query query = getQuery( hql );
-        query.setEntity( "organisationUnit", organisationUnit );
-        query.setString( "nameLike", "%" + nameLike.toLowerCase() + "%" );
-
-        if ( min != null && max != null )
-        {
-            query.setFirstResult( min ).setMaxResults( max );
-        }
-
-        return query.list();
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnitProgram( OrganisationUnit organisationUnit, Program program, Integer min,
         Integer max )
     {
@@ -329,7 +298,7 @@
         criteria.createAlias( "attributeValue.patientAttribute", "patientAttribute" );
         criteria.add( Restrictions.eq( "patientAttribute.valueType", PatientAttribute.TYPE_PHONE_NUMBER ) );
         criteria.add( Restrictions.like( "attributeValue.value", phoneNumber ) );
-        
+
         if ( min != null && max != null )
         {
             criteria.setFirstResult( min );
@@ -339,20 +308,6 @@
         return criteria.list();
     }
 
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public Collection<Patient> getByFullName( String name, OrganisationUnit organisationUnit )
-    {
-        Criteria criteria = getCriteria( Restrictions.eq( "name", name ).ignoreCase() );
-
-        if ( organisationUnit != null )
-        {
-            criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
-        }
-
-        return criteria.setMaxResults( MAX_RESULTS ).list();
-    }
-
     @SuppressWarnings( "unchecked" )
     public Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate )
     {
@@ -447,7 +402,7 @@
         Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min, Integer max )
     {
         String selector = count ? "count(*) " : "* ";
-        String sql = "select " + selector + " from ( select distinct p.patientid, p.name,";
+        String sql = "select " + selector + " from ( select distinct p.patientid,";
 
         if ( identifierTypes != null )
         {
@@ -470,7 +425,7 @@
 
         String patientWhere = "";
         String patientOperator = " where ";
-        String patientGroupBy = " GROUP BY  p.patientid, p.name ";
+        String patientGroupBy = " GROUP BY  p.patientid ";
         String otherWhere = "";
         String operator = " where ";
         String orderBy = "";
@@ -509,7 +464,7 @@
                 String opt = "";
                 for ( String v : keyValues )
                 {
-                    patientWhere += opt + " lower( p.name ) like '%" + v + "%' or ( lower(pi.identifier) like '%" + v
+                    patientWhere += opt + " ( lower(pi.identifier) like '%" + v
                         + "%' and pi.patientidentifiertypeid is not null ) ";
                     opt = "or";
                 }
@@ -538,11 +493,11 @@
             }
             else if ( keys[0].equals( PREFIX_PROGRAM ) )
             {
-                sql += "(select programid from programinstance pi where patientid=p.patientid and programid=" + id;
+                sql += "(select programid from programinstance pgi where patientid=p.patientid and programid=" + id;
 
                 if ( statusEnrollment != null )
                 {
-                    sql += " and pi.status=" + statusEnrollment;
+                    sql += " and pgi.status=" + statusEnrollment;
                 }
 
                 sql += " limit 1 ) as " + PREFIX_PROGRAM + "_" + id + ",";
@@ -752,12 +707,12 @@
             if ( isPriorityEvent )
             {
                 subSQL += ",pgi.followup ";
-                orderBy = " ORDER BY pgi.followup desc, p.patientid, p.name, duedate asc ";
+                orderBy = " ORDER BY pgi.followup desc, p.patientid, duedate asc ";
                 patientGroupBy += ",pgi.followup ";
             }
             else
             {
-                orderBy = " ORDER BY p.patientid, p.name, duedate asc ";
+                orderBy = " ORDER BY p.patientid, duedate asc ";
             }
 
             sql = sql + subSQL + from + " inner join programinstance pgi on " + " (pgi.patientid=p.patientid) "

=== 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	2014-01-02 13:45:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2014-01-05 14:04:13 +0000
@@ -286,10 +286,10 @@
         updateCoordinatesProgramStageInstance();
 
         addPatientAttributes();
-        
 
         executeSql( "ALTER TABLE program DROP COLUMN useBirthDateAsIncidentDate" );
         executeSql( "ALTER TABLE program DROP COLUMN useBirthDateAsEnrollmentDate" );
+        executeSql( "update patientattribute set displayedInList=false where displayedInList is null" );
     }
 
     // -------------------------------------------------------------------------
@@ -465,11 +465,12 @@
             Statement statement = holder.getStatement();
 
             ResultSet resultSet = statement.executeQuery( "SELECT gender FROM patientattribute" );
-            
+
             // Only execute once
             if ( !resultSet.next() )
             {
-                int max = jdbcTemplate.queryForObject( "select max(patientattributeid) from patientattribute", Integer.class );
+                int max = jdbcTemplate.queryForObject( "select max(patientattributeid) from patientattribute",
+                    Integer.class );
 
                 // ---------------------------------------------------------------------
                 // Gender
@@ -486,8 +487,8 @@
                     + "','Gender', 'Gender','"
                     + PatientAttribute.TYPE_COMBO + "', false, false, false)" );
 
-                int maxOpt = jdbcTemplate
-                    .queryForObject( "select max(patientattributeoptionid) from patientattributeoption", Integer.class );
+                int maxOpt = jdbcTemplate.queryForObject(
+                    "select max(patientattributeoptionid) from patientattributeoption", Integer.class );
                 maxOpt++;
                 executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('"
                     + maxOpt + "', 'F'," + max + ")" );
@@ -515,7 +516,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "gender", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='gender' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='gender' " );
 
                 // ---------------------------------------------------------------------
                 // Death date
@@ -537,8 +539,8 @@
                 // Update custom entry form && Validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "deathDate", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='deathDate' ");
-
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='deathDate' " );
 
                 // ---------------------------------------------------------------------
                 // registrationDate
@@ -561,7 +563,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "registrationDate", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='registrationDate' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='registrationDate' " );
 
                 // ---------------------------------------------------------------------
                 // isDead
@@ -583,8 +586,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "isDead", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='isDead' ");
-
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='isDead' " );
 
                 // ---------------------------------------------------------------------
                 // underAge
@@ -606,7 +609,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "underAge", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='underAge' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='underAge' " );
 
                 // ---------------------------------------------------------------------
                 // DobType
@@ -652,7 +656,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "dobType", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='dobType' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='dobType' " );
 
                 // -------------------------------------------------------------
                 // Birthdate
@@ -674,7 +679,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "birthDate", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='birthDate' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='birthDate' " );
 
                 // -------------------------------------------------------------
                 // Age
@@ -696,7 +702,8 @@
                 // Update custom entry form && validation criteria
                 removeFixedAttributeInCustomRegistrationForm( "age", uid );
                 executeSql( "UPDATE validationcriteria SET property='" + resultSet.getInt( "property" )
-                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" ) + " and property='age' ");
+                    + "' WHERE validationcriteriaid=" + resultSet.getInt( "validationcriteriaid" )
+                    + " and property='age' " );
 
                 // -------------------------------------------------------------
                 // Phone number
@@ -717,7 +724,7 @@
 
                 // Update custom entry form
                 removeFixedAttributeInCustomRegistrationForm( "phoneNumber", uid );
-                
+
                 // -------------------------------------------------------------
                 // Update Case Aggregate Query Builder
                 // -------------------------------------------------------------
@@ -727,6 +734,26 @@
                     + CaseAggregationCondition.SEPARATOR_OBJECT + max + ".age]";
                 updateFixedAttributeInCaseAggregate( source, target );
 
+                // Patient full name
+
+                uid = CodeGenerator.generateCode();
+                executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES ("
+                    + max
+                    + ",'"
+                    + uid
+                    + "','"
+                    + DateUtils.getMediumDateString()
+                    + "','Full name', 'Full name','"
+                    + PatientAttribute.TYPE_STRING + "', false, false, false)" );
+                executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid,"
+                    + max + ",name from patient where name is not null" );
+
+                // Update custom entry form
+                removeFixedAttributeInCustomRegistrationForm( "fullName", uid );
+
+                // update template messsages
+                updateFixedAttributeInTemplateMessage();
+
                 executeSql( "ALTER TABLE patient DROP COLUMN gender" );
                 executeSql( "ALTER TABLE patient DROP COLUMN deathDate" );
                 executeSql( "ALTER TABLE patient DROP COLUMN registrationDate" );
@@ -735,7 +762,9 @@
                 executeSql( "ALTER TABLE patient DROP COLUMN dobType" );
                 executeSql( "ALTER TABLE patient DROP COLUMN birthdate" );
                 executeSql( "ALTER TABLE patient DROP COLUMN phoneNumber" );
+                executeSql( "ALTER TABLE patient DROP COLUMN name" );
             }
+
         }
         catch ( Exception ex )
         {
@@ -773,6 +802,38 @@
         }
     }
 
+    private void updateFixedAttributeInTemplateMessage()
+    {
+        StatementHolder holder = statementManager.getHolder();
+        try
+        {
+            Statement statement = holder.getStatement();
+
+            ResultSet resultSet = statement.executeQuery( "" );
+
+            while ( resultSet.next() )
+            {
+                String id = resultSet.getString( "patientreminderid" );
+                String expression = resultSet.getString( "templatemessage" );
+
+                expression = expression
+                    .replaceAll(
+                        "SELECT patientreminderid, templatemessage FROM patientreminder where templatemessage like '%{patient-name}%'",
+                        "Sir/Madam" );
+                executeSql( "UPDATE patientreminder SET templatemessage='" + expression + "'  WHERE patientreminderid="
+                    + id );
+            }
+        }
+        catch ( Exception ex )
+        {
+            log.debug( ex );
+        }
+        finally
+        {
+            holder.close();
+        }
+    }
+
     public void removeFixedAttributeInCustomRegistrationForm( String property, String uid )
     {
         StatementHolder holder = statementManager.getHolder();

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2014-01-05 14:04:13 +0000
@@ -252,7 +252,6 @@
             for ( int i = 1; i <= cols; i++ )
             {
                 message = rs.getString( "templatemessage" );
-                String patientName = rs.getString( "name" );
                 String organisationunitName = rs.getString( "orgunitName" );
                 String programName = rs.getString( "programName" );
                 String incidentDate = rs.getString( "dateofincident" ).split( " " )[0];// just
@@ -268,7 +267,6 @@
                 // timestamp
                 String daysSinceEnrollementDate = rs.getString( "days_since_erollment_date" );
 
-                message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_ORGUNIT_NAME, organisationunitName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_INCIDENT_DATE, incidentDate );
@@ -293,7 +291,7 @@
     private String sendToPatientSql( String dateToCompare )
     {
         return "SELECT pi.programinstanceid, pav.value as phonenumber, prm.templatemessage, "
-            + "         p.name, org.name as orgunitName, " + "         pg.name as programName, pi.dateofincident , "
+            + "         org.name as orgunitName, " + "         pg.name as programName, pi.dateofincident , "
             + "         pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
             + "         (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
             + "       FROM patient p INNER JOIN programinstance pi "
@@ -313,7 +311,7 @@
 
     private String sendToHealthWorkerSql( String dateToCompare )
     {
-        return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, p.name, org.name as orgunitName, "
+        return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, org.name as orgunitName, "
             + "   pg.name as programName, pi.dateofincident, pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
             + "       (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
             + "    FROM patient p INNER JOIN programinstance pi "
@@ -332,7 +330,7 @@
 
     private String sendMessageToOrgunitRegisteredSql( String dateToCompare )
     {
-        return "SELECT pi.programinstanceid, org.phonenumber, prm.templatemessage, p.name, org.name as orgunitName, "
+        return "SELECT pi.programinstanceid, org.phonenumber, prm.templatemessage, org.name as orgunitName, "
             + "   pg.name as programName, pi.dateofincident, pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
             + "       (DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
             + "    FROM patient p INNER JOIN programinstance pi "
@@ -349,7 +347,7 @@
 
     private String sendMessageToUsersSql( String dateToCompare )
     {
-        return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, p.name, org.name as orgunitName, pg.name as programName, pi.dateofincident ,"
+        return "SELECT pi.programinstanceid, uif.phonenumber, prm.templatemessage, org.name as orgunitName, pg.name as programName, pi.dateofincident ,"
             + "pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
             + "(DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
             + "FROM patient p INNER JOIN programinstance pi "
@@ -375,7 +373,7 @@
 
     private String sendMessageToUserGroupsSql( String dateToCompare )
     {
-        return "select pi.programinstanceid, uif.phonenumber,prm.templatemessage, p.name, org.name as orgunitName ,"
+        return "select pi.programinstanceid, uif.phonenumber,prm.templatemessage, org.name as orgunitName ,"
             + " pg.name as programName, pi.dateofincident, pi.enrollmentdate, (DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
             + "(DATE(now()) - DATE(pi.dateofincident) ) as days_since_incident_date "
             + "  from patient p INNER JOIN programinstance pi " + "       ON p.patientid=pi.patientid "

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2014-01-05 14:04:13 +0000
@@ -195,7 +195,6 @@
             for ( int i = 1; i <= cols; i++ )
             {
                 message = rs.getString( "templatemessage" );
-                String patientName = rs.getString( "name" );
                 String organisationunitName = rs.getString( "orgunitName" );
                 String programName = rs.getString( "programName" );
                 String programStageName = rs.getString( "programStageName" );
@@ -206,7 +205,6 @@
                 // remove
                 // timestamp
 
-                message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME, programStageName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_DUE_DATE, dueDate );
@@ -569,7 +567,7 @@
 
     private String sendMessageToPatientSql()
     {
-        return "select psi.programstageinstanceid, pav.value as phonenumber, prm.templatemessage, p.name, org.name as orgunitName "
+        return "select psi.programstageinstanceid, pav.value as phonenumber, prm.templatemessage, org.name as orgunitName "
             + ",pg.name as programName, ps.name as programStageName, psi.duedate,(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
             + "from patient p INNER JOIN programinstance pi "
             + "     ON p.patientid=pi.patientid "
@@ -598,7 +596,7 @@
 
     private String sendMessageToHealthWorkerSql()
     {
-        return "SELECT psi.programstageinstanceid, uif.phonenumber, prm.templatemessage, p.name, org.name as orgunitName, "
+        return "SELECT psi.programstageinstanceid, uif.phonenumber, prm.templatemessage, org.name as orgunitName, "
             + "pg.name as programName, ps.name as programStageName, psi.duedate, "
             + "         (DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
             + " FROM patient p INNER JOIN programinstance pi "
@@ -629,7 +627,7 @@
 
     private String sendMessageToOrgunitRegisteredSql()
     {
-        return "select psi.programstageinstanceid, ou.phonenumber, prm.templatemessage, p.name, org.name as orgunitName, "
+        return "select psi.programstageinstanceid, ou.phonenumber, prm.templatemessage, org.name as orgunitName, "
             + "pg.name as programName, ps.name as programStageName, psi.duedate,"
             + "(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
             + "            from patient p INNER JOIN programinstance pi "
@@ -659,7 +657,7 @@
 
     private String sendMessageToUsersSql()
     {
-        return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, p.name, org.name as orgunitName ,"
+        return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, org.name as orgunitName ,"
             + " pg.name as programName, ps.name as programStageName, psi.duedate, "
             + "(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
             + "  from patient p INNER JOIN programinstance pi "
@@ -691,7 +689,7 @@
 
     private String sendMessageToUserGroupsSql()
     {
-        return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, p.name, org.name as orgunitName ,"
+        return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, org.name as orgunitName ,"
             + " pg.name as programName, ps.name as programStageName, psi.duedate, "
             + "(DATE(now()) - DATE(psi.duedate) ) as days_since_due_date "
             + "  from patient p INNER JOIN programinstance pi "

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2014-01-05 14:04:13 +0000
@@ -12,8 +12,6 @@
     </id>
     &identifiableProperties;
 
-    <property name="name" column="name" length="230" />
-    
     <set name="identifiers" inverse="true">
       <key column="patientid" />
       <one-to-many class="org.hisp.dhis.patient.PatientIdentifier" />

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2013-09-16 17:07:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2014-01-05 14:04:13 +0000
@@ -38,6 +38,8 @@
     <property name="displayOnVisitSchedule" />
 
     <property name="sortOrderInVisitSchedule" />
+    
+    <property name="displayedInList" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientReminderServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientReminderServiceTest.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientReminderServiceTest.java	2014-01-05 14:04:13 +0000
@@ -129,8 +129,7 @@
         patientService.savePatient( patient );
 
         Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
-        patientReminderA = new PatientReminder( "A", 0, "Test program message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
+        patientReminderA = new PatientReminder( "A", 0, "Test program message template", PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
             PatientReminder.MESSAGE_TYPE_DIRECT_SMS );
         Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
@@ -139,8 +138,7 @@
         programService.addProgram( program );
 
         stageA = new ProgramStage( "A", program );
-        patientReminderB = new PatientReminder( "B", 0, "Test event template"
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
+        patientReminderB = new PatientReminder( "B", 0, "Test event template" , PatientReminder.DUE_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
             PatientReminder.MESSAGE_TYPE_DIRECT_SMS );
         patientReminders = new HashSet<PatientReminder>();
@@ -149,8 +147,7 @@
         programStageService.saveProgramStage( stageA );
 
         ProgramStage stageB = new ProgramStage( "B", program );
-        patientReminderC = new PatientReminder( "C", 0, "Test event template"
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
+        patientReminderC = new PatientReminder( "C", 0, "Test event template", PatientReminder.DUE_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
             PatientReminder.MESSAGE_TYPE_DIRECT_SMS );
         patientReminders = new HashSet<PatientReminder>();
@@ -173,7 +170,7 @@
     public void testGetMessageFromTemplateByProgram()
     {
         String message = patientReminderService.getMessageFromTemplate( patientReminderA, programInstance, mockFormat );
-        assertEquals( "Test program message template NameA", message );
+        assertEquals( "Test program message template", message );
     }
 
     @Test
@@ -183,7 +180,7 @@
             programInstance, stageA );
         String message = patientReminderService.getMessageFromTemplate( patientReminderA, programStageInstance,
             mockFormat );
-        assertEquals( "Test program message template NameA", message );
+        assertEquals( "Test program message template", message );
     }
 
     @Test

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientServiceTest.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientServiceTest.java	2014-01-05 14:04:13 +0000
@@ -131,7 +131,7 @@
         patientA2 = createPatient( 'A', organisationUnitB );
         patientA3 = createPatient( 'A', organisationUnit, patientIdentifierType );
         patientB1 = createPatient( 'B', organisationUnit );
-        patientB2 = createPatient( 'B', organisationUnit );
+        patientB2 = createPatient( 'B', organisationUnit, patientIdentifierType );
 
         programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
         programB = createProgram( 'B', new HashSet<ProgramStage>(), organisationUnit );
@@ -213,35 +213,6 @@
     }
 
     @Test
-    public void testGetPatientsByNames()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-
-        Collection<Patient> patients = patientService.getPatientsByNames( "NameA", null, null );
-
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-        assertTrue( patients.contains( patientA2 ) );
-    }
-
-    @Test
-    public void testSearchByLikeNames()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-        patientService.savePatient( patientA3 );
-        patientService.savePatient( patientB1 );
-        patientService.savePatient( patientB2 );
-
-        Collection<Patient> patients = patientService.getPatients( "B", 0, 10 );
-
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientB1 ) );
-        assertTrue( patients.contains( patientB2 ) );
-    }
-
-    @Test
     public void testGetPatientsByOu()
     {
         patientService.savePatient( patientA1 );
@@ -292,19 +263,6 @@
     }
 
     @Test
-    public void testGetPatientsLikeName()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-        patientService.savePatient( patientA3 );
-
-        Collection<Patient> patients = patientService.getPatientsLikeName( organisationUnit, "A", null, null );
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-        assertTrue( patients.contains( patientA3 ) );
-    }
-
-    @Test
     public void testGetPatientsByAttribute()
     {
         patientService.savePatient( patientA2 );
@@ -371,28 +329,6 @@
     }
 
     @Test
-    public void testCountGetPatientsByNameIdentifier()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-        patientService.savePatient( patientA3 );
-        patientService.savePatient( patientB1 );
-        patientService.savePatient( patientB2 );
-
-        assertEquals( 2, patientService.countGetPatients( "b" ) );
-    }
-
-    @Test
-    public void testCountGetPatientsByName()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-        patientService.savePatient( patientA3 );
-
-        assertEquals( 3, patientService.countGetPatientsByName( "a" ) );
-    }
-
-    @Test
     public void testCreatePatientAndRelative()
     {
         int idB = patientService.savePatient( patientB1 );
@@ -481,8 +417,6 @@
         programInstanceService.enrollPatient( patientB1, programA, date, date, organisationUnit, null );
 
         List<String> searchKeys = new ArrayList<String>();
-        searchKeys.add( Patient.PREFIX_IDENTIFIER_TYPE + Patient.SEARCH_SAPERATE + "a" + Patient.SEARCH_SAPERATE
-            + organisationUnit.getId() );
         searchKeys.add( Patient.PREFIX_PATIENT_ATTRIBUTE + Patient.SEARCH_SAPERATE + attributeId
             + Patient.SEARCH_SAPERATE + "a" );
         searchKeys.add( Patient.PREFIX_PROGRAM + Patient.SEARCH_SAPERATE + idA );
@@ -516,9 +450,7 @@
         programInstanceService.enrollPatient( patientB1, programA, date, date, organisationUnit, null );
 
         List<String> searchKeys = new ArrayList<String>();
-        searchKeys.add( Patient.PREFIX_IDENTIFIER_TYPE + Patient.SEARCH_SAPERATE + "a" + Patient.SEARCH_SAPERATE
-            + organisationUnit.getId() );
-        searchKeys.add( Patient.PREFIX_PATIENT_ATTRIBUTE + Patient.SEARCH_SAPERATE + attributeId
+       searchKeys.add( Patient.PREFIX_PATIENT_ATTRIBUTE + Patient.SEARCH_SAPERATE + attributeId
             + Patient.SEARCH_SAPERATE + "a" );
         searchKeys.add( Patient.PREFIX_PROGRAM + Patient.SEARCH_SAPERATE + idA );
 
@@ -558,8 +490,6 @@
         programInstanceService.enrollPatient( patientB1, programA, date, date, organisationUnit, null );
 
         List<String> searchKeys = new ArrayList<String>();
-        searchKeys.add( Patient.PREFIX_IDENTIFIER_TYPE + Patient.SEARCH_SAPERATE + "a" + Patient.SEARCH_SAPERATE
-            + organisationUnit.getId() );
         searchKeys.add( Patient.PREFIX_PROGRAM + Patient.SEARCH_SAPERATE + idA );
 
         Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
@@ -594,31 +524,11 @@
         patientAttributeValueService.savePatientAttributeValue( attributeValue );
         patientA2.addAttributeValue( attributeValue );
         patientService.updatePatient( patientA2 );
-        
+
         Collection<Patient> patients = patientService.getPatientsByPhone( "123456789", null, null );
         assertEquals( 2, patients.size() );
         assertTrue( patients.contains( patientA1 ) );
         assertTrue( patients.contains( patientA2 ) );
     }
 
-    @Test
-    public void testGetPatientByFullname()
-    {
-        patientService.savePatient( patientA1 );
-        patientService.savePatient( patientA2 );
-        patientService.savePatient( patientB1 );
-        patientService.savePatient( patientB2 );
-
-        Collection<Patient> patients = patientService.getPatientByFullname( "NameA", organisationUnit );
-
-        assertEquals( 1, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-
-        patients = patientService.getPatientByFullname( "NameB", organisationUnit );
-
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientB1 ) );
-        assertTrue( patients.contains( patientB2 ) );
-    }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java	2014-01-05 14:04:13 +0000
@@ -82,7 +82,7 @@
 
     @Autowired
     private ValidationCriteriaService validationCriteriaService;
-    
+
     @Autowired
     private PatientService patientService;
 
@@ -183,26 +183,6 @@
     }
 
     @Test
-    public void testGetByFullName()
-    {
-        patientStore.save( patientA1 );
-        patientStore.save( patientA2 );
-        patientStore.save( patientB1 );
-        patientStore.save( patientB2 );
-
-        Collection<Patient> patients = patientStore.getByFullName( "NameA", organisationUnit );
-
-        assertEquals( 1, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-
-        patients = patientStore.getByFullName( "NameB", organisationUnit );
-
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientB1 ) );
-        assertTrue( patients.contains( patientB2 ) );
-    }
-
-    @Test
     public void testGetByOrgUnitProgram()
     {
         programService.addProgram( programA );
@@ -260,32 +240,6 @@
     }
 
     @Test
-    public void testGetByNames()
-    {
-        patientStore.save( patientA1 );
-        patientStore.save( patientA2 );
-
-        Collection<Patient> patients = patientStore.getByNames( "NameA", null, null );
-
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-        assertTrue( patients.contains( patientA2 ) );
-    }
-
-    @Test
-    public void testGetByOrgUnitAndNameLike()
-    {
-        patientStore.save( patientA1 );
-        patientStore.save( patientA2 );
-        patientStore.save( patientA3 );
-
-        Collection<Patient> patients = patientStore.getByOrgUnitAndNameLike( organisationUnit, "A", null, null );
-        assertEquals( 2, patients.size() );
-        assertTrue( patients.contains( patientA1 ) );
-        assertTrue( patients.contains( patientA3 ) );
-    }
-
-    @Test
     public void testGetRepresentatives()
     {
         patientStore.save( patientB1 );
@@ -344,8 +298,6 @@
         programInstanceService.enrollPatient( patientB1, programA, date, date, organisationUnit, null );
 
         List<String> searchKeys = new ArrayList<String>();
-        searchKeys.add( Patient.PREFIX_IDENTIFIER_TYPE + Patient.SEARCH_SAPERATE + "a" + Patient.SEARCH_SAPERATE
-            + organisationUnit.getId() );
         searchKeys.add( Patient.PREFIX_PATIENT_ATTRIBUTE + Patient.SEARCH_SAPERATE + attributeId
             + Patient.SEARCH_SAPERATE + "a" + Patient.SEARCH_SAPERATE + organisationUnit.getId() );
         searchKeys.add( Patient.PREFIX_PROGRAM + Patient.SEARCH_SAPERATE + idA );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2014-01-05 14:04:13 +0000
@@ -139,12 +139,10 @@
 
         programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
 
-        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
+        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program message template", PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, null, PatientReminder.MESSAGE_TYPE_BOTH );
 
-        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
+        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program message template", PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
             PatientReminder.MESSAGE_TYPE_BOTH );
 
@@ -579,7 +577,7 @@
         Collection<OutboundSms> outboundSmsList = programInstanceService.sendMessages( programInstanceA,
             PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, mockFormat );
         assertEquals( 1, outboundSmsList.size() );
-        assertEquals( "Test program message template NameA", outboundSmsList.iterator().next().getMessage() );
+        assertEquals( "Test program message template", outboundSmsList.iterator().next().getMessage() );
     }
 
     @Test
@@ -594,7 +592,7 @@
         Collection<MessageConversation> messages = programInstanceService.sendMessageConversations( programInstanceA,
             PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, mockFormat );
         assertEquals( 1, messages.size() );
-        assertEquals( "Test program message template NameA", messages.iterator().next().getMessages().get( 0 )
+        assertEquals( "Test program message template", messages.iterator().next().getMessages().get( 0 )
             .getText() );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java	2013-11-14 09:36:39 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java	2014-01-05 14:04:13 +0000
@@ -114,12 +114,10 @@
 
         programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
 
-        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
+        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program message template", PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, null, PatientReminder.MESSAGE_TYPE_BOTH );
 
-        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
+        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program message template", PatientReminder.ENROLLEMENT_DATE_TO_COMPARE,
             PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
             PatientReminder.MESSAGE_TYPE_BOTH );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2014-01-05 14:04:13 +0000
@@ -194,15 +194,14 @@
 
         stageA = new ProgramStage( "A", programA );
 
-        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, null, PatientReminder.MESSAGE_TYPE_BOTH );
-
-        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
+        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT, null,
             PatientReminder.MESSAGE_TYPE_BOTH );
 
+        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT,
+            PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, PatientReminder.MESSAGE_TYPE_BOTH );
+
         Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
         patientReminders.add( patientReminderA );
         patientReminders.add( patientReminderB );
@@ -211,10 +210,9 @@
         programStageService.saveProgramStage( stageA );
 
         stageB = new ProgramStage( "B", programA );
-        PatientReminder patientReminderC = new PatientReminder( "C", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
-            PatientReminder.MESSAGE_TYPE_BOTH );
+        PatientReminder patientReminderC = new PatientReminder( "C", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT,
+            PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, PatientReminder.MESSAGE_TYPE_BOTH );
 
         patientReminders = new HashSet<PatientReminder>();
         patientReminders.add( patientReminderC );
@@ -566,7 +564,7 @@
         Collection<OutboundSms> outboundSmsList = programStageInstanceService.sendMessages( programStageInstanceA,
             PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, mockFormat );
         assertEquals( 1, outboundSmsList.size() );
-        assertEquals( "Test program stage message template NameA", outboundSmsList.iterator().next().getMessage() );
+        assertEquals( "Test program stage message template", outboundSmsList.iterator().next().getMessage() );
     }
 
     @Test
@@ -577,7 +575,7 @@
         Collection<MessageConversation> messages = programStageInstanceService.sendMessageConversations(
             programStageInstanceA, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, mockFormat );
         assertEquals( 1, messages.size() );
-        assertEquals( "Test program stage message template NameA", messages.iterator().next().getMessages().get( 0 )
+        assertEquals( "Test program stage message template", messages.iterator().next().getMessages().get( 0 )
             .getText() );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java	2013-11-19 06:51:39 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java	2014-01-05 14:04:13 +0000
@@ -156,15 +156,14 @@
 
         stageA = new ProgramStage( "A", programA );
 
-        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, null, PatientReminder.MESSAGE_TYPE_BOTH );
-
-        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
+        PatientReminder patientReminderA = new PatientReminder( "A", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT, null,
             PatientReminder.MESSAGE_TYPE_BOTH );
 
+        PatientReminder patientReminderB = new PatientReminder( "B", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT,
+            PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, PatientReminder.MESSAGE_TYPE_BOTH );
+
         Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
         patientReminders.add( patientReminderA );
         patientReminders.add( patientReminderB );
@@ -173,10 +172,9 @@
         programStageService.saveProgramStage( stageA );
 
         stageB = new ProgramStage( "B", programA );
-        PatientReminder patientReminderC = new PatientReminder( "C", 0, "Test program stage message template "
-            + PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, PatientReminder.DUE_DATE_TO_COMPARE,
-            PatientReminder.SEND_TO_PATIENT, PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT,
-            PatientReminder.MESSAGE_TYPE_BOTH );
+        PatientReminder patientReminderC = new PatientReminder( "C", 0, "Test program stage message template",
+            PatientReminder.DUE_DATE_TO_COMPARE, PatientReminder.SEND_TO_PATIENT,
+            PatientReminder.SEND_WHEN_TO_C0MPLETED_EVENT, PatientReminder.MESSAGE_TYPE_BOTH );
 
         patientReminders = new HashSet<PatientReminder>();
         patientReminders.add( patientReminderC );

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2013-12-27 20:50:53 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2014-01-05 14:04:13 +0000
@@ -1046,8 +1046,6 @@
     {
         Patient patient = new Patient();
         patient.setAutoFields();
-
-        patient.setName( "Name" + uniqueChar );
         patient.setOrganisationUnit( organisationUnit );
 
         return patient;
@@ -1058,8 +1056,6 @@
     {
         Patient patient = new Patient();
         patient.setAutoFields();
-
-        patient.setName( "Name" + uniqueChar );
         patient.setOrganisationUnit( organisationUnit );
 
         PatientIdentifier pIdentifier = new PatientIdentifier();

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-02 13:13:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-05 14:04:13 +0000
@@ -82,14 +82,14 @@
     // -------------------------------------------------------------------------
 
     @RequestMapping( value = "", method = RequestMethod.GET )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_ACCESS_PATIENT_ATTRIBUTES')")
-    public String getPersons(
-        @RequestParam( value = "orgUnit", required = false ) String orgUnitUid,
-        @RequestParam( value = "program", required = false ) String programUid,
-        @RequestParam( required = false ) String identifierType,
-        @RequestParam( required = false ) String identifier,
-        @RequestParam( required = false ) String nameLike,
-        @RequestParam Map<String, String> parameters, Model model ) throws Exception
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_ACCESS_PATIENT_ATTRIBUTES')" )
+    public String getPersons( @RequestParam( value = "orgUnit", required = false )
+    String orgUnitUid, @RequestParam( value = "program", required = false )
+    String programUid, @RequestParam( required = false )
+    String identifierType, @RequestParam( required = false )
+    String identifier, @RequestParam
+    Map<String, String> parameters, Model model )
+        throws Exception
     {
         WebOptions options = new WebOptions( parameters );
         Persons persons = new Persons();
@@ -101,12 +101,7 @@
         }
         else if ( orgUnitUid != null )
         {
-            if ( nameLike != null )
-            {
-                OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
-                persons = personService.getPersons( organisationUnit, nameLike );
-            }
-            else if ( programUid != null )
+            if ( programUid != null )
             {
                 OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
                 Program program = getProgram( programUid );
@@ -131,8 +126,11 @@
     }
 
     @RequestMapping( value = "/{id}", method = RequestMethod.GET )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_ACCESS_PATIENT_ATTRIBUTES')")
-    public String getPerson( @PathVariable String id, @RequestParam Map<String, String> parameters, Model model ) throws NotFoundException
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_ACCESS_PATIENT_ATTRIBUTES')" )
+    public String getPerson( @PathVariable
+    String id, @RequestParam
+    Map<String, String> parameters, Model model )
+        throws NotFoundException
     {
         WebOptions options = new WebOptions( parameters );
         Person person = getPerson( id );
@@ -149,7 +147,8 @@
 
     @RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
-    public void postPersonXml( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    public void postPersonXml( HttpServletRequest request, HttpServletResponse response )
+        throws IOException
     {
         ImportSummaries importSummaries = personService.savePersonXml( request.getInputStream() );
 
@@ -174,7 +173,8 @@
 
     @RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
-    public void postPersonJson( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    public void postPersonJson( HttpServletRequest request, HttpServletResponse response )
+        throws IOException
     {
         ImportSummaries importSummaries = personService.savePersonJson( request.getInputStream() );
 
@@ -204,7 +204,9 @@
     @RequestMapping( value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_XML_VALUE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
-    public void updatePersonXml( @PathVariable String id, HttpServletRequest request, HttpServletResponse response ) throws IOException
+    public void updatePersonXml( @PathVariable
+    String id, HttpServletRequest request, HttpServletResponse response )
+        throws IOException
     {
         ImportSummary importSummary = personService.updatePersonXml( id, request.getInputStream() );
         JacksonUtils.toXml( response.getOutputStream(), importSummary );
@@ -213,7 +215,9 @@
     @RequestMapping( value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
-    public void updatePersonJson( @PathVariable String id, HttpServletRequest request, HttpServletResponse response ) throws IOException
+    public void updatePersonJson( @PathVariable
+    String id, HttpServletRequest request, HttpServletResponse response )
+        throws IOException
     {
         ImportSummary importSummary = personService.updatePersonJson( id, request.getInputStream() );
         JacksonUtils.toJson( response.getOutputStream(), importSummary );
@@ -226,7 +230,9 @@
     @RequestMapping( value = "/{id}", method = RequestMethod.DELETE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DELETE')" )
-    public void deletePerson( @PathVariable String id ) throws NotFoundException
+    public void deletePerson( @PathVariable
+    String id )
+        throws NotFoundException
     {
         Person person = getPerson( id );
         personService.deletePerson( person );
@@ -236,7 +242,8 @@
     // HELPERS
     // -------------------------------------------------------------------------
 
-    private Person getPerson( String id ) throws NotFoundException
+    private Person getPerson( String id )
+        throws NotFoundException
     {
         Person person = personService.getPerson( id );
 
@@ -247,7 +254,8 @@
         return person;
     }
 
-    private Program getProgram( String id ) throws NotFoundException
+    private Program getProgram( String id )
+        throws NotFoundException
     {
         Program program = manager.get( Program.class, id );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2014-01-05 14:04:13 +0000
@@ -61,7 +61,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-    
+
     private OrganisationUnitSelectionManager selectionManager;
 
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
@@ -164,6 +164,13 @@
         return identifierTypes;
     }
 
+    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
     private Program program;
 
     public Program getProgram()
@@ -228,8 +235,8 @@
         if ( programId != null )
         {
             program = programService.getProgram( programId );
-
             identifierTypes = program.getPatientIdentifierTypes();
+            attributes = program.getPatientAttributes();
         }
 
         if ( searchTexts.size() > 0 )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java	2013-12-22 14:25:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java	2014-01-05 14:04:13 +0000
@@ -99,10 +99,6 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private String fullName;
-
-    private boolean underAge;
-
     private Integer representativeId;
 
     private Integer relationshipTypeId;
@@ -129,8 +125,6 @@
         // Set FullName && location
         // ---------------------------------------------------------------------
 
-        patient.setName( fullName );
-
         patient.setOrganisationUnit( organisationUnit );
 
         // ---------------------------------------------------------------------
@@ -248,11 +242,6 @@
             Patient relationship = patientService.getPatient( relationshipId );
             if ( relationship != null )
             {
-                if ( underAge )
-                {
-                    patient.setRepresentative( relationship );
-                }
-
                 Relationship rel = new Relationship();
                 if ( relationshipFromA )
                 {
@@ -350,11 +339,6 @@
         this.patientAttributeService = patientAttributeService;
     }
 
-    public void setFullName( String fullName )
-    {
-        this.fullName = fullName;
-    }
-
     public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService )
     {
         this.patientAttributeOptionService = patientAttributeOptionService;
@@ -370,8 +354,4 @@
         this.relationshipTypeId = relationshipTypeId;
     }
 
-    public void setUnderAge( boolean underAge )
-    {
-        this.underAge = underAge;
-    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java	2013-10-14 16:17:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java	2014-01-05 14:04:13 +0000
@@ -33,6 +33,7 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
@@ -173,6 +174,13 @@
         return identifierTypes;
     }
 
+    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
     private OrganisationUnit organisationUnit;
 
     public OrganisationUnit getOrganisationUnit()
@@ -230,7 +238,7 @@
             patients = patientService.searchPatients( searchTexts, orgunits, null, null, null, statusEnrollment,
                 paging.getStartPos(), paging.getPageSize() );
 
-            if ( facilityLB != null && !facilityLB.isEmpty())
+            if ( facilityLB != null && !facilityLB.isEmpty() )
             {
                 for ( Patient patient : patients )
                 {
@@ -240,8 +248,9 @@
 
             if ( programId != null )
             {
-                Program progam = programService.getProgram( programId );
-                identifierTypes.addAll( progam.getPatientIdentifierTypes() );
+                Program program = programService.getProgram( programId );
+                identifierTypes = program.getPatientIdentifierTypes();
+                attributes = program.getPatientAttributes();
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchRelationshipPatientAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchRelationshipPatientAction.java	2014-01-05 14:04:13 +0000
@@ -159,10 +159,6 @@
                 }
 
             }
-            else
-            {
-                patients = patientService.getPatientsByNames( searchText, null, null );
-            }
         }
         if ( patients != null && !patients.isEmpty() )
         {

=== 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	2013-11-25 08:18:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2014-01-05 14:04:13 +0000
@@ -194,6 +194,13 @@
         return identifierTypes;
     }
 
+    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
     private Map<String, List<PatientAttribute>> attributesMap = new HashMap<String, List<PatientAttribute>>();
 
     public Map<String, List<PatientAttribute>> getAttributesMap()
@@ -303,9 +310,7 @@
                     healthWorkers, null, null, i18n, format );
             }
         }
-
-        List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
-
+        
         if ( customRegistrationForm == null )
         {
             attributeGroups = new ArrayList<PatientAttributeGroup>(

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/UpdatePatientAction.java	2014-01-05 14:04:13 +0000
@@ -91,8 +91,6 @@
 
     private Integer id;
 
-    private String fullName;
-
     private Integer representativeId;
 
     private Integer relationshipTypeId;
@@ -120,8 +118,6 @@
         // Set FullName && location
         // ---------------------------------------------------------------------
 
-        patient.setName( fullName );
-
         patient.setOrganisationUnit( organisationUnit );
 
         // ---------------------------------------------------------------------
@@ -309,11 +305,6 @@
         this.id = id;
     }
 
-    public void setFullName( String fullName )
-    {
-        this.fullName = fullName;
-    }
-
     public Patient getPatient()
     {
         return patient;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java	2013-12-16 04:27:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java	2014-01-05 14:04:13 +0000
@@ -74,12 +74,8 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private String fullName;
-
     private Integer id;
 
-    private boolean underAge;
-
     private Integer programId;
 
     // -------------------------------------------------------------------------
@@ -117,7 +113,6 @@
             patient = new Patient();
         }
 
-        patient.setName( fullName );
         patient.setOrganisationUnit( orgunit );
 
         HttpServletRequest request = ServletActionContext.getRequest();
@@ -132,18 +127,15 @@
 
             for ( PatientIdentifierType idType : identifierTypes )
             {
-                if ( !underAge || (underAge && !idType.isRelated()) )
+                value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + idType.getId() );
+                if ( StringUtils.isNotBlank( value ) )
                 {
-                    value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + idType.getId() );
-                    if ( StringUtils.isNotBlank( value ) )
-                    {
-                        PatientIdentifier patientIdentifier = new PatientIdentifier();
-                        patientIdentifier.setPatient( patient );
-                        patientIdentifier.setIdentifierType( idType );
-                        patientIdentifier.setIdentifier( value );
+                    PatientIdentifier patientIdentifier = new PatientIdentifier();
+                    patientIdentifier.setPatient( patient );
+                    patientIdentifier.setIdentifierType( idType );
+                    patientIdentifier.setIdentifier( value );
 
-                        patientIdentifiers.add( patientIdentifier );
-                    }
+                    patientIdentifiers.add( patientIdentifier );
                 }
             }
 
@@ -195,11 +187,6 @@
         this.selectionManager = selectionManager;
     }
 
-    public void setFullName( String fullName )
-    {
-        this.fullName = fullName;
-    }
-
     public String getMessage()
     {
         return message;
@@ -220,9 +207,4 @@
         this.id = id;
     }
 
-    public void setUnderAge( boolean underAge )
-    {
-        this.underAge = underAge;
-    }
-
 }

=== 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	2013-12-18 08:01:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2014-01-05 14:04:13 +0000
@@ -47,7 +47,7 @@
 male=Male
 female=Female
 date_of_birth=Date of birth
-search_by_name_identifier=Search by name or identifier
+search_by_identifier=Search by identifier
 operation=Operation
 search_result_matching_the_search_criteria=Result matches the search criteria
 registering_unit=Registering unit

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2014-01-05 14:04:13 +0000
@@ -18,12 +18,17 @@
 			<th>$i18n.getString('orgunit')</th>
 			
 			#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-				<th>$i18n.getString('full_name')</th>
-				#foreach( $patientAttribute in $patientAttributes)
-				<th>$patientAttribute.displayName</th>
-				#end
-			#else
-				<th>$i18n.getString('system_identifier')</th>
+				#foreach( $identifierType in $identifierTypes)
+					#if($identifierType.personDisplayName=='true')
+						<th>$encoder.htmlEncode($identifierType.displayName)</th>
+					#end
+				#end
+				
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
+					#end
+				#end
 			#end
 			
 			<th>$i18n.getString('events')</th>
@@ -57,38 +62,36 @@
 			</td>
 			
 			#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-			<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
-				#set($value="")
+			
 				#foreach( $identifierType in $identifierTypes)
-					#foreach( $identifier in $patient.identifiers)
-						#if($identifier.identifierType.id==$identifierType.id)
-							#set($value=$identifier.identifier)
-						#end
+					#set($value="")
+					#if($identifierType.personDisplayName=='true')
+						<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $identifier in $programStageInstance.programInstance.patient.identifiers)
+								#if($!identifier.identifierType.id==$identifierType.id)
+									#set($value=$identifier.identifier)
+								#end
+							#end 
+							<a>$encoder.htmlEncode($value)</a>
+						</td>
 					#end
 				#end
-				#if($value=="")
-					#set($value=$!patient.name)
-				#end
 				
-				$value
-			</a></td>
-			
-			#set( $attributeValues = $patientAttributeValueMap.get($programStageInstance.programInstance.patient.id))
-			#foreach( $attributeValue in $attributeValues)
-				<td>$attributeValue</td>
-			#end
-			
-			#else
-				#set($value="")
-				#foreach( $identifier in $patient.identifiers)
-					#if($!identifier.identifierType)
-					#else
-						#set($value=$identifier.identifier)
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $attributeValue in $programStageInstance.programInstance.patient.attributeValues)
+								#if($!attributeValue.patientAttribute.id==$attribute.id)
+									#set($value=$attributeValue.value)
+									#if( $attribute.valueType == 'bool')
+										#set($value=$i18n.getString($attributeValue.value))
+									#end
+								#end
+							#end 
+							<a>$encoder.htmlEncode($value)</a>
+						</td>
 					#end
 				#end
-				<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
-					$value
-				</a></td>
 			#end
 			
 			<td><a href="javascript:loadDataEntryDialog( $programStageInstance.id, '$programStageInstance.programStage.uid' );">$programStageInstance.programStage.displayName</a></td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-12-19 06:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2014-01-05 14:04:13 +0000
@@ -46,8 +46,8 @@
 			<select name="relationshipTypeId" id="relationshipTypeId" class="{validate:{required:true}}" >
 				<option value="">[$i18n.getString( "please_select" )]</option>        
 				#foreach ($relationship in $relationshipTypes)
-					<option value="$relationship.id" relationshipFromA='true'>$!encoder.htmlEncode(${relationship.aIsToB}) $i18n.getString("of") $!encoder.htmlEncode($patient.name) ($!encoder.htmlEncode(${relationship.bIsToA}))</option>
-					<option value="$relationship.id" relationshipFromA='false'>$!encoder.htmlEncode(${relationship.bIsToA}) $i18n.getString("of") $!encoder.htmlEncode($patient.name) ($!encoder.htmlEncode(${relationship.aIsToB}))</option>
+					<option value="$relationship.id" relationshipFromA='true'>$!encoder.htmlEncode(${relationship.aIsToB}) $i18n.getString("of") $!encoder.htmlEncode(${relationship.bIsToA})</option>
+					<option value="$relationship.id" relationshipFromA='false'>$!encoder.htmlEncode(${relationship.bIsToA}) $i18n.getString("of") $!encoder.htmlEncode(${relationship.aIsToB})</option>
 				#end
 			</select>
 		</td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipForm.vm	2014-01-05 14:04:13 +0000
@@ -31,7 +31,8 @@
     <td class='information'>
         <table>  
 			 <tr>
-                <td>$!encoder.htmlEncode( $patient.name) $i18n.getString( "is" )</td>
+				<td>
+				</td>
                <td>
                     <select id="relationshipTypeId" name="relationshipTypeId" class="{validate:{required:true}}" style='width:205px;'>
                         <option value="">[$i18n.getString( "select_relationship" )]</option>
@@ -44,9 +45,9 @@
             </tr>           
                                     
             <tr>           
-                <td>
+                <td colspan='2'>
                     <select id="searchingAttributeId" name="searchingAttributeId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end style='width:200px;'>
-                        <option value="">$i18n.getString( "search_by_name_identifier" )</option>
+                        <option value="">$i18n.getString( "search_by_identifier" )</option>
                         #foreach( $attribute in $patientAttributes )
                             <option value="$attribute.id" #if( $searchingAttributeId && $attribute.id == $searchingAttributeId ) selected="selected" #end>$encoder.htmlEncode( $attribute.displayName )</option>
                         #end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2014-01-05 14:04:13 +0000
@@ -1,28 +1,1 @@
-<form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'>
-
-<table class="mainPageTable" id='patientInfoDiv'> 
-	<tr>
-		<td valign="top">
-	<table>
-		#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-			<tr>            
-				<td class="bold">$i18n.getString( "full_name" ):</td>
-				<td>$!encoder.htmlEncode( $patient.name )<td>
-			</tr>
-		#else
-			#set($value="")
-			#foreach( $identifier in $patient.identifiers)
-				#if($!identifier.identifierType)
-				#else
-					#set($value=$identifier.identifier)
-				#end
-			#end
-			<tr>
-				<td class="bold">$i18n.getString('system_identifier'):</td>
-				<td>$value</td>
-			</tr>
-		#end
-		</table>
-	</tr>
-</table>
-</form>
+<form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'></form>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2014-01-05 14:04:13 +0000
@@ -58,33 +58,36 @@
 			</td>
 			
 			#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-			<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
-				#set($value="")
 				#foreach( $identifierType in $identifierTypes)
-					#foreach( $identifier in $patient.identifiers)
-						#if($identifier.identifierType.id==$identifierType.id)
-							#set($value=$identifier.identifier)
-						#end
-					#end
-				#end
-				#if($value=="")
-					#set($value=$!patient.name)
-				#end
-				
-				$value
-			</a></td>
-			
-			#else
-				#set($value="")
-				#foreach( $identifier in $patient.identifiers)
-					#if($!identifier.identifierType)
-					#else
-						#set($value=$identifier.identifier)
-					#end
-				#end
-				<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
-					$value
-				</a></td>
+					#set($value="")
+					#if($identifierType.personDisplayName=='true')
+						<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $identifier in $patient.identifiers)
+								#if($!identifier.identifierType.id==$identifierType.id)
+									#set($value=$identifier.identifier)
+								#end
+							#end 
+						$encoder.htmlEncode($value)
+					</td>
+					#end
+				#end
+
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $attributeValue in $patient.attributeValues)
+								#if($!attributeValue.patientAttribute.id==$attribute.id)
+									#set($value=$attributeValue.value)
+									#if( $attribute.valueType == 'bool')
+										#set($value=$i18n.getString($attributeValue.value))
+									#end
+								#end
+							#end 
+							
+							$encoder.htmlEncode($value)
+						</td>
+					#end
+				#end
 			#end
 			
 			<td><a href="javascript:loadDataEntryDialog( $programStageInstance.id );">$programStageInstance.programStage.displayName</a></td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm	2013-12-18 08:01:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultPatientForm.vm	2014-01-05 14:04:13 +0000
@@ -2,13 +2,6 @@
 	<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
 </tr>
 
-#if($patientRegistrationForm.fixedAttributes.contains( 'fullName' ))
-	<tr>
-		<td class='text-column'><label for="fullName">$i18n.getString( "full_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td class="input-column"><input type="text" id="fullName" name="fullName" value="$!patient.name" class="{validate:{required:true, rangelength:[3,50]}}"></td>
-	</tr>
-#end
-
 #if($patientRegistrationForm.fixedAttributes.contains( 'healthWorker' ))
 	<tr>
 		<td class='text-column'><label for="healthWorker">$i18n.getString( "health_worker" )</label></td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-12-31 13:51:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-01-05 14:04:13 +0000
@@ -354,40 +354,6 @@
 	}
 }
 
-// -----------------------------------------------------------------------------
-// check duplicate patient
-// -----------------------------------------------------------------------------
-
-function checkDuplicate( divname )
-{
-	$.postUTF8( 'validatePatient.action', {
-        id: $( '#' + divname + ' [id=id]' ).val(),
-        fullName: $( '#' + divname + ' [id=fullName]' ).val()
-    }, function( xmlObject, divname ) {
-        checkDuplicateCompleted( xmlObject, divname );
-    });
-}
-
-function checkDuplicateCompleted( messageElement, divname )
-{
-	var checkedDuplicate = true;
-	var type = $(messageElement).find('message').attr('type');
-	var message = $(messageElement).find('message').text();
-
-    if( type == 'success')
-    {
-    	showSuccessMessage(i18n_no_duplicate_found);
-    }
-    if ( type == 'input' )
-    {
-        showWarningMessage(message);
-    }
-    else if( type == 'duplicate' )
-    {
-    	showListPatientDuplicate( messageElement, true );
-    }
-}
-
 function enableBtn(){
 	var programIdAddPatient = getFieldValue('programIdAddPatient');
     if( registration == undefined || !registration ) {
@@ -1000,76 +966,6 @@
 	});
 }
 
-/**
- * Show list patient duplicate  by jQuery thickbox plugin
- * @param rootElement : root element of the response xml
- * @param validate  :  is TRUE if this method is called from validation method  
- */
-function showListPatientDuplicate( rootElement, validate )
-{
-	var message = $(rootElement).find('message').text();
-	var patients = $(rootElement).find('patient');
-	
-	var sPatient = "";
-    $( patients ).each( function( i, patient ) {
-			sPatient += "<hr style='margin:5px 0px;'><table>";
-			sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + $(patient).find('systemIdentifier').text() + "</td></tr>" ;
-			sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + $(patient).find('fullName').text() + "</td></tr>" ;
-        	
-			var identifiers = $(patient).find('identifier');
-
-        	if( identifiers.length > 0 )
-        	{
-        		sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_identifiers + "</td></tr>";
-
-                $( identifiers ).each( function( i, identifier )
-				{
-        			sPatient +="<tr class='identifierRow'>"
-        				+"<td class='bold'>" + $(identifier).find('name').text() + "</td>"
-        				+"<td>" + $(identifier).find('value').text() + "</td>	"
-        				+"</tr>";
-        		});
-        	}
-			
-        	var attributes = $(patient).find('attribute');
-
-        	if( attributes.length > 0 )
-        	{
-        		sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_attributes + "</td></tr>";
-
-                $( attributes ).each( function( i, attribute ) {
-        			sPatient +="<tr class='attributeRow'>"
-        				+"<td class='bold'>" + $(attribute).find('name').text() + "</td>"
-        				+"<td>" + $(attribute).find('value').text() + "</td>	"
-        				+"</tr>";
-        		});
-        	}
-
-        	sPatient += "<tr><td colspan='2'><input type='button' id='"+ $(patient).find('id').first().text() + "' value='" + i18n_edit_this_patient + "' onclick='showUpdatePatientForm(this.id)'/></td></tr>";
-        	sPatient += "</table>";
-		});
-		
-		var result = i18n_duplicate_warning;
-
-		if( !validate )
-		{
-			result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();'/>";
-			result += "<br><hr style='margin:5px 0px;'>";
-		}
-
-		result += "<br>" + sPatient;
-        $('#resultSearchDiv' ).html( result );
-        $('#resultSearchDiv' ).dialog({
-			title: i18n_duplicated_patient_list,
-			maximize: true, 
-			closable: true,
-			modal:true,
-			overlay:{background:'#000000', opacity:0.1},
-			width: 800,
-			height: 400
-		});
-}
-
 // -----------------------------------------------------------------------------
 // Show representative form
 // -----------------------------------------------------------------------------

=== 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	2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2014-01-05 14:04:13 +0000
@@ -79,7 +79,7 @@
 	showLoader();
 	jQuery('#contentDiv').load( 'listAllPatients.action',{
 			listAll:false,
-			programIds:	getFieldValue("programIdAddPatient"),
+			programId:	getFieldValue("programIdAddPatient"),
 			searchTexts: "prg_" + getFieldValue("programIdAddPatient"),
 			searchByUserOrgunits: false,
 			searchBySelectedOrgunit:true

=== 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	2013-12-31 03:27:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2014-01-05 14:04:13 +0000
@@ -46,7 +46,6 @@
 function Patient()
 {
 	var patientId;
-	var	fullName;
 	
 	this.advancedSearch = function(params)
 	{
@@ -234,7 +233,7 @@
 	
 	this.remove = function( confirm_delete_patient )
 	{
-		removeItem( this.patientId, this.fullName, confirm_delete_patient, 'removePatient.action' );
+		removeItem( this.patientId, "", confirm_delete_patient, 'removePatient.action' );
 	};
 	
 }
@@ -296,11 +295,10 @@
 // Remove patient
 // -----------------------------------------------------------------------------
 
-function removePatient( patientId, fullName, i18n_confirm_delete_patient )
+function removePatient( patientId, i18n_confirm_delete_patient )
 {
 	var patient = new Patient();
 	patient.patientId = patientId;
-	patient.fullName = fullName;
 	patient.remove( i18n_confirm_delete_patient );
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2013-12-31 14:40:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2014-01-05 14:04:13 +0000
@@ -194,69 +194,6 @@
     return false;
 }
 
-function showListPatientDuplicate( rootElement, validate )
-{
-	var message = jQuery(rootElement).find('message').text();
-	var patients = jQuery(rootElement).find('patient');
-	
-	var sPatient = "";
-	jQuery( patients ).each( function( i, patient )
-        {
-			sPatient += "<hr style='margin:5px 0px;'><table>";
-			sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + jQuery(patient).find('systemIdentifier').text() + "</td></tr>" ;
-			sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + jQuery(patient).find('fullName').text() + "</td></tr>" ;
-        	
-			var identifiers = jQuery(patient).find('identifier');
-        	if( identifiers.length > 0 )
-        	{
-        		sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_identifiers + "</td></tr>";
-
-        		jQuery( identifiers ).each( function( i, identifier )
-				{
-        			sPatient +="<tr class='identifierRow'>"
-        				+"<td class='bold'>" + jQuery(identifier).find('name').text() + "</td>"
-        				+"<td>" + jQuery(identifier).find('value').text() + "</td>	"	
-        				+"</tr>";
-        		});
-        	}
-			
-        	var attributes = jQuery(patient).find('attribute');
-        	if( attributes.length > 0 )
-        	{
-        		sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_attributes + "</td></tr>";
-
-        		jQuery( attributes ).each( function( i, attribute )
-				{
-        			sPatient +="<tr class='attributeRow'>"
-        				+"<td class='bold'>" + jQuery(attribute).find('name').text() + "</td>"
-        				+"<td>" + jQuery(attribute).find('value').text() + "</td>	"	
-        				+"</tr>";
-        		});
-        	}
-        	sPatient += "<tr><td colspan='2'><input type='button' id='"+ jQuery(patient).find('id').first().text() + "' value='" + i18n_show_data_entry + "' onclick='showSelectedDataRecoding(" + jQuery(patient).find('id').first().text() + ");showEntryFormDiv(); '/></td></tr>";
-        	sPatient += "</table>";
-		});
-		
-		var result = i18n_duplicate_warning;
-		if( !validate )
-		{
-			result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();'/>";
-			result += "<br><hr style='margin:5px 0px;'>";
-		}
-		
-		result += "<br>" + sPatient;
-		jQuery('#resultSearchDiv' ).html( result );
-		jQuery('#resultSearchDiv' ).dialog({
-			title: i18n_duplicated_patient_list,
-			maximize: true, 
-			closable: true,
-			modal:true,
-			overlay:{background:'#000000', opacity:0.1},
-			width: 800,
-			height: 400
-		});
-}
-
 function showEntryFormDiv()
 {
 	hideById('singleEventForm');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js	2014-01-05 14:04:13 +0000
@@ -6,7 +6,6 @@
 {	
 	$.postUTF8("validatePatient.action?" + getIdentifierTypeIdParams(),
 		{
-			fullName: jQuery( '#addRepresentativeForm [id=fullName]' ).val()
 		}, addValidationRepresentativeCompleted, "xml" );
 }
 
@@ -103,7 +102,6 @@
     {
 		sPatient += "<hr style='margin:5px 0px;'><table>";
 		sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + $( patient ).find('systemIdentifier').text() + "</td></tr>" ;
-		sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + $( patient ).find('fullName').text() + "</td></tr>" ;
 		
 		var identifiers =  $( patient ).find('identifier');
 		$( identifiers ).each( function( i, identifier )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2013-12-30 03:19:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2014-01-05 14:04:13 +0000
@@ -24,86 +24,100 @@
 <br> 
 <table class="mainPageTable">
 <tr><td>
-<table class="listTable">  
-	<colgroup>
-		<col width="40"/>
-		#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-			#foreach( $identifierType in $identifierTypes) <col/> #end
-		#if( $identifierTypes.size()==0 ) <col/> #end
-		#end
-		#if($mapPatientOrgunit.size()!=0) <col/> #end
-		<col width="80"/>
-	</colgroup>	  
-	
-	<thead>
-	  <tr>
-		<th>#</th>
-		#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
+	<table class="listTable" id="patientList" width='100%'>               
+          <col width="30"/>
 			#foreach( $identifierType in $identifierTypes)
-				<th>$encoder.htmlEncode($identifierType.displayName)</th>
-			#end
-			
-			#if( $identifierTypes.size()==0 )
-				<th>$i18n.getString( "full_name" )</th>          
-			#end       
-		#else
-			<th>$i18n.getString('system_identifier')</th>
-		#end
-		
-		#if($mapPatientOrgunit.size()!=0)
-			<th>$i18n.getString( "hierachy_orgunit" )</th>
-		#end			
-		<th>$i18n.getString( "operations" )</th>
-	  </tr>
-	</thead>
-          
-	<tbody id="list">	
-	  #foreach( $patient in $patients )
-		<tr>
-			<td>
-				#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
-				$nr
-			</td>
-			
-			#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-				#set($value="")
-				#foreach( $identifierType in $identifierTypes)
-					#foreach( $identifier in $patient.identifiers)
-						#if($identifier.identifierType.id==$identifierType.id)
-							#set($value=$identifier.identifier)
-						#end
-					#end
-				#end
-				#if($value=="")
-					#set($value=$patient.name)
-				#end
-				<td style="cursor:pointer;" onclick="javascript:showUpdatePatientForm('$patient.id');">
-					<a>$encoder.htmlEncode($value)</a>
-				</td>
-			#else
-				#set($value="")
-				#foreach( $identifier in $patient.identifiers)
-					#if($!identifier.identifierType)
-					#else
-						#set($value=$identifier.identifier)
-					#end
-				#end
-				<td style="cursor:pointer;" onclick="javascript:showUpdatePatientForm('$patient.id');">
-					<a>$value</a>
-				</td>
-			#end
-			
-			#if($mapPatientOrgunit.size()!=0)
-			<td>$!mapPatientOrgunit.get($patient.id)</td>
-			#end
-			<td>
-				<a href="javascript:showUpdatePatientForm('$patient.id');" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>   
-				<a href="javascript:showPatientHistory('$patient.id')" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
-			</td>               				
-		</tr>
-	#end
-    </tbody>
-</table>
+				#if($identifierType.personDisplayName=='true')<col/>#end
+			#end
+			
+			#foreach( $attribute in $attributes )
+				#if($attribute.displayedInList=='true')<col/>#end
+			#end
+			
+		  #if($mapPatientOrgunit.size()!=0)
+		  <col/>
+		  #end
+		  <col width="200"/>    
+		  
+		  <thead>
+			<tr>
+				<th>#</th>
+				
+				#foreach( $identifierType in $identifierTypes)
+					#if($identifierType.personDisplayName=='true')
+						<th>$encoder.htmlEncode($identifierType.displayName)</th>
+					#end
+				#end
+				
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
+					#end
+				#end
+				
+				#if($mapPatientOrgunit.size()!=0)
+					<th>$i18n.getString( "hierachy_orgunit" )</th>
+				#end
+				
+				<th style="text-align:center">$i18n.getString( "operations" )</th>
+			  </tr>
+          </thead>
+		  
+          <tbody id="list">	
+          #foreach( $patient in $patients )
+          	<tr id="tr${patient.id}">
+				
+				<td>
+					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
+					$nr
+				</td>
+					
+				#foreach( $identifierType in $identifierTypes)
+					#set($value="")
+					#if($identifierType.personDisplayName=='true')
+						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $identifier in $patient.identifiers)
+								#if($!identifier.identifierType.id==$identifierType.id)
+									#set($value=$identifier.identifier)
+								#end
+							#end 
+						<a>$encoder.htmlEncode($value)</a>
+					</td>
+					#end
+				#end
+				
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $attributeValue in $patient.attributeValues)
+								#if($!attributeValue.patientAttribute.id==$attribute.id)
+									#set($value=$attributeValue.value)
+									#if( $attribute.valueType == 'bool')
+										#set($value=$i18n.getString($attributeValue.value))
+									#end
+								#end
+							#end 
+							<a>$encoder.htmlEncode($value)</a>
+						</td>
+					#end
+				#end
+				
+				<td>
+				  <a href="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )" title='$i18n.getString( "patient_dashboard" )'><img src="../images/enroll.png" alt='$i18n.getString( "patient_dashboard" )'></a>
+				  <a href="javascript:isDashboard=false;showUpdatePatientForm( '$patient.id' )" title='$i18n.getString( "edit_profile" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_profile" )'></a>
+				  <a href="javascript:setFieldValue( 'isShowPatientList', 'false' ); showRelationshipList('$patient.id')" title='$i18n.getString( "manage_relationship" )'><img src="../images/relationship.png" alt='$i18n.getString( "manage_relationship" )'></a>
+                  #if( $auth.hasAccess( "dhis-web-caseentry", "getPatientLocation" ) )
+				  <a href="javascript:isDashboard=false;getPatientLocation( '$patient.id' );" title='$i18n.getString( "change_location" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "change_patient_location" )' style='width:25px; height:25px'></a>
+				  #end
+				  <a href="javascript:removePatient( '$patient.id', '', i18n_confirm_delete_patient )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
+				  <a href="javascript:showPatientHistory( '$patient.id' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
+				</td>
+				
+			</tr>
+    	#end
+    	</tbody>
+    
+	 </table>
 </td></tr>
 <tr><td colspan="6">
 			<p></p>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2014-01-05 14:04:13 +0000
@@ -19,13 +19,6 @@
 		</p>
 		<div class="contentProviderTable">
 			<table>
-				#if( $!patient.name!='' )
-				<tr>
-					<td>$i18n.getString("full_name")</td>
-					<td>$encoder.htmlEncode($!patient.name)</td>
-				</tr>
-				#end
-				
 				<tr>
 					<td>$i18n.getString("location")</td>
 					<td>$encoder.htmlEncode($!patient.organisationUnit.name)</td>
@@ -49,11 +42,11 @@
 				#end
 				#foreach( $identifier in $identifiers )
 				<tr>
-					#if($!identifier.identifierType)
-						<td>$!identifier.identifierType.displayName</td>
-					#else
-						<td>$i18n.getString("system_identifier")</td>
+					<td>
+					#if($!identifier.identifierType.personDisplayName=='true')
+						$!identifier.identifierType.displayName
 					#end
+					</td>
 					<td id='dashboard_iden$identifier.identifierType.id'>$identifier.identifier</td>
 				</tr>
 				#end
@@ -205,18 +198,12 @@
 							<td><a href='#'>$rel.relationshipType.bIsToA</a></td>
 							<td>
 								#set($patient=$rel.patientB)
-								#set($value=$!patient.name)
+								#set($value="")
 								#foreach( $identifier in $patient.identifiers)
-									#if($!identifier.identifierType)
+									#if($!identifier.identifierType.personDisplayName=='true')
 										#set($value=$identifier.identifier)
-									#else
-										#set($systemId=$identifier.identifier)
 									#end
 								#end
-								#if($value=="")
-									#set($value=$systemId)
-								#end
-								
 								<a href='#'>$value</a>
 							</td>
 						</tr>
@@ -225,18 +212,11 @@
 							<td><a href='#'>$!rel.relationshipType.aIsToB</a></td>
 							<td><a href='#'>
 								#set($patient=$!rel.patientA)
-								#set($value=$!patient.name)
 								#foreach( $identifier in $patient.identifiers)
-									#if($!identifier.identifierType)
+									#if($!identifier.identifierType.personDisplayName=='true')
 										#set($value=$identifier.identifier)
-									#else
-										#set($systemId=$identifier.identifier)
 									#end
 								#end
-								#if($value=="")
-									#set($value=$systemId)
-								#end
-								
 								<a href='#'>$value</a>
 							</td>
 						</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-12-19 04:00:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2014-01-05 14:04:13 +0000
@@ -18,11 +18,6 @@
 	</tr>
 
 	<tr name='propertiesField'>
-		<td class='text-column'><label for="fullName">$i18n.getString( "full_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td class="input-column"><input type="text" id="fullName" name="fullName" value="$!patient.name" class="{validate:{required:true, rangelength:[3,50]}}"></td>
-	</tr>
-
-	<tr name='propertiesField'>
 		<td class='text-column'><label for="healthWorker">$i18n.getString( "health_worker" )</label></td>
 		<td class="input-column">
 			<select id="healthWorker" name="healthWorker">
@@ -34,11 +29,6 @@
 		</td>
 	</tr>
 	
-	<tr>
-		<td></td>
-		<td><input type="button" class='button' id='checkDuplicateBtn' name='checkDuplicateBtn' value="$i18n.getString('check_duplicate')" /></td>
-	</tr>
-
 	<tr><td>&nbsp;</td></tr>
 
 #if( $identifierTypes.size() > 0)

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm	2014-01-05 14:04:13 +0000
@@ -10,35 +10,14 @@
 </h3>
 	
 <table>
-	#set($value="")
-	#set($flag=false)
 	#foreach( $identifier in $patient.identifiers)
-		#if($!identifier.identifierType)
-			#set($value=$identifier.identifier)
-		#else
-			#set($systemId=$identifier.identifier)
-		#end
-	#end
-	#if($value=="")
-		#set($value=$!patient.name)
-	#else
-		#set($flag=true)
-	#end
-	#if($value=="")
-		#set($value=$systemId)
-	#end
-					
-	#if($patient.name=='')
-	<tr>
-		<td>
-			#if($flag==true)
-				$i18n.getString('identifier'):
-			#else
-				$i18n.getString('full_name'):
+		<tr>
+			#if($!identifier.identifierType.personDisplayName=='true')
+				<td>$identifier.identifierType.displayName:</td>
+				<td>$identifier.identifier</td>
 			#end
-		</td>
-		<td>$value</td>
-	</tr>
+			
+		</tr>
 	#end
 </table>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2013-12-31 03:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2014-01-05 14:04:13 +0000
@@ -34,19 +34,14 @@
     <td>    
       <table class="listTable" id="patientList" width='100%'>               
           <col width="30"/>
-		  <col/>
-		  #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-			#foreach( $attribute in $patientAttributes )
-				#if($attribute)<col/>#end
-			#end
-			
 			#foreach( $identifierType in $identifierTypes)
-				#if($identifierType.personDisplayName=='true')
-				<col/>
-				#end
-			#end
-		  #end
-		  
+				#if($identifierType.personDisplayName=='true')<col/>#end
+			#end
+			
+			#foreach( $attribute in $attributes )
+				#if($attribute.displayedInList=='true')<col/>#end
+			#end
+			
 		  #if($mapPatientOrgunit.size()!=0)
 		  <col/>
 		  #end
@@ -55,32 +50,23 @@
 		  <thead>
 			<tr>
 				<th>#</th>
-				#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-		
-					#foreach( $attribute in $patientAttributes )
-						#if($attribute)
-							<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
-						#end
-					#end
-					
-					#set($personDisplayName='false')
-					#foreach( $identifierType in $identifierTypes)
-						#if($identifierType.personDisplayName=='true')
-							<th>$encoder.htmlEncode($identifierType.displayName)</th>
-							#set($personDisplayName='true')
-						#end
-					#end
-					
-					#if( $personDisplayName=='false' )
-						<th>$i18n.getString( "full_name" )</th>          
-					#end
-				#else
-					<th>$i18n.getString("system_identifier")</th>
+				
+				#foreach( $identifierType in $identifierTypes)
+					#if($identifierType.personDisplayName=='true')
+						<th>$encoder.htmlEncode($identifierType.displayName)</th>
+					#end
+				#end
+				
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
+					#end
 				#end
 				
 				#if($mapPatientOrgunit.size()!=0)
 					<th>$i18n.getString( "hierachy_orgunit" )</th>
 				#end
+				
 				<th style="text-align:center">$i18n.getString( "operations" )</th>
 			  </tr>
           </thead>
@@ -93,47 +79,35 @@
 					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
 					$nr
 				</td>
-				
-				#foreach( $attribute in $patientAttributes )
-					#if( $attribute )
-						#set ( $key = $patient.id + '-' + $attribute.id )
-						<td>
-							#if( $attribute.valueType == 'bool')
-								$i18n.getString( $mapPatientPatientAttr.get($key) )
-							#else
-								$mapPatientPatientAttr.get($key)
-							#end
-						</td>
-					#end
-				#end
 					
-				#set($value="")
 				#foreach( $identifierType in $identifierTypes)
-					#set($value="")
+					#set($id="")
 					#if($identifierType.personDisplayName=='true')
 						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
 							#foreach( $identifier in $patient.identifiers)
 								#if($!identifier.identifierType.id==$identifierType.id)
-									#set($value=$identifier.identifier)
-								#else
-									#set($systemId=$identifier.identifier)
+									#set($id=$identifier.identifier)
 								#end
-						#end
-						<a>$encoder.htmlEncode($value)</a>
+							#end 
+						<a>$encoder.htmlEncode($id)</a>
 					</td>
 					#end
 				#end
 				
-				#if($value=="")
-					#set($value=$!patient.name)
-				#end
-				#if($value=="")
-					#set($value=$systemId)
-				#end
-				#if($personDisplayName=='false')
-					<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
-						<a>$encoder.htmlEncode($value)</a>
-					</td>
+				#foreach( $attribute in $attributes )
+					#if($attribute.displayedInList=='true')
+						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+							#foreach( $attributeValue in $patient.attributeValues)
+								#if($!attributeValue.patientAttribute.id==$attribute.id)
+									#set($value=$attributeValue.value)
+									#if( $attribute.valueType == 'bool')
+										#set($value=$i18n.getString($attributeValue.value))
+									#end
+								#end
+							#end 
+							<a>$encoder.htmlEncode($value)</a>
+						</td>
+					#end
 				#end
 				
 				#if($mapPatientOrgunit.size()!=0)
@@ -147,7 +121,7 @@
                   #if( $auth.hasAccess( "dhis-web-caseentry", "getPatientLocation" ) )
 				  <a href="javascript:isDashboard=false;getPatientLocation( '$patient.id' );" title='$i18n.getString( "change_location" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "change_patient_location" )' style='width:25px; height:25px'></a>
 				  #end
-				  <a href="javascript:removePatient( '$patient.id', '$encoder.jsEncode( $patient.name )', i18n_confirm_delete_patient )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
+				  <a href="javascript:removePatient( '$patient.id', '$id', i18n_confirm_delete_patient )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
 				  <a href="javascript:showPatientHistory( '$patient.id' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
 				</td>
 				
@@ -177,7 +151,6 @@
 	});
 	var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';	
 	var i18n_id = '$encoder.jsEscape( $i18n.getString( "id" ), "'")';
-	var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ), "'")';
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
 	var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
 	var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm	2014-01-05 14:04:13 +0000
@@ -13,38 +13,35 @@
 	#set($status = $programStageInstance.getEventStatus())
 	#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
 		<table>
-			<tr> 
-				#set($patient=$programStageInstance.programInstance.patient)
-				#set($title="")
-				#set($value="")
-				#foreach( $identifier in $patient.identifiers)
-					#if($!identifier.identifierType)
-						#set($value=$identifier.identifier)
-						#set($title=$identifier.identifierType.displayName)
-					#else
-						#set($systemId=$identifier.identifier)
+			#foreach( $identifierType in $programStageInstance.programInstance.program.patientIdentifierTypes)
+				<tr> 
+					#if($identifierType.personDisplayName=='true')
+						<th>$encoder.htmlEncode($identifierType.displayName)</th>
+						#foreach( $identifierType in $identifierTypes)
+						#set($id="")
+							#if($identifierType.personDisplayName=='true')
+								<th style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+									#foreach( $identifier in $patient.identifiers)
+										#if($!identifier.identifierType.id==$identifierType.id)
+											#set($id=$identifier.identifier)
+										#end
+									#end 
+									$encoder.htmlEncode($id)
+								</th>
+							#end
+						#end
 					#end
-				#end
-				#if($value=="")
-					#set($value=$!patient.name)
-					#set($title= $encoder.htmlEncode($i18n.getString( "full_name" )))
-				#end
-				#if($value=="")
-					#set($value=$systemId)
-					#set($title=$encoder.htmlEncode($i18n.getString( "system_identifier" )))
-				#end
-				<td>$title:</td>
-				<td>$value</td>
-			</tr>
+				</tr>
+			#end
 			<tr>
-				<td>$i18n.getString("health_worker"):</td>
-				<td>
+				<th>$i18n.getString("health_worker"):</th>
+				<th>
 					#if($!programStageInstance.programInstance.patient.associate )
 						$encoder.htmlEncode($!programStageInstance.programInstance.patient.associate.name)
 					#else
 						[$i18n.getString('none')]
 					#end
-				</td>
+				</th>
 			</tr>
 		</table>
 	#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm	2013-12-18 06:28:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm	2014-01-05 14:04:13 +0000
@@ -22,7 +22,17 @@
 	<thead>
 		<tr>
 			<th>$i18n.getString('risk')</th>
-			<th>$i18n.getString('full_name')</th>
+			#foreach( $identifierType in $identifierTypes)
+				#if($identifierType.personDisplayName=='true')
+					<th>$encoder.htmlEncode($identifierType.displayName)</th>
+				#end
+			#end
+			
+			#foreach( $attribute in $attributes )
+				#if($attribute.displayedInList=='true')
+					<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
+				#end
+			#end
 			<th>$i18n.getString( "events" )</th>
 			<th>$i18n.getString( "operations" )</th>
 		</tr>
@@ -46,21 +56,36 @@
 				#end
 			</td>
 			
-			<td name='infor_$patient.id' class='$class'><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.id' )">
-				#set($value="")
-				#foreach( $identifierType in $identifierTypes)
-					#foreach( $identifier in $patient.identifiers)
-						#if($identifier.identifierType.id==$identifierType.id)
-							#set($value=$identifier.identifier)
-						#end
-					#end
-				#end
-				#if($value=="")
-					#set($value=$patient.name)
-				#end
-				
-				$value
-			</a></td>
+			#foreach( $identifierType in $identifierTypes)
+				#set($id="")
+				#if($identifierType.personDisplayName=='true')
+					<td name='infor_$patient.id' class='$class'><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.id' )">
+						#foreach( $identifier in $patient.identifiers)
+							#if($!identifier.identifierType.id==$identifierType.id)
+								$identifier.identifier
+							#end
+						#end 
+						</a>
+					</td>
+				#end
+			#end
+			
+			#foreach( $attribute in $attributes )
+				#if($attribute.displayedInList=='true')
+					<td name='infor_$patient.id' class='$class'><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.uid' )">
+						#foreach( $attributeValue in $patient.attributeValues)
+							#if($!attributeValue.patientAttribute.id==$attribute.id)
+								#set($value=$attributeValue.value)
+								#if( $attribute.valueType == 'bool')
+									#set($value=$i18n.getString($attributeValue.value))
+								#end
+							#end
+						#end 
+						$encoder.htmlEncode($value)
+						</a>
+					</td>
+				#end
+			#end
 			
 				#set($rowspan=1)
 				#if($class=='listRow')

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2013-12-31 11:58:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2014-01-05 14:04:13 +0000
@@ -131,7 +131,7 @@
 	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 	var i18n_duplicated_patient_list = '$encoder.jsEscape( $i18n.getString( "duplicated_patient_list" ) , "'")';
 	var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
-	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
+	var i18n_search_by_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_identifier" ) , "'")';
 	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
 	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
 	var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm	2014-01-05 14:04:13 +0000
@@ -1,8 +1,25 @@
 <table>
-	<tr>
-	    <td class="bold">$i18n.getString( "full_name" ):</td>
-	    <td>$encoder.htmlEncode( $patient.name )</td>
-	</tr>   
+	#foreach( $identifier in $patient.identifiers)
+		#if($!identifier.identifierType.personDisplayName=='true')
+			<tr>
+				<td>$!identifier.identifierType.displayName:</td>
+				<td>$!identifier.identifier</td>
+			</tr>
+		#end
+	#end 
+	
+	#foreach( $attributeValue in $patient.attributeValues)
+		#if($!attributeValue.patientAttribute.displayedInList=='true')
+			#set($value=$attributeValue.value)
+			#if( $attribute.valueType == 'bool')
+				#set($value=$i18n.getString($attributeValue.value))
+			#end
+			<tr>
+				<td>$!attributeValue.patientAttribute.displayName:</td>
+				<td>$!attributeValue.value</td>
+			</tr>
+		#end
+	#end  
 </table>
 
 <h4>$i18n.getString( "records_for" ) $encoder.htmlEncode( $programStageInstance.programStage.displayName ) </h4>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2014-01-05 14:04:13 +0000
@@ -13,10 +13,27 @@
 	<tr>              
 		<td>
 			<table>
-				<tr>
-					<td class="bold text-column">$i18n.getString( "full_name" ): </td>
-					<td>$!encoder.htmlEncode( $patient.name )<td>
-				</tr>
+				#foreach( $identifier in $patient.identifiers)
+					#if($!identifier.identifierType.personDisplayName=='true')
+						<tr>
+							<td>$!identifier.identifierType.displayName:</td>
+							<td>$!identifier.identifier</td>
+						</tr>
+					#end
+				#end 
+				
+				#foreach( $attributeValue in $patient.attributeValues)
+					#if($!attributeValue.patientAttribute.displayedInList=='true')
+						#set($value=$attributeValue.value)
+						#if( $attribute.valueType == 'bool')
+							#set($value=$i18n.getString($attributeValue.value))
+						#end
+						<tr>
+							<td>$!attributeValue.patientAttribute.displayName:</td>
+							<td>$!attributeValue.value</td>
+						</tr>
+					#end
+				#end 
 			</table>
 		</td>
 	
@@ -94,10 +111,7 @@
 					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
 				</div>	                     
 			</td>
-			<td>
-                <span class="bold">$i18n.getString( "full_name" ):</span><span id="fullNameField"></span><br>
-            </td>   
-            <td style="vertical-align:top">
+			<td style="vertical-align:top">
                 <div style="float:right">                              
                     <p><span class="bold">$i18n.getString( "attributes" ):</span><br><span id="attributeField"></span></p>                                         
                 </div>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm	2014-01-05 14:04:13 +0000
@@ -35,7 +35,16 @@
 			<td>$velocityCount</td>
 			
 			<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
-				<a>$!encoder.htmlEncode($patient.name)</a>
+				<a>
+				#foreach( $identifier in $patient.identifiers)
+					#if($!identifier.identifierType.personDisplayName=='true')
+						<tr>
+							<td>$!identifier.identifierType.displayName:</td>
+							<td>$!identifier.identifier</td>
+						</tr>
+					#end
+				#end 
+				</a>
 			</td>
 			
 			<td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2013-09-23 03:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2014-01-05 14:04:13 +0000
@@ -33,9 +33,6 @@
 								#end
 							#end
 						#end
-						#if($value=="")
-							#set( $value=$programInstance.patient.name)
-						#end
 							
 						<input type='button' class='patient-object' value="$value"
 							onclick='javascript:showPatientHistory( $programInstance.patient.id )' title='$i18n.getString( "patient_details_and_history" )'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-12-31 13:51:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2014-01-05 14:04:13 +0000
@@ -1,5 +1,12 @@
 <div id='reportTitle' name='reportTitle' style="display:none;">
-	<h3>$i18n.getString('records_of') $!encoder.htmlEncode( $patient.name )  $i18n.getString('at') $programStage.displayName $i18n.getString('in') $organisationUnit.name $i18n.getString('on_value') $format.formatDate($programStageInstance.executionDate)</h3>
+	#set($id = '')
+	#foreach( $identifier in $patient.identifiers)
+		#if($!identifier.identifierType.personDisplayName=='true')
+			#set($id=$!identifier.identifier)
+		#end
+	#end 
+				
+	<h3>$i18n.getString('records_of') $!encoder.htmlEncode( $id )  $i18n.getString('at') $programStage.displayName $i18n.getString('in') $organisationUnit.name $i18n.getString('on_value') $format.formatDate($programStageInstance.executionDate)</h3>
 	<hr/>
 </div>
 
@@ -10,7 +17,7 @@
 				<td class='coordinates1'>
 					<span class='bold' id="patientName">$i18n.getString( "full_name" ): </span>
 				</td>
-				<td class='coordinates2'>$patient.name</td>
+				<td class='coordinates2'>$id</td>
 				<td class='bold coordinates1'>$i18n.getString('program'):</td>
 				<td class='coordinates2'>$program.displayName</td>
 				<td rowspan='2'>
@@ -60,7 +67,7 @@
 			enable('completeBtn');
 			disable('uncompleteBtn');
 		#end
-		setInnerHTML("patientNameLbl", "&raquo; " + "!$encoder.jsEncode( $patient.name)");
+		setInnerHTML("patientNameLbl", "&raquo; " + "!$encoder.jsEncode( $id)");
 	});
 	
 	var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatient.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatient.vm	2014-01-05 14:04:13 +0000
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <patient>
   <id>$patient.id</id>  
-  <fullName>$!encoder.xmlEncode( $patient.name )</fullName>
   #foreach( $patientIdentifier in $patient.identifiers )
     <identifier>        
         <identifierText>$!encoder.xmlEncode( $patientIdentifier.identifier )</identifierText>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatientDetails.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatientDetails.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatientDetails.vm	2014-01-05 14:04:13 +0000
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <patient>
   <id>$patient.id</id>  
-  <fullName>$!encoder.xmlEncode( $patient.name )</fullName>
   #foreach( $patientIdentifier in $!patient.identifiers )
     <identifier>        
         <identifierText>$!encoder.xmlEncode( $!patientIdentifier.identifier )</identifierText>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatients.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatients.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePatients.vm	2014-01-05 14:04:13 +0000
@@ -3,7 +3,6 @@
 #foreach( $patient  in $patients )
 <patient>
   <id>$patient.id</id>  
-  <fullName>$!encoder.xmlEncode( $patient.name )</fullName>
   #foreach( $identifier in $patient.identifiers )
   	#if( $identifier.identifierType )
 	    <identifier>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responseRelationshipPatients.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responseRelationshipPatients.vm	2013-09-23 03:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responseRelationshipPatients.vm	2014-01-05 14:04:13 +0000
@@ -3,7 +3,7 @@
 #foreach( $patient in $patients )
   {
     "id": $!{patient.id},
-    "fullName": "$!encoder.jsonEncode( ${patient.name} )"    
+    "uid": "$!encoder.jsonEncode( ${patient.uid} )"    
   }#if( $velocityCount < $size ),#end
 #end
 ] }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-12-18 06:05:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2014-01-05 14:04:13 +0000
@@ -71,7 +71,7 @@
 	</tr>
 	<tr id='searchByIdTR' class='hidden'>
 		<td colspan='2'>
-			<input type='text' id='searchPatientByIds' name='searchPatientByIds' onchange='searchByIdsOnclick();' style='width:350px;' placeholder='$i18n.getString("search_by_name_identifier")' />
+			<input type='text' id='searchPatientByIds' name='searchPatientByIds' onchange='searchByIdsOnclick();' style='width:350px;' placeholder='$i18n.getString("search_by_identifier")' />
 		</td>
 		<td>
 			<input type='button' value='$i18n.getString("search")' onclick='searchByIdsOnclick();'>
@@ -126,7 +126,7 @@
 			<td id='searchingAttributeIdTD' class="hidden">
 			  <select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
 				#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-					<option value="iden">$i18n.getString( "search_by_name_identifier" )</option>
+					<option value="iden">$i18n.getString( "search_by_identifier" )</option>
 					<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 					#foreach( $attribute in $patientAttributes )
 						<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
@@ -141,7 +141,7 @@
 				<td>
 				  <select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
 					#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-						<option value="iden">$i18n.getString( "search_by_name_identifier" )</option>
+						<option value="iden">$i18n.getString( "search_by_identifier" )</option>
 						<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 						#foreach( $attribute in $patientAttributes )
 							<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2013-12-18 08:01:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2014-01-05 14:04:13 +0000
@@ -63,7 +63,7 @@
 	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 	var i18n_duplicated_patient_list = '$encoder.jsEscape( $i18n.getString( "duplicated_patient_list" ) , "'")';
 	var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
-	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
+	var i18n_search_by_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_identifier" ) , "'")';
 	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
 	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
 	var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-12-31 14:40:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2014-01-05 14:04:13 +0000
@@ -100,7 +100,7 @@
 	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 	var i18n_duplicated_patient_list = '$encoder.jsEscape( $i18n.getString( "duplicated_patient_list" ) , "'")';
 	var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
-	var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
+	var i18n_search_by_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_identifier" ) , "'")';
 	var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
 	var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
 	var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-12-28 15:15:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2014-01-05 14:04:13 +0000
@@ -360,7 +360,6 @@
             {
                 PatientIdentifierType identifierType = patientIdentifierTypeService.getPatientIdentifierType( Integer
                     .parseInt( ids[1] ) );
-
                 identifierType.setPersonDisplayName( personDisplayNames.get( index ) );
                 patientIdentifierTypeService.updatePatientIdentifierType( identifierType );
 
@@ -370,6 +369,9 @@
             {
                 PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer
                     .parseInt( ids[1] ) );
+                patientAttribute.setDisplayedInList( personDisplayNames.get( index ) );
+                patientAttributeService.updatePatientAttribute( patientAttribute );
+                
                 patientAttributes.add( patientAttribute );
             }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java	2013-12-28 15:15:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java	2014-01-05 14:04:13 +0000
@@ -396,6 +396,9 @@
             {
                 PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer
                     .parseInt( ids[1] ) );
+                patientAttribute.setDisplayedInList( personDisplayNames.get( index ) );
+                patientAttributeService.updatePatientAttribute( patientAttribute );
+
                 patientAttributes.add( patientAttribute );
             }
             index++;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2013-12-28 15:15:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2014-01-05 14:04:13 +0000
@@ -12,6 +12,29 @@
 		enable('dateOfIncidentDescription');
 		form.submit();
 	}, function(){
+		
+		var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
+		selectedPropertyIds.empty();
+		var personDisplayNames = jQuery( "#personDisplayNames" );
+		personDisplayNames.empty();
+		var compulsaryIdentifier = jQuery( "#compulsaryIdentifier" );
+		compulsaryIdentifier.empty();
+		
+        if( getFieldValue('type') != 3 ){
+			if(  jQuery("#selectedList").find("tr").length > 0){
+				compulsaryIdentifier.append( "<option value='0' selected='true'></option>");
+			}
+            jQuery("#selectedList").find("tr").each( function( i, item ){
+                selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+				var displayed = jQuery( item ).find( "input[name='displayed']:first");
+				var checked = displayed.attr('checked') ? true : false;
+				personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+			});
+		}
+		else{
+			compulsaryIdentifier.append( "<option value='0' selected='true'></option>");
+		}
+				
 		var daysAllowedSendMessages = jQuery( "#daysAllowedSendMessages" );
 		daysAllowedSendMessages.empty();
 		
@@ -62,20 +85,6 @@
 			userGroup.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
 		});
 		
-		var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
-		selectedPropertyIds.empty();
-		var personDisplayNames = jQuery( "#personDisplayNames" );
-		personDisplayNames.empty();
-
-        if( getFieldValue('type') != 3 ) {
-            jQuery("#selectedList").find("tr").each( function( i, item ){
-                selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-				
-				var displayed = jQuery( item ).find( "input[name='displayed']:first");
-				var checked = displayed.attr('checked') ? true : false;
-				personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-			});
-		}
 	});
 	
 	checkValueIsExist( "name", "validateProgram.action" );	
@@ -264,6 +273,7 @@
 		<th>$i18n.getString( "selected" )
 			<select style='display:none;' multiple id="selectedPropertyIds" name="selectedPropertyIds" ></select>
 			<select style='display:none;' multiple id="personDisplayNames" name="personDisplayNames" ></select>
+			<select id='compulsaryIdentifier' name="compulsaryIdentifier" multiple="multiple" class="hidden {validate:{required:true}}"></select>
 		</th>
 	  </tr>
 	</thead>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-12-28 15:15:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2014-01-05 14:04:13 +0000
@@ -160,9 +160,6 @@
     if( item.selected ) {
       html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectProperties( this )'><td onmousedown='select(event,this)'>" + item.text + "</td>";
       html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
-      if( item.value.match("^attr_") == "attr_" ) {
-        html += " style='display:none' ";
-      }
       html += "></td></tr>";
       selectedList.append(html);
       jQuery(item).remove();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2013-12-28 15:15:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2014-01-05 14:04:13 +0000
@@ -14,70 +14,79 @@
 			enable('dateOfIncidentDescription');
 			form.submit();
 		}, function(){
-				
-				var daysAllowedSendMessages = jQuery( "#daysAllowedSendMessages" );
-				daysAllowedSendMessages.empty();
-				
-				var templateMessages = jQuery( "#templateMessages" );
-				templateMessages.empty();
-				
-				var datesToCompare = jQuery( "#datesToCompare" );
-				datesToCompare.empty();
-				
-				var sendTo = jQuery( "#sendTo" );
-				sendTo.empty();
-				
-				var whenToSend = jQuery( "#whenToSend" );
-				whenToSend.empty();
-				
-				var messageType = jQuery( "#messageType" );
-				messageType.empty();
-				
-				var userGroup = jQuery( "#userGroup" );
-				userGroup.empty();
-				
-				jQuery(".daysAllowedSendMessage").each( function( i, item ){ 
-					var days = (jQuery(item).attr('realvalue')==undefined) ? 0 : jQuery(item).attr('realvalue');
-					daysAllowedSendMessages.append( "<option value='" + days + "' selected='true'>" + days + "</option>" );
-				});
-				
-				jQuery(".templateMessage").each( function( i, item ){ 
-					templateMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				jQuery(".dateToCompare").each( function( i, item ){ 
-					datesToCompare.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				jQuery(".sendTo").each( function( i, item ){ 
-					sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				jQuery(".whenToSend").each( function( i, item ){ 
-					whenToSend.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				jQuery(".messageType").each( function( i, item ){ 
-					messageType.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				jQuery(".userGroup").each( function( i, item ){ 
-					userGroup.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
-				});
-				
-				var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
-				selectedPropertyIds.empty();
-				var personDisplayNames = jQuery( "#personDisplayNames" );
-				personDisplayNames.empty();
-				if(getFieldValue('type')!=3){
-					jQuery("#selectedList").find("tr").each( function( i, item ){ 
-						selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-						var displayed = jQuery( item ).find( "input[name='displayed']:first");
-						var checked = displayed.attr('checked') ? true : false;
-						personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-					});
-				};
-			});
+			var selectedPropertyIds = jQuery( "#selectedPropertyIds" );
+			selectedPropertyIds.empty();
+			var personDisplayNames = jQuery( "#personDisplayNames" );
+			personDisplayNames.empty();
+			var compulsaryIdentifier = jQuery( "#compulsaryIdentifier" );
+			compulsaryIdentifier.empty();
+			
+			if( getFieldValue('type') != 3 ){
+				if(  jQuery("#selectedList").find("tr").length > 0){
+					compulsaryIdentifier.append( "<option value='0' selected='true'></option>");
+				}
+				jQuery("#selectedList").find("tr").each( function( i, item ){
+					selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+					var displayed = jQuery( item ).find( "input[name='displayed']:first");
+					var checked = displayed.attr('checked') ? true : false;
+					personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+				});
+			}
+			else{
+				compulsaryIdentifier.append( "<option value='0' selected='true'></option>");
+			}
+			
+			var daysAllowedSendMessages = jQuery( "#daysAllowedSendMessages" );
+			daysAllowedSendMessages.empty();
+			
+			var templateMessages = jQuery( "#templateMessages" );
+			templateMessages.empty();
+			
+			var datesToCompare = jQuery( "#datesToCompare" );
+			datesToCompare.empty();
+			
+			var sendTo = jQuery( "#sendTo" );
+			sendTo.empty();
+			
+			var whenToSend = jQuery( "#whenToSend" );
+			whenToSend.empty();
+			
+			var messageType = jQuery( "#messageType" );
+			messageType.empty();
+			
+			var userGroup = jQuery( "#userGroup" );
+			userGroup.empty();
+			
+			jQuery(".daysAllowedSendMessage").each( function( i, item ){ 
+				var days = (jQuery(item).attr('realvalue')==undefined) ? 0 : jQuery(item).attr('realvalue');
+				daysAllowedSendMessages.append( "<option value='" + days + "' selected='true'>" + days + "</option>" );
+			});
+			
+			jQuery(".templateMessage").each( function( i, item ){ 
+				templateMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+			jQuery(".dateToCompare").each( function( i, item ){ 
+				datesToCompare.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+			jQuery(".sendTo").each( function( i, item ){ 
+				sendTo.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+			jQuery(".whenToSend").each( function( i, item ){ 
+				whenToSend.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+			jQuery(".messageType").each( function( i, item ){ 
+				messageType.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+			jQuery(".userGroup").each( function( i, item ){ 
+				userGroup.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+			});
+			
+		});
 	checkValueIsExist( "name", "validateProgram.action",{id:getFieldValue('id')} );
 });
 
@@ -277,6 +286,7 @@
 			<th>$i18n.getString( "selected" )
 				<select style='display:none;' multiple id="selectedPropertyIds" name="selectedPropertyIds" ></select>
 				<select style='display:none;' multiple id="personDisplayNames" name="personDisplayNames" ></select>
+				<select id='compulsaryIdentifier' name="compulsaryIdentifier" multiple="multiple" class="hidden {validate:{required:true}}"></select>
 			</th>
 		  </tr>
 		</thead>
@@ -321,7 +331,7 @@
 							#foreach( $attribute in $program.patientAttributes )
 								<tr ondblclick="unSelectProperties( this )" id="attr_$attribute.id">
 									<td onmousedown="select(event, this)">$encoder.htmlEncode( $attribute.name )</td>
-									<td align="center"><input type="checkbox" name="displayed" style='display:none' /></td>
+									<td align="center"><input type="checkbox" name="displayed" value="attr_$attribute.id" #if($attribute.displayedInList == true ) checked #end #if($program.type==3) disabled #end  /></td>
 								</tr>
 							#end
 						</tbody>