← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13658: Add more property for PatientAtribute to specify the attribute will be displayed in person list.

 

------------------------------------------------------------
revno: 13658
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-08 22:08:21 +0700
message:
  Add more property for PatientAtribute to specify the attribute will be displayed in person list.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientAttributeSortOrderInListNoProgramComparator.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java
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/PatientAttributeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.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/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
  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/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js
  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/listPatient.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/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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-07 18:28:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2014-01-08 15:08:21 +0000
@@ -28,6 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
+
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonView;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -35,16 +45,6 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.common.view.DetailedView;
-import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * @author Abyot Asalefew
  */
@@ -97,6 +97,10 @@
 
     private Integer sortOrderInVisitSchedule;
 
+    private Boolean displayInListNoProgram = false;
+
+    private Integer sortOrderInListNoProgram;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -278,6 +282,32 @@
         this.sortOrderInVisitSchedule = sortOrderInVisitSchedule;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Boolean getDisplayInListNoProgram()
+    {
+        return displayInListNoProgram;
+    }
+
+    public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
+    {
+        this.displayInListNoProgram = displayInListNoProgram;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Integer getSortOrderInListNoProgram()
+    {
+        return sortOrderInListNoProgram;
+    }
+
+    public void setSortOrderInListNoProgram( Integer sortOrderInListNoProgram )
+    {
+        this.sortOrderInListNoProgram = sortOrderInListNoProgram;
+    }
+
     // -------------------------------------------------------------------------
     // Static methods
     // -------------------------------------------------------------------------
@@ -301,7 +331,7 @@
         {
             return -1;
         }
-        
+
         Calendar birthCalendar = Calendar.getInstance();
         birthCalendar.setTime( date );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java	2014-01-07 08:22:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java	2014-01-08 15:08:21 +0000
@@ -135,10 +135,28 @@
     /**
      * Get patient attributes which are displayed in visit schedule
      * 
+     * @param displayOnVisitSchedule True/False value
+     * 
      * @return List of patient attributes
      */
     Collection<PatientAttribute> getPatientAttributesByDisplayOnVisitSchedule( boolean displayOnVisitSchedule );
-    
+
+    /**
+     * Get patient attributes which are displayed in visit schedule
+     * 
+     * @param displayInListNoProgram True/False value
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getPatientAttributesWithoutProgram();
 
+    /**
+     * Get patient attributes which are displayed in visit schedule
+     * 
+     * @param displayInListNoProgram True/False value
+     * 
+     * @return List of patient attributes
+     */
+    Collection<PatientAttribute> getPatientAttributesDisplayed( boolean displayInListNoProgram );
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2013-11-05 09:31:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2014-01-08 15:08:21 +0000
@@ -81,9 +81,17 @@
 
     /**
      * Get patient attributes which are displayed in visit schedule
+     * @param displayOnVisitSchedule True/False value
      * 
      * @return List of patient attributes
      */
     Collection<PatientAttribute> getByDisplayOnVisitSchedule( boolean displayOnVisitSchedule );
 
+    /**
+     * Get patient attributes which are displayed in visit schedule
+     * @param displayInListNoProgram True/False value
+     * 
+     * @return List of patient attributes
+     */
+    Collection<PatientAttribute> getPatientAttributesDisplayed( boolean displayInListNoProgram );
 }

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientAttributeSortOrderInListNoProgramComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientAttributeSortOrderInListNoProgramComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientAttributeSortOrderInListNoProgramComparator.java	2014-01-08 15:08:21 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.patient.PatientAttribute;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ PatientAttributeSortOrderInListNoProgramComparator.java Jan 8,
+ *          2014 9:24:20 PM $
+ */
+public class PatientAttributeSortOrderInListNoProgramComparator
+    implements Comparator<PatientAttribute>
+{
+    public int compare( PatientAttribute patientAttribute0, PatientAttribute patientAttribute1 )
+    {
+        if ( patientAttribute0.getSortOrderInListNoProgram() == null
+            || patientAttribute0.getSortOrderInListNoProgram() == 0 )
+        {
+            return patientAttribute0.getName().compareTo( patientAttribute1.getName() );
+        }
+
+        if ( patientAttribute1.getSortOrderInListNoProgram() == null
+            || patientAttribute1.getSortOrderInListNoProgram() == 0 )
+        {
+            return patientAttribute0.getName().compareTo( patientAttribute1.getName() );
+        }
+
+        return patientAttribute0.getSortOrderInListNoProgram() - patientAttribute1.getSortOrderInListNoProgram();
+    }
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2014-01-08 15:08:21 +0000
@@ -134,4 +134,10 @@
 
         return patientAttributes;
     }
