← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10843: Add an option to only allow enrolling person to an orgunit where the program is assigned.

 

------------------------------------------------------------
revno: 10843
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-05-15 16:14:57 +0700
message:
  Add an option to only allow enrolling person to an orgunit where the program is assigned.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.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/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.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/patient.js
  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/jsonProgram.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/resources/org/hisp/dhis/patient/i18n_module.properties


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2013-05-03 07:36:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2013-05-15 09:14:57 +0000
@@ -130,6 +130,11 @@
      */
     private Set<OrganisationUnitGroup> organisationUnitGroups = new HashSet<OrganisationUnitGroup>();
 
+    /**
+     * Allow enrolling person to all orgunit no matter what the program is assigned for the orgunit or not
+     */
+    private Boolean displayOnAllOrgunit = true;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -530,4 +535,15 @@
     {
         this.organisationUnitGroups = organisationUnitGroups;
     }
+
+    public Boolean getDisplayOnAllOrgunit()
+    {
+        return displayOnAllOrgunit;
+    }
+
+    public void setDisplayOnAllOrgunit( Boolean displayOnAllOrgunit )
+    {
+        this.displayOnAllOrgunit = displayOnAllOrgunit;
+    }
+    
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2013-03-14 09:06:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2013-05-15 09:14:57 +0000
@@ -65,5 +65,7 @@
     Collection<Program> getPrograms( int type, OrganisationUnit orgunit );
 
     Program getProgram( String uid );
+    
+    Collection<Program> getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit,  OrganisationUnit orgunit  );
 
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java	2013-03-14 09:06:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java	2013-05-15 09:14:57 +0000
@@ -48,4 +48,6 @@
     Collection<Program> getByCurrentUser();
 
     Collection<Program> getByCurrentUser( int type );
+    
+    Collection<Program> getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit  );
 }

=== 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	2013-04-30 08:03:51 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-05-15 09:14:57 +0000
@@ -213,6 +213,8 @@
         executeSql( "ALTER TABLE patient ALTER COLUMN gender DROP NOT NULL");
         executeSql( "ALTER TABLE patient ALTER COLUMN underage DROP NOT NULL");
         executeSql( "ALTER TABLE program ALTER COLUMN dateofenrollmentdescription DROP NOT NULL");
+        executeSql( "UPDATE program SET displayOnAllOrgunit=true where displayOnAllOrgunit is null" );
+        
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2013-05-03 07:36:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2013-05-15 09:14:57 +0000
@@ -68,37 +68,44 @@
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
-
+    
+    @Override
     public int saveProgram( Program program )
     {
         return programStore.save( program );
     }
 
+    @Override
     public void updateProgram( Program program )
     {
         programStore.update( program );
     }
 
+    @Override
     public void deleteProgram( Program program )
     {
         programStore.delete( program );
     }
 
+    @Override
     public Collection<Program> getAllPrograms()
     {
         return i18n( i18nService, programStore.getAll() );
     }
 
+    @Override
     public Program getProgram( int id )
     {
         return i18n( i18nService, programStore.get( id ) );
     }
 
+    @Override
     public Program getProgramByName( String name )
     {
         return i18n( i18nService, programStore.getByName( name ) );
     }
 
+    @Override
     public Collection<Program> getPrograms( OrganisationUnit organisationUnit )
     {
         Set<Program> programs = new HashSet<Program>();
@@ -106,9 +113,9 @@
         for ( Program program : getAllPrograms() )
         {
             Set<OrganisationUnitGroup> orgunitGroups = program.getOrganisationUnitGroups();
-            for( OrganisationUnitGroup orgunitGroup : orgunitGroups )
+            for ( OrganisationUnitGroup orgunitGroup : orgunitGroups )
             {
-                if( orgunitGroup.getMembers().contains( organisationUnit ))
+                if ( orgunitGroup.getMembers().contains( organisationUnit ) )
                 {
                     programs.add( program );
                 }
@@ -122,6 +129,7 @@
         return i18n( i18nService, programs );
     }
 
+    @Override
     public Collection<Program> getPrograms( ValidationCriteria validationCriteria )
     {
         Set<Program> programs = new HashSet<Program>();
@@ -137,16 +145,19 @@
         return i18n( i18nService, programs );
     }
 
+    @Override
     public Collection<Program> getPrograms( int type )
     {
         return i18n( i18nService, programStore.getByType( type ) );
     }
 
+    @Override
     public Collection<Program> getPrograms( int type, OrganisationUnit orgunit )
     {
         return i18n( i18nService, programStore.get( type, orgunit ) );
     }
 
+    @Override
     public Collection<Program> getProgramsByCurrentUser()
     {
         return i18n( i18nService, programStore.getByCurrentUser() );
@@ -158,8 +169,16 @@
         return i18n( i18nService, programStore.getByCurrentUser( type ) );
     }
 
+    @Override
     public Program getProgram( String uid )
     {
         return i18n( i18nService, programStore.getByUid( uid ) );
     }
+    
+    @Override
+    public Collection<Program> getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit )
+    {
+         return i18n( i18nService, programStore.getProgramsByDisplayOnAllOrgunit( displayOnAllOrgunit, orgunit ) );
+    }
+    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java	2013-03-21 07:56:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java	2013-05-15 09:14:57 +0000
@@ -72,14 +72,14 @@
     // Implemented methods
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     @Override
     public Collection<Program> getByType( int type )
     {
         return getCriteria( Restrictions.eq( "type", type ) ).list();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     @Override
     public Collection<Program> get( int type, OrganisationUnit organisationUnit )
     {
@@ -135,8 +135,25 @@
         }
         else
         {
-            programs = getByType(type);
+            programs = getByType( type );
         }
         return programs;
     }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public Collection<Program> getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit )
+    {
+        Criteria criteria = getCriteria();
+        criteria.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
+        
+        if ( orgunit != null )
+        {
+            criteria.createAlias( "organisationUnits", "orgunit" );
+            criteria.add( Restrictions.eq( "orgunit.id", orgunit.getId() ) );
+        }
+        
+        return criteria.list();
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2013-05-03 07:36:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2013-05-15 09:14:57 +0000
@@ -88,6 +88,8 @@
 	  <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid"/>
 	</set>
 	
+	<property name="displayOnAllOrgunit" />
+	
 	<!-- Access properties -->
 	
     <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_program_userid" />

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java	2013-05-15 09:14:57 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.caseentry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.comparator.ProgramDisplayNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ GetAllProgramsAction.java May 15, 2013 3:33:24 PM $
+ */
+public class GetAllProgramsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitSelectionManager selectionManager;
+
+    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private List<Program> programs;
+
+    public List<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+        programs = new ArrayList<Program>( programService.getProgramsByDisplayOnAllOrgunit( true, null ) );
+        programs.addAll( programService.getProgramsByDisplayOnAllOrgunit( false, organisationUnit ) );
+        programs.retainAll( programService.getProgramsByCurrentUser() );
+        programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+
+        Collections.sort( programs, new ProgramDisplayNameComparator() );
+        
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2013-05-15 09:14:57 +0000
@@ -115,10 +115,11 @@
         patient = patientService.getPatient( id );
 
         // Get all programs
-        programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
-        programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ) );
-        programs.retainAll( programService.getProgramsByCurrentUser());
-        programs.removeAll( patient.getPrograms() );
+        
+        programs = new ArrayList<Program>( programService.getProgramsByDisplayOnAllOrgunit( true, null ) );
+        programs.addAll( programService.getProgramsByDisplayOnAllOrgunit( false, orgunit ) );
+        programs.retainAll( programService.getProgramsByCurrentUser() );
+        programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
         
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, ProgramInstance.STATUS_ACTIVE );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java	2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java	2013-05-15 09:14:57 +0000
@@ -113,15 +113,17 @@
     public String execute()
         throws Exception
     {
+        organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
         patientAttributes = patientAttributeService.getAllPatientAttributes();
 
-        programs = new ArrayList<Program>(programService.getProgramsByCurrentUser());
+        programs = new ArrayList<Program>( programService.getProgramsByDisplayOnAllOrgunit( true, null ) );
+        programs.addAll( programService.getProgramsByDisplayOnAllOrgunit( false, organisationUnit ) );
+        programs.retainAll( programService.getProgramsByCurrentUser() );
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
-        
+
         Collections.sort( programs, new ProgramDisplayNameComparator() );
 
-        organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
         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	2013-05-02 03:31:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-05-15 09:14:57 +0000
@@ -186,6 +186,15 @@
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
+	
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction"
+		scope="prototype">
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="selectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"

=== 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-05-06 06:38:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-05-15 09:14:57 +0000
@@ -303,7 +303,13 @@
       <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonPrograms.vm
       </result>
     </action>
-
+    
+    <action name="getAllPrograms"
+      class="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction">
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonPrograms.vm
+      </result>
+    </action>
+	
     <action name="getDataRecords"
       class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
       <result name="success" type="velocity">/content.vm</result>

=== 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-04-18 06:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-05-15 09:14:57 +0000
@@ -15,6 +15,21 @@
 	enable('advancedSearchBtn');
 	enable('searchObjectId');
 	setFieldValue("orgunitName", orgUnitNames[0]);
+	
+	clearListById('programIdAddPatient');
+	jQuery.get("getAllPrograms.action",{}, 
+		function(json)
+		{
+			jQuery( '#programIdAddPatient').append( '<option value="">' + i18n_view_all + '</option>' );
+			for ( i in json.programs ) {
+				if(json.programs[i].type==1){
+					jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' );
+				}
+			}
+			enableBtn();
+			hideById('programLoader');
+			enable('programIdAddPatient');
+		});
 }
 
 selection.setListenerFunction( organisationUnitSelected );

