← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10199: Only load program list according to type of programs in data entry form.

 

------------------------------------------------------------
revno: 10199
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 14:36:22 +0700
message:
  Only load program list according to type of programs in data entry form.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java
  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/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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-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-02-19 06:54:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java	2013-03-14 07:36:22 +0000
@@ -31,6 +31,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.hibernate.Criteria;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -83,9 +84,11 @@
     @Override
     public Collection<Program> get( int type, OrganisationUnit organisationUnit )
     {
-        final String hql = "from Program p where p.type = :type and :organisationUnit in elements(p.organisationUnits)";
-
-        return getQuery( hql ).setInteger( "type", type ).setEntity( "organisationUnit", organisationUnit ).list();
+        Criteria criteria = getCriteria();
+        criteria.createAlias( "organisationUnits", "orgunit" );
+        criteria.add( Restrictions.eq( "type", type ) );
+        criteria.add( Restrictions.eq( "orgunit.id", organisationUnit.getId() ) );
+        return criteria.list();
     }
 
     @Override
@@ -97,7 +100,7 @@
         {
             Set<UserAuthorityGroup> userRoles = userService.getUserCredentials( currentUserService.getCurrentUser() )
                 .getUserAuthorityGroups();
-            
+
             for ( Program program : getAll() )
             {
                 if ( CollectionUtils.intersection( program.getUserRoles(), userRoles ).size() > 0 )

=== 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-11 13:09:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-03-14 07:36:22 +0000
@@ -299,7 +299,7 @@
     <!-- Single-event DataEntry -->
 
     <action name="singleEventSelect"
-      class="org.hisp.dhis.caseentry.action.patient.SelectAction">
+      class="org.hisp.dhis.caseentry.action.caseentry.MultiDataEntrySelectAction">
       <interceptor-ref name="organisationUnitTreeStack" />
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-caseentry/singleEventSelect.vm</param>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-03-06 14:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-03-14 07:36:22 +0000
@@ -53,10 +53,10 @@
 	#parse( "/dhis-web-caseentry/patientForm.vm" )
 	<tr>
 		<td></td>
-		<td>
-			<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick="isContinue=false;" style="width:80px;" />
-			<input type="submit" class="button" value="$i18n.getString( 'add_and_register_new' )" style="width:160px;" onclick="isContinue=true;"/>
-			<input type='button' class="button" value="$i18n.getString( 'cancel' )" onclick="loadPatientList();" style="width:80px;" />
+		<td colspan='2'>
+			<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick="isContinue=false;" style="width:70px;" />
+			<input type="submit" class="button" value="$i18n.getString( 'add_and_register_new' )" style="width:140px;" onclick="isContinue=true;"/>
+			<input type='button' class="button" value="$i18n.getString( 'cancel' )" onclick="loadPatientList();" style="width:70px;" />
 		</td>
 	</tr>
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-03-06 14:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-03-14 07:36:22 +0000
@@ -43,13 +43,22 @@
 	<input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 	<input type="hidden" id="programStageId" name="programStageId" value='$programStage.id'/>
 	
-	<div id='patientForm'>#parse( "/dhis-web-caseentry/patientForm.vm" )</div>
-	<div id="entryForm"> #parse( "/dhis-web-caseentry/singleDataEntryForm.vm" )</div>
-	<p>
-		<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick='_continue=false;' style="width:80px;"/>
-		<input type="submit" class="button" value="$i18n.getString( 'add_and_register_new' )" style="width:160px;" onclick="_continue=true;"/>
-		<input type="button" class="button" value="$i18n.getString( 'back' )" onclick="javascript:backEventList();" style="width:80px;"/>
-	</p>
+	<table>
+		<tbody id='patientForm'>
+			#parse( "/dhis-web-caseentry/patientForm.vm" )
+		</tbody>
+		<tbody>
+			#parse( "/dhis-web-caseentry/singleDataEntryForm.vm" )
+		</tbody>
+		<tr>
+			<td></td>
+			<td>
+				<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick='_continue=false;' style="width:70px;"/>
+				<input type="submit" class="button" value="$i18n.getString( 'add_and_register_new' )" style="width:140px;" onclick="_continue=true;"/>
+				<input type="button" class="button" value="$i18n.getString( 'back' )" onclick="javascript:backEventList();" style="width:70px;"/>
+			</td>
+		</tr>
+	</table>
 </form>
 
 <script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-03-11 07:46:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-03-14 07:36:22 +0000
@@ -2,7 +2,7 @@
 	jQuery(document).ready(	function(){
 		jQuery("#programIdAddPatient option").each(function(){
 			var item = jQuery(this);
-			if(item.attr('type')!=2 && item.val()==''){
+			if(item.attr('type')!=2 ){
 				item.remove();
 			}
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-03-14 07:36:22 +0000
@@ -33,6 +33,7 @@
 		<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' checked /></td>
 	</tr>
 	
+	#if( $program.type == 1 )
 	<tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
 	
 	<tr>
@@ -49,6 +50,7 @@
 		<td><label>$i18n.getString( "standard_interval_days" )</label></td>
 		<td><input type="text" id="standardInterval" name="standardInterval" class="{validate:{number:true}}" disabled /></td>
 	</tr>
+	#end
 	
 	<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2013-03-14 07:36:22 +0000
@@ -34,7 +34,7 @@
 				<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' #if( $programStage.autoGenerateEvent && $programStage.autoGenerateEvent=='true' ) checked #end /></td>
 			</tr>
 			
-			#if($programStage.program.type!=3)
+			#if($programStage.program.type==1)
 				<tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
 		
 				<tr>