+    
+    public Collection<PatientAttribute> getPatientAttributesDisplayed(boolean displayInListNoProgram )
+    {
+        return patientAttributeStore.getPatientAttributesDisplayed( displayInListNoProgram );
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2013-11-05 09:31:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2014-01-08 15:08:21 +0000
@@ -46,39 +46,46 @@
     // Implementation methods
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getByValueType( String valueType )
     {
         return getCriteria( Restrictions.eq( "valueType", valueType ) ).list();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getByMandatory( boolean mandatory )
     {
         return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup()
     {
         return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) )
             .add( Restrictions.eq( "mandatory", false ) ).list();
     }
 
-    public PatientAttribute getByGroupBy( )
+    public PatientAttribute getByGroupBy()
     {
         return (PatientAttribute) getCriteria( Restrictions.eq( "groupBy", true ) ).uniqueResult();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getWithoutGroup()
     {
         return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) ).list();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getByDisplayOnVisitSchedule( boolean displayOnVisitSchedule )
     {
         return getCriteria( Restrictions.eq( "displayOnVisitSchedule", displayOnVisitSchedule ) ).list();
     }
+
+    @SuppressWarnings( "unchecked" )
+    public Collection<PatientAttribute> getPatientAttributesDisplayed( boolean displayInListNoProgram )
+    {
+        return getCriteria( Restrictions.eq( "displayInListNoProgram", displayInListNoProgram ) ).list();
+    }
+
 }

=== 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-07 15:41:48 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2014-01-08 15:08:21 +0000
@@ -301,6 +301,8 @@
             + "INNER JOIN patientidentifiertype pi ON pp.patientidentifiertypeid=pi.patientidentifiertypeid" );
         executeSql( "DROP TABLE program_patientidentifiertypes" );
         executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN personDisplayName" );
+        
+        executeSql( "UPDATE patientattribute SET displayInListNoProgram=false WHERE displayInListNoProgram is null" );
     }
 
     // -------------------------------------------------------------------------

=== 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	2014-01-07 08:22:52 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2014-01-08 15:08:21 +0000
@@ -38,6 +38,8 @@
     <property name="displayOnVisitSchedule" />
 
     <property name="sortOrderInVisitSchedule" />
+    
+    <property name="displayInListNoProgram" />
 
   </class>
 </hibernate-mapping>

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java	2014-01-08 15:08:21 +0000
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.patient;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramPatientAttributeService;
+import org.hisp.dhis.program.ProgramService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ GetAttributesByProgramAction.java Jan 8, 2014 4:16:30 PM $
+ */
+public class GetAttributesByProgramAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private ProgramService programService;
+
+    @Autowired
+    private ProgramPatientAttributeService programPatientAttributeService;
+
+    // -------------------------------------------------------------------------
+    // Getter && Setter
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        if ( id != null )
+        {
+            Program program = programService.getProgram( id );
+            attributes = new ArrayList<PatientAttribute>(
+                programPatientAttributeService.getListPatientAttribute( program ) );
+        }
+        else
+        {
+            
+        }
+        
+        return SUCCESS;
+    }
+}

=== 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	2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java	2014-01-08 15:08:21 +0000
@@ -30,6 +30,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -40,7 +41,12 @@
 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.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.comparator.PatientAttributeSortOrderInListNoProgramComparator;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramPatientAttributeService;
 import org.hisp.dhis.program.ProgramPatientIdentifierTypeService;
@@ -79,6 +85,12 @@
     private UserService userService;
 
     @Autowired
+    private PatientAttributeService patientAttributeService;
+
+    @Autowired
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    @Autowired
     private ProgramPatientAttributeService programPatientAttributeService;
 
     @Autowired