=== 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-05-14 13:16:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-05-15 09:14:57 +0000
@@ -140,6 +140,7 @@
 	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
 	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
 	var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")';
+	var i18n_view_all = '[' + '$encoder.jsEscape( $i18n.getString( "view_all" ) , "'")' + ']';
 	
 	datePicker( 'startDueDate', true );
 	datePicker( 'endDueDate', true );

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm	2013-04-18 06:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm	2013-05-15 09:14:57 +0000
@@ -16,6 +16,7 @@
 	"blockEntryForm": "$!program.blockEntryForm",
 	"onlyEnrollOnce": "$!program.onlyEnrollOnce",
 	"remindCompleted": "$!program.remindCompleted",
-	"disableRegistrationFields": "$!program.disableRegistrationFields"
+	"disableRegistrationFields": "$!program.disableRegistrationFields",
+	"displayOnAllOrgunit": "$!program.displayOnAllOrgunit"
   }
 }
\ 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/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-04-18 06:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-05-15 09:14:57 +0000
@@ -228,6 +228,13 @@
         this.disableRegistrationFields = disableRegistrationFields;
     }
 
+    private Boolean displayOnAllOrgunit;
+
+    public void setDisplayOnAllOrgunit( Boolean displayOnAllOrgunit )
+    {
+        this.displayOnAllOrgunit = displayOnAllOrgunit;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -243,6 +250,7 @@
         onlyEnrollOnce = (onlyEnrollOnce == null) ? false : onlyEnrollOnce;
         remindCompleted = (remindCompleted == null) ? false : remindCompleted;
         disableRegistrationFields = (disableRegistrationFields == null) ? false : disableRegistrationFields;
+        displayOnAllOrgunit = (displayOnAllOrgunit == null) ? false : displayOnAllOrgunit;
 
         Program program = new Program();
 
@@ -258,6 +266,7 @@
         program.setOnlyEnrollOnce( onlyEnrollOnce );
         program.setRemindCompleted( remindCompleted );
         program.setDisableRegistrationFields( disableRegistrationFields );
+        program.setDisplayOnAllOrgunit( displayOnAllOrgunit );
 
         if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
         {

=== 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-04-18 06:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java	2013-05-15 09:14:57 +0000
@@ -224,6 +224,13 @@
         this.disableRegistrationFields = disableRegistrationFields;
     }
 
+    private Boolean displayOnAllOrgunit;
+
+    public void setDisplayOnAllOrgunit( Boolean displayOnAllOrgunit )
+    {
+        this.displayOnAllOrgunit = displayOnAllOrgunit;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -238,6 +245,7 @@
         blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
         remindCompleted = (remindCompleted == null) ? false : remindCompleted;
         disableRegistrationFields = (disableRegistrationFields == null) ? false : disableRegistrationFields;
+        displayOnAllOrgunit = (displayOnAllOrgunit == null) ? false : displayOnAllOrgunit;
 
         Program program = programService.getProgram( id );
         program.setName( name );
@@ -252,6 +260,7 @@
         program.setOnlyEnrollOnce( onlyEnrollOnce );
         program.setRemindCompleted( remindCompleted );
         program.setDisableRegistrationFields( disableRegistrationFields );
+        program.setDisplayOnAllOrgunit( displayOnAllOrgunit );
 
         if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
         {

=== 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	2013-05-15 03:40:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-05-15 09:14:57 +0000
@@ -392,4 +392,5 @@
 data_entry = Data entry
 combine = Combine
 completed = Completed
-events = Events
\ No newline at end of file
+events = Events
+display_on_all_orgunits = Display on all organisation units
\ No newline at end of file