← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10365: Fix bug - Visit Schedule feature does not list any events in the future.

 

------------------------------------------------------------
revno: 10365
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-21 11:37:26 +0700
message:
  Fix bug - Visit Schedule feature does not list any events in the future.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java
modified:
  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/resources/META-INF/dhis/beans.xml
  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/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/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js


--
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-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-03-06 08:07:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-03-21 04:37:26 +0000
@@ -46,11 +46,13 @@
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientStore;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.system.grid.GridUtils;
+import org.hisp.dhis.system.util.TextUtils;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
@@ -69,6 +71,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     private StatementBuilder statementBuilder;
 
     public void setStatementBuilder( StatementBuilder statementBuilder )
@@ -357,6 +366,7 @@
         boolean hasIdentifier = false;
         boolean isSearchEvent = false;
         boolean isPriorityEvent = false;
+        Collection<Integer> orgunitChilrenIds = getOrgunitChildren( orgunit );
 
         for ( String searchKey : searchKeys )
         {
@@ -435,7 +445,14 @@
                         patientWhere += condition + operatorStatus
                             + "( psi.executiondate is not null and  psi.executiondate>='" + keys[2]
                             + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=true ";
-                        if ( !keys[4].equals( "0" ) )
+                        // get events by orgunit children
+                        if ( keys[4].equals( "-1" ) )
+                        {
+                            patientWhere += " and psi.organisationunitid in( "
+                                + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+                        }
+                        // get events by selected
+                        else if ( !keys[4].equals( "0" ) )
                         {
                             patientWhere += " and psi.organisationunitid=" + keys[4];
                         }
@@ -447,7 +464,14 @@
                         patientWhere += condition + operatorStatus
                             + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
                             + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=false ";
-                        if ( !keys[4].equals( "0" ) )
+                        // get events by orgunit children
+                        if ( keys[4].equals( "-1" ) )
+                        {
+                            patientWhere += " and psi.organisationunitid in( "
+                                + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+                        }
+                        // get events by selected
+                        else if ( !keys[4].equals( "0" ) )
                         {
                             patientWhere += " and psi.organisationunitid=" + keys[4];
                         }
@@ -459,7 +483,14 @@
                         patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
                             + keys[2] + "' and psi.duedate<='" + keys[3]
                             + "' and psi.status is null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
-                        if ( !keys[4].equals( "0" ) )
+                        // get events by orgunit children
+                        if ( keys[4].equals( "-1" ) )
+                        {
+                            patientWhere += " and p.organisationunitid in( "
+                                + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+                        }
+                        // get events by selected
+                        else if ( !keys[4].equals( "0" ) )
                         {
                             patientWhere += " and p.organisationunitid=" + keys[4];
                         }
@@ -471,7 +502,14 @@
                         patientWhere += condition + operatorStatus + "( psi.executiondate is null and  psi.duedate>='"
                             + keys[2] + "' and psi.duedate<='" + keys[3]
                             + "' and psi.status is null  and (DATE(now()) - DATE(psi.duedate) > 0) ";
-                        if ( !keys[4].equals( "0" ) )
+                        // get events by orgunit children
+                        if ( keys[4].equals( "-1" ) )
+                        {
+                            patientWhere += " and p.organisationunitid in( "
+                                + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+                        }
+                        // get events by selected
+                        else if ( !keys[4].equals( "0" ) )
                         {
                             patientWhere += " and p.organisationunitid=" + keys[4];
                         }
@@ -482,7 +520,14 @@
                     case ProgramStageInstance.SKIPPED_STATUS:
                         patientWhere += condition + operatorStatus + "( psi.status=5 and  psi.duedate>='" + keys[2]
                             + "' and psi.duedate<='" + keys[3] + "' ";
-                        if ( !keys[4].equals( "0" ) )
+                        // get events by orgunit children
+                        if ( keys[4].equals( "-1" ) )
+                        {
+                            patientWhere += " and psi.organisationunitid in( "
+                                + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+                        }
+                        // get events by selected
+                        else if ( !keys[4].equals( "0" ) )
                         {
                             patientWhere += " and p.organisationunitid=" + keys[4];
                         }
@@ -533,7 +578,7 @@
             }
         }
 