@@ -204,6 +216,20 @@
         return program;
     }
 
+    private List<PatientAttribute> attributes;
+
+    public List<PatientAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    private Collection<PatientIdentifierType> identifierTypes;
+
+    public Collection<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -276,12 +302,18 @@
                 }
             }
 
-            if ( programId != null )
-            {
-                program = programService.getProgram( programId );
-            }
-        }
+        }
+        if ( programId != null )
+        {
+            program = programService.getProgram( programId );
+        }
+        else
+        {
+            attributes = new ArrayList<PatientAttribute>( patientAttributeService.getPatientAttributesDisplayed( true ) );
 
+            Collections.sort( attributes, new PatientAttributeSortOrderInListNoProgramComparator() );
+        }
+        
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2014-01-08 11:18:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2014-01-08 15:08:21 +0000
@@ -679,6 +679,10 @@
 		class="org.hisp.dhis.caseentry.action.patient.GetProgramAction" scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
+	
+	<bean id="org.hisp.dhis.caseentry.action.patient.GetAttributesByProgramAction"
+		class="org.hisp.dhis.caseentry.action.patient.GetAttributesByProgramAction" scope="prototype">
+	</bean>
 
 	<!-- Relationship -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-12-31 03:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2014-01-08 15:08:21 +0000
@@ -714,6 +714,13 @@
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
 
+		<action name="getAttributesByProgram"
+			class="org.hisp.dhis.caseentry.action.patient.GetAttributesByProgramAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-caseentry/jsonProgramAttributes.vm
+			</result>
+		</action>
+		
 		<action name="getVisitSchedule"
 			class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceAction">
 			<result name="success" type="velocity">/content.vm</result>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js	2013-05-14 09:24:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js	2014-01-08 15:08:21 +0000
@@ -109,8 +109,8 @@
 	if( isSaveAll )
 	{
 		jQuery("input[name=aggregateValues]").each(function( ){
-				params += "aggregateValues=" + $(this).val() + "&";
-			}); 
+			params += "aggregateValues=" + $(this).val() + "&";
+		}); 
 	}
 	else
 	{

=== 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	2014-01-05 14:04:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-01-08 15:08:21 +0000
@@ -383,6 +383,26 @@
 	else{
 		hideById('enrollmentSelectTR');
 	}
+	
+	 $.postJSON( "getAttributesByProgram.action", {
+			id:programIdAddPatient
+		}, function( json )  {
+			jQuery('#searchObjectId').find('option').remove()
+			
+			removeAttributeOption('advSearchBox0');			
+			var attributeList = jQuery( '#searchObjectId');	
+				
+			jQuery('input[name=clearSearchBtn]').each(function(){
+				jQuery(this).click();
+			})
+			
+			jQuery('#searchObjectId').append('<option value="iden">' + i18n_search_by_identifier + '</option>');
+			jQuery('#searchObjectId').append('<option value="pi_enrollmentDate">' + i18n_enrollment_date + '</option>');
+			for ( var i in json.attributes ) {
+				jQuery('#searchObjectId').append('<option value="'+json.attributes[i].id+'">'+json.attributes[i].name+'</option>');
+			}
+			addAttributeOption();
+		});
 }
 
 function enableRadioButton( programId )

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	2014-01-08 15:08:21 +0000
@@ -0,0 +1,10 @@
+#set( $size = $program.programPatientAttributes.size() )
+{ "attributes": [
+#foreach( $programPatientAttribute in $program.programPatientAttributes )
+ {
+	"id":  ${programPatientAttribute.patientAttribute.id},
+	"name": "$!encoder.jsonEncode( ${programPatientAttribute.patientAttribute.displayName} )"
+  }#if( $velocityCount < $size ),#end
+#end
+]
+}

=== 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	2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2014-01-08 15:08:21 +0000
@@ -26,14 +26,20 @@
 <tr><td>
 	<table class="listTable" id="patientList" width='100%'>               
           <col width="30"/>
-			#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-				#if($programIdentifierType.displayedInList=='true')
-					<col/>
+			#if($program)
+				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+					#if($programIdentifierType.displayedInList=='true')
+						<col/>
+					#end
 				#end
-			#end
 
-			#foreach( $programAttribute in $program.programPatientAttributes )
-				#if($programAttribute.displayedInList=='true')
+				#foreach( $programAttribute in $program.programPatientAttributes )
+					#if($programAttribute.displayedInList=='true')
+						<col/>
+					#end
+				#end
+			#else
+				#foreach( $attribute in $attributes)
 					<col/>
 				#end
 			#end
@@ -46,20 +52,24 @@
 		  <thead>
 			<tr>
 				<th>#</th>
-				
-				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-					#if($programIdentifierType.displayedInList=='true')
-						<th>$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)</th>
+				#if($program)
+					#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+						#if($programIdentifierType.displayedInList=='true')
+							<th>$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)</th>
+						#end
 					#end
-				#end
 
-				#foreach( $programAttribute in $program.programPatientAttributes )
-					#if($programAttribute.displayedInList=='true')
-						<th id="patientAttributeName">$encoder.htmlEncode($programAttribute.patientAttribute.displayName)</th>
+					#foreach( $programAttribute in $program.programPatientAttributes )
+						#if($programAttribute.displayedInList=='true')
+							<th id="patientAttributeName">$encoder.htmlEncode($programAttribute.patientAttribute.displayName)</th>
+						#end
+					#end
+				#else
+					#foreach( $attribute in $attributes)
+						<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
 					#end
 				#end
 				
-				
 				#if($mapPatientOrgunit.size()!=0)
 					<th>$i18n.getString( "hierachy_orgunit" )</th>
 				#end
@@ -76,23 +86,39 @@
 					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
 					$nr
 				</td>
+				#if($program)
+					#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+						#set($value="")
+						#if($programIdentifierType.displayedInList=='true')
+							<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+								#foreach( $identifier in $patient.identifiers)
+									#if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id)
+										#set($value=$identifier.identifier)
+									#end
+								#end 
+							<a>$encoder.htmlEncode($value)</a>
+						</td>
+						#end
+					#end
 					
-				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-					#set($value="")
-					#if($programIdentifierType.displayedInList=='true')
-						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
-							#foreach( $identifier in $patient.identifiers)
-								#if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id)
-									#set($value=$identifier.identifier)
-								#end
-							#end 
-						<a>$encoder.htmlEncode($value)</a>
-					</td>
+					#foreach( $programAttribute in $program.programPatientAttributes )
+						#if($programAttribute.displayedInList=='true')
+							<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+								#foreach( $attributeValue in $patient.attributeValues)
+									#if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id)
+										#set($value=$attributeValue.value)
+										#if( $programAttribute.patientAttribute.valueType == 'bool')
+											#set($value=$i18n.getString($attributeValue.value))
+										#end
+									#end
+								#end 
+								<a>$encoder.htmlEncode($value)</a>
+							</td>
+						#end
 					#end
-				#end
-				
-				#foreach( $programAttribute in $program.programPatientAttributes )
-					#if($programAttribute.displayedInList=='true')
+				#else
+					#foreach( $attribute in $attributes)
+						#set($value="")
 						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
 							#foreach( $attributeValue in $patient.attributeValues)
 								#if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id)
@@ -106,7 +132,6 @@
 						</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>

=== 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	2014-01-07 15:41:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2014-01-08 15:08:21 +0000
@@ -34,18 +34,23 @@
     <td>    
       <table class="listTable" id="patientList" width='100%'>               
           <col width="30"/>
-			#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-				#if($programIdentifierType.displayedInList=='true')
-					<col/>
+			#if($program)
+				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+					#if($programIdentifierType.displayedInList=='true')
+						<col/>
+					#end
 				#end
-			#end
 
-			#foreach( $programAttribute in $program.programPatientAttributes )
-				#if($programAttribute.displayedInList=='true')
+				#foreach( $programAttribute in $program.programPatientAttributes )
+					#if($programAttribute.displayedInList=='true')
+						<col/>
+					#end
+				#end
+			#else
+				#foreach( $attribute in $attributes)
 					<col/>
 				#end
 			#end
-			
 		  #if($mapPatientOrgunit.size()!=0)
 		  <col/>
 		  #end