-        if ( orgunit != null )
+        if ( orgunit != null && !isSearchEvent )
         {
             sql += "(select organisationunitid from patient where patientid=p.patientid and organisationunitid = "
                 + orgunit.getId() + " ) as orgunitid,";
@@ -545,7 +590,7 @@
         String from = " from patient p ";
         if ( isSearchEvent )
         {
-            String subSQL = " ,MIN( psi.programstageinstanceid ) as programstageinstanceid, min(pgs.name) as programstagename, min(psi.duedate) as duedate ";
+            String subSQL = " , psi.programstageinstanceid as programstageinstanceid, pgs.name as programstagename, min(psi.duedate) as duedate ";
             sql = sql + subSQL + from + " inner join programinstance pgi on " + " (pgi.patientid=p.patientid) "
                 + " inner join programstageinstance psi on " + " (psi.programinstanceid=pgi.programinstanceid) "
                 + " inner join programstage pgs on (pgs.programstageid=psi.programstageid) ";
@@ -553,6 +598,7 @@
             {
                 sql += " inner join patientattributevalue pav on p.patientid=pav.patientid ";
             }
+            patientGroupBy += ",psi.programstageinstanceid, pgs.name ";
             orderBy = " ORDER BY duedate DESC ";
             from = " ";
         }
@@ -627,4 +673,13 @@
         return patients;
     }
 
+    private Collection<Integer> getOrgunitChildren( OrganisationUnit orgunit )
+    {
+        Collection<Integer> orgunitIds = new HashSet<Integer>();
+        orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) );
+        orgunitIds.remove( orgunit.getId() );
+
+        return orgunitIds;
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-03-15 14:43:16 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-03-21 04:37:26 +0000
@@ -81,6 +81,7 @@
 	<bean id="org.hisp.dhis.patient.PatientStore" class="org.hisp.dhis.patient.hibernate.HibernatePatientStore">
 		<property name="clazz" value="org.hisp.dhis.patient.Patient" />
 		<property name="sessionFactory" ref="sessionFactory" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 		<property name="statementBuilder" ref="statementBuilder" />
 		<property name="jdbcTemplate" ref="jdbcTemplate" />
 	</bean>

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java	2013-03-05 07:29:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java	1970-01-01 00:00:00 +0000
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2004-2009, 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.Collection;
-import java.util.HashSet;
-import java.util.List;
-
-import org.hisp.dhis.caseentry.state.SelectedStateManager;
-import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version GetActivityPlansAction.java 7:10:29 PM Mar 4, 2013 $
- */
-public class GetActivityPlansAction
-    extends ActionPagingSupport<ProgramStageInstance>
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private SelectedStateManager selectedStateManager;
-
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
-    private ProgramService programService;
-
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
-    private ProgramStageInstanceService programStageInstanceService;
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private I18n i18n;
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private Integer programId;
-
-    public void setProgramId( Integer programId )
-    {
-        this.programId = programId;
-    }
-
-    private Collection<Integer> statusList;
-
-    public void setStatusList( Collection<Integer> statusList )
-    {
-        this.statusList = statusList;
-    }
-
-    private String startDate;
-
-    public void setStartDate( String startDate )
-    {
-        this.startDate = startDate;
-    }
-
-    private String endDate;
-
-    public void setEndDate( String endDate )
-    {
-        this.endDate = endDate;
-    }
-
-    private String facilityLB;
-
-    public void setFacilityLB( String facilityLB )
-    {
-        this.facilityLB = facilityLB;
-    }
-
-    private String type;
-
-    public void setType( String type )
-    {
-        this.type = type;
-    }
-
-    private Integer total;
-
-    public Integer getTotal()
-    {
-        return total;
-    }
-
-    private Program program;
-
-    public Program getProgram()
-    {
-        return program;
-    }
-
-    private List<PatientIdentifierType> identifierTypes;
-
-    public List<PatientIdentifierType> getIdentifierTypes()
-    {
-        return identifierTypes;
-    }
-
-    private List<ProgramStageInstance> programStageInstances;
-
-    public List<ProgramStageInstance> getProgramStageInstances()
-    {
-        return programStageInstances;
-    }
-
-    private Grid grid;
-
-    public Grid getGrid()
-    {
-        return grid;
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation Action
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit();
-
-        // ---------------------------------------------------------------------
-        // Get orgunitIds
-        // ---------------------------------------------------------------------
-
-        Collection<Integer> orgunitIds = new HashSet<Integer>();
-
-        if ( facilityLB.equals( "selected" ) )
-        {
-            orgunitIds.add( orgunit.getId() );
-        }
-        else if ( facilityLB.equals( "childrenOnly" ) )
-        {
-            orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) );
-            orgunitIds.remove( orgunit.getId() );
-        }
-        else
-        {
-            orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) );
-        }
-
-        // ---------------------------------------------------------------------
-        // Program instances for the selected program
-        // ---------------------------------------------------------------------
-
-        program = programService.getProgram( programId );
-
-        if ( type == null )
-        {
-            identifierTypes = program.getPatientIdentifierTypes();
-
-            total = programStageInstanceService.getActiveInstanceCount( program, orgunitIds,
-                format.parseDate( startDate ), format.parseDate( endDate ), statusList );
-
-            this.paging = createPaging( total );
-
-            programStageInstances = programStageInstanceService.activityPlanList( program, orgunitIds,
-                format.parseDate( startDate ), format.parseDate( endDate ), statusList, paging.getStartPos(),
-                paging.getPageSize() );
-        }
-        else
-        {
-            grid = programStageInstanceService.activityPlans( program, orgunitIds, format.parseDate( startDate ),
-                format.parseDate( endDate ), statusList, null, null, i18n );
-        }
-        return type == null ? SUCCESS : type;
-    }
-}