@@ -54,16 +59,21 @@
 		  <thead>
 			<tr>
 				<th>#</th>
-				
-				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-					#if($programIdentifierType.displayedInList=='true')
-						<th>$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)</th>
+				#if($program)
+					#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+						#if($programIdentifierType.displayedInList=='true')
+							<th>$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)</th>
+						#end
 					#end
-				#end
 
-				#foreach( $programAttribute in $program.programPatientAttributes )
-					#if($programAttribute.displayedInList=='true')
-						<th id="patientAttributeName">$encoder.htmlEncode($programAttribute.patientAttribute.displayName)</th>
+					#foreach( $programAttribute in $program.programPatientAttributes )
+						#if($programAttribute.displayedInList=='true')
+							<th id="patientAttributeName">$encoder.htmlEncode($programAttribute.patientAttribute.displayName)</th>
+						#end
+					#end
+				#else
+					#foreach( $attribute in $attributes)
+						<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
 					#end
 				#end
 				
@@ -83,40 +93,57 @@
 					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
 					$nr
 				</td>
-				
-				#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
-					#set($value="")
-					#if($programIdentifierType.displayedInList=='true')
-						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
-							#foreach( $identifier in $patient.identifiers)
-								#if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id)
-									#set($value=$identifier.identifier)
-								#end
-							#end 
-						<a>$encoder.htmlEncode($value)</a>
-					</td>
-					#end
-				#end
-				
-				#foreach( $programAttribute in $program.programPatientAttributes )
-					#set($value="")
-					#if($programAttribute.displayedInList=='true')
+				#if($program)
+					#foreach( $programIdentifierType in $program.programPatientIdentifierTypes)
+						#set($value="")
+						#if($programIdentifierType.displayedInList=='true')
+							<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+								#foreach( $identifier in $patient.identifiers)
+									#if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id)
+										#set($value=$identifier.identifier)
+									#end
+								#end 
+							<a>$!encoder.htmlEncode($value)</a>
+						</td>
+						#end
+					#end
+					
+					#foreach( $programAttribute in $program.programPatientAttributes )
+						#set($value="")
+						#if($programAttribute.displayedInList=='true')
+							<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+								#foreach( $attributeValue in $patient.attributeValues)
+									#if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id)
+										#set($value=$attributeValue.value)
+										#if( $programAttribute.patientAttribute.valueType == 'bool')
+											#set($value=$i18n.getString($attributeValue.value))
+										#elseif( $programAttribute.patientAttribute.valueType == 'users')
+											#set($value=$mapUsers.get($attributeValue.value))
+										#end
+									#end
+								#end 
+								<a>$!encoder.htmlEncode($value)</a>
+							</td>
+						#end
+					#end
+				#else
+					#foreach( $patientAttribute in $attributes)
+						#set($value="")
 						<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
 							#foreach( $attributeValue in $patient.attributeValues)
-								#if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id)
+								#if($!attributeValue.patientAttribute.id==$patientAttribute.id)
 									#set($value=$attributeValue.value)
-									#if( $programAttribute.patientAttribute.valueType == 'bool')
+									#if( $patientAttribute.valueType == 'bool')
 										#set($value=$i18n.getString($attributeValue.value))
-									#elseif( $programAttribute.patientAttribute.valueType == 'users')
+									#elseif( $patientAttribute.valueType == 'users')
 										#set($value=$mapUsers.get($attributeValue.value))
 									#end
 								#end
 							#end 
-							<a>$encoder.htmlEncode($value)</a>
+							<a>$!encoder.htmlEncode($value)</a>
 						</td>
 					#end
 				#end
-				
 				#if($mapPatientOrgunit.size()!=0)
 					<td>$!mapPatientOrgunit.get($patient.id)</td>
 				#end

=== 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	2014-01-05 14:04:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2014-01-08 15:08:21 +0000
@@ -172,6 +172,8 @@
 	var i18n_view_all = '[' + '$encoder.jsEscape( $i18n.getString( "view_all" ) , "'")' + ']';
 	var i18n_none_program = '[' + '$encoder.jsEscape( $i18n.getString( "none_program" ) , "'")' + ']';
 	var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")' + ']';
+	var i18n_search_by_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_identifier" ) , "'")';
+	var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollment_date" ) , "'")';
 	
 	datePicker( 'startDueDate', true );
 	datePicker( 'endDueDate', true );

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm	2013-03-08 09:15:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm	2014-01-08 15:08:21 +0000
@@ -5,6 +5,7 @@
 	"description": "$!encoder.jsonEncode( ${patientAttribute.description} )",
 	"mandatory":  "$!{patientAttribute.mandatory}",
 	"valueType": "$!patientAttribute.valueType",
+	"displayInListNoProgram": "$!patientAttribute.displayInListNoProgram",
 	"inherit": "$!patientAttribute.inherit"
   }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2014-01-08 15:08:21 +0000
@@ -114,7 +114,14 @@
     {
         this.expression = expression;
     }
-    
+
+    private Boolean displayInListNoProgram;
+
+    public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
+    {
+        this.displayInListNoProgram = displayInListNoProgram;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -130,6 +137,9 @@
         patientAttribute.setExpression( expression );
         patientAttribute.setDisplayOnVisitSchedule( false );
 
+        displayInListNoProgram = (displayInListNoProgram == null) ? false : true;
+        patientAttribute.setDisplayInListNoProgram( displayInListNoProgram );
+
         mandatory = (mandatory == null) ? false : true;
         patientAttribute.setMandatory( mandatory );
 

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java	2014-01-08 15:08:21 +0000
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.patientattribute;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ SavePatientAttributeInListNoProgramAction.java Jan 8, 2014 8:52:31
+ *          PM $
+ */
+public class SavePatientAttributeInListNoProgramAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer[] selectedAttributeIds;
+
+    public void setSelectedAttributeIds( Integer[] selectedAttributeIds )
+    {
+        this.selectedAttributeIds = selectedAttributeIds;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
+
+        int index = 1;
+        for ( Integer attributeId : selectedAttributeIds )
+        {
+            PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( attributeId );
+            patientAttribute.setDisplayInListNoProgram( true );
+            patientAttribute.setSortOrderInListNoProgram( index );
+            patientAttributeService.updatePatientAttribute( patientAttribute );
+            index++;
+            patientAttributes.remove( patientAttribute );
+        }
+
+        // Set visitSchedule=false for other patientAttributes
+        for ( PatientAttribute patientAttribute : patientAttributes )
+        {
+            patientAttribute.setDisplayInListNoProgram( false );
+            patientAttribute.setSortOrderInListNoProgram( 0 );
+            patientAttributeService.updatePatientAttribute( patientAttribute );
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java	2014-01-08 15:08:21 +0000
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.patientattribute;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ ShowPatientAttributeInListNoProgramAction.java Jan 8, 2014 8:33:46
+ *          PM $
+ */
+public class ShowPatientAttributeInListNoProgramAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<PatientAttribute> availablePatientAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getAvailablePatientAttributes()
+    {
+        return availablePatientAttributes;
+    }
+
+    private List<PatientAttribute> selectedPatientAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getSelectedPatientAttributes()
+    {
+        return selectedPatientAttributes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        availablePatientAttributes = new ArrayList<PatientAttribute>(
+            patientAttributeService.getPatientAttributesDisplayed( false ) );
+        Collections.sort( availablePatientAttributes, IdentifiableObjectNameComparator.INSTANCE );
+
+        selectedPatientAttributes = new ArrayList<PatientAttribute>(
+            patientAttributeService.getPatientAttributesDisplayed( true ) );
+        Collections.sort( availablePatientAttributes, IdentifiableObjectNameComparator.INSTANCE );
+
+        return SUCCESS;
+    }
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2014-01-08 15:08:21 +0000
@@ -137,6 +137,13 @@
         this.expression = expression;
     }
 
+    private Boolean displayInListNoProgram;
+
+    public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
+    {
+        this.displayInListNoProgram = displayInListNoProgram;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -152,6 +159,9 @@
         patientAttribute.setExpression( expression );
         patientAttribute.setDisplayOnVisitSchedule( false );
 
+        displayInListNoProgram = (displayInListNoProgram == null) ? false : true;
+        patientAttribute.setDisplayInListNoProgram( displayInListNoProgram );
+
         mandatory = (mandatory == null) ? false : true;
         patientAttribute.setMandatory( mandatory );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2014-01-08 15:08:21 +0000
@@ -167,6 +167,22 @@
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>
+	
+	<bean
+		id="org.hisp.dhis.patient.action.patientattribute.ShowPatientAttributeInListNoProgramAction"
+		class="org.hisp.dhis.patient.action.patientattribute.ShowPatientAttributeInListNoProgramAction"
+		scope="prototype">
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.patient.action.patientattribute.SavePatientAttributeInListNoProgramAction"
+		class="org.hisp.dhis.patient.action.patientattribute.SavePatientAttributeInListNoProgramAction"
+		scope="prototype">
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+	</bean>
 
 	<!-- Program -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2014-01-07 18:18:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2014-01-08 15:08:21 +0000
@@ -492,4 +492,6 @@
 data_entry_method_for_option_sets=Data entry method for option sets
 users = Users
 attribute_users = Attribute users
-view_template_reminder_message = View template reminder message 
\ No newline at end of file
+view_template_reminder_message = View template reminder message 
+display_in_list_no_program = Display in list without program
+patient_attribute_displayed_with_no_program = Person attribute displayed with no program
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2014-01-06 13:23:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2014-01-08 15:08:21 +0000
@@ -207,7 +207,24 @@
 			<result name="success" type="redirect">index.action</result>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
 		</action>
+		
+		<action name="patientAttributeInListNoProgram"
+			class="org.hisp.dhis.patient.action.patientattribute.ShowPatientAttributeInListNoProgramAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">
+				/dhis-web-maintenance-patient/patientAttributeInListNoProgram.vm</param>
+			<param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
+			<param name="javascripts">javascript/patientAttribute.js</param>
+			<param name="stylesheets">style/basic.css</param>
+			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
+		</action>
 
+		<action name="savePatientAttributeInListNoProgram"
+			class="org.hisp.dhis.patient.action.patientattribute.SavePatientAttributeInListNoProgramAction">
+			<result name="success" type="redirect">index.action</result>
+			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
+		</action>
+		
 		<!-- Program -->
 
 		<action name="program"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2014-01-06 15:31:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2014-01-08 15:08:21 +0000
@@ -36,6 +36,14 @@
 		</td>		
 		<td></td>				
 	</tr>
+	
+	<tr>
+		<td><label for="inherit">$i18n.getString( "display_in_list_no_program" )</label></td>
+		<td>
+			<input type='checkbox' id="displayInListNoProgram" name="displayInListNoProgram" value='true'>
+		</td>		
+		<td></td>				
+	</tr>
 		
     <tr>
         <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2013-12-17 01:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2014-01-08 15:08:21 +0000
@@ -81,8 +81,8 @@
   jQuery.getJSON("getPatientDataElements.action", {
     programStageId: programStageId
   }, function( json ) {
-    jQuery('#dataElementId').append('<option value="DUE_DATE">' + i18n_due_date + '</option>');
-    jQuery('#dataElementId').append('<option value="REPORT_DATE">' + i18n_report_date + '</option>');
+    jQuery('#dataElementId').append('<option value="[PS:'+programStageId+'.DUE_DATE]">' + i18n_due_date + '</option>');
+    jQuery('#dataElementId').append('<option value="[PS:'+programStageId+'.REPORT_DATE]">' + i18n_report_date + '</option>');
     for( i in json.dataElements ) {
       var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']';
       jQuery('#dataElementId').append('<option value="' + id + '">' + json.dataElements[i].name + '</option>');

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2014-01-06 15:31:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2014-01-08 15:08:21 +0000
@@ -40,6 +40,14 @@
 		<td></td>				
 	</tr>
 	
+	<tr>
+		<td><label for="inherit">$i18n.getString( "display_in_list_no_program" )</label></td>
+		<td>
+			<input type='checkbox' id="displayInListNoProgram" name="displayInListNoProgram" value='true' #if( $patientAttribute.displayInListNoProgram ) checked #end>
+		</td>		
+		<td></td>				
+	</tr>
+	
     <tr>
         <td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
         <td>