=== 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-03-05 07:29:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2013-03-21 04:37:26 +0000
@@ -173,8 +173,6 @@
         
         if ( searchTexts.size() > 0 )
         {
-            orgunit = (searchBySelectedOrgunit) ? orgunit : null;
-
             total = patientService.countSearchPatients( searchTexts, orgunit );
             this.paging = createPaging( total );
 

=== 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-03-18 05:30:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-03-21 04:37:26 +0000
@@ -1097,19 +1097,5 @@
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
-	
-	<!-- Activity plans -->
-	
-	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction"
-		class="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction"
-		scope="prototype">
-		<property name="selectedStateManager"
-			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="programStageInstanceService"
-			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-		<property name="organisationUnitService"
-			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-	</bean>
 
 </beans>

=== 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-03-15 14:43:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-03-21 04:37:26 +0000
@@ -1085,7 +1085,7 @@
     </action>
 
     <action name="getActivityPlanRecords"
-      class="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction">
+      class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
       <result name="success" type="velocity">/content.vm</result>
       <param name="page">/dhis-web-caseentry/activityPlanRecords.vm</param>
       <param name="stylesheets">style/style.css</param>

=== 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-03-15 08:28:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-03-21 04:37:26 +0000
@@ -18,8 +18,8 @@
 			<th>$i18n.getString('orgunit')</th>
 			<th>$i18n.getString('full_name')</th>
 			<th>$i18n.getString('phone_number')</th>
-			<th>$i18n.getString( "program_stage" )</th>
-			<th>$i18n.getString( "operations" )</th>
+			<th>$i18n.getString('program_stage')</th>
+			<th>$i18n.getString('operations')</th>
 		</tr>
 	</thead>
 	<tbody id="list">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-15 05:48:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-21 04:37:26 +0000
@@ -34,30 +34,41 @@
 
 function showActitityList()
 {
+	setFieldValue('listAll', "true");
 	hideById('listPatientDiv');
 	contentDiv = 'listPatientDiv';
-	
-	var statusList = "";
-	var statusEvent = getFieldValue('statusEvent').split('_');
-	for( var i in statusEvent){
-		statusList += "&statusList=" + statusEvent[i];
-	}
-
 	$('#contentDataRecord').html('');
-	
+	var facilityLB = $('input[name=facilityLB]:checked').val();
+	var programId = getFieldValue('programIdAddPatient');
+	var searchTexts = "stat_" + programId
+					+ "_" + getFieldValue('startDueDate')
+					+ "_" + getFieldValue('endDueDate');
+	if(facilityLB=='selected')
+	{
+		searchTexts += "_" + getFieldValue('orgunitId');
+	}
+	else if(facilityLB=='all')
+	{
+		searchTexts += "_0";
+	}
+	else if(facilityLB=='childrenOnly'){
+		searchTexts += "_-1";
+	}
+	searchTexts += "_false_" + getFieldValue('statusEvent');
+		
 	showLoader();
-	jQuery('#listPatientDiv').load('getActivityPlanRecords.action?' + statusList,
+	jQuery('#listPatientDiv').load('getActivityPlanRecords.action',
 		{
-			programId:getFieldValue('programIdAddPatient'),
-			startDate:getFieldValue('startDueDate'),
-			endDue:getFieldValue('endDueDate'),
-			facilityLB: $('input[name=facilityLB]:checked').val()
+			programId:programId,
+			listAll:false,
+			searchBySelectedOrgunit: false,
+			searchTexts: searchTexts
 		}, 
 		function()
 		{
 			showById('colorHelpLink');
 			showById('listPatientDiv');
-			setTableStyles();
+			resize();
 			hideLoader();
 		});
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-03-07 15:11:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-03-21 04:37:26 +0000
@@ -2,6 +2,8 @@
 
 function multiDataEntryOrgunitSelected( orgUnits, orgUnitNames )
 {
+	setFieldValue('orgunitName', orgUnitNames[0]);
+	setFieldValue('orgunitId', orgUnits[0]);
 	hideById("listPatientDiv");
 	clearListById('programIdAddPatient');
 	$('#contentDataRecord').html('');