← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2941: Merging changes from 2.0.6

 

------------------------------------------------------------
revno: 2941
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-03-01 13:45:27 +0530
message:
  Merging changes from 2.0.6
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java	2011-03-01 08:15:27 +0000
@@ -0,0 +1,14 @@
+package org.hisp.dhis.program.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.program.ProgramStageInstance;
+
+public class ProgramStageInstanceComparator implements Comparator<ProgramStageInstance>
+{
+    public int compare( ProgramStageInstance programStageInstance1, ProgramStageInstance programStageInstance2 )
+    {
+        return programStageInstance1.getProgramStage().getStageInProgram() - programStageInstance2.getProgramStage().getStageInProgram();
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2011-03-01 08:15:27 +0000
@@ -162,8 +162,8 @@
         Session session = sessionFactory.getCurrentSession();
 
         Criteria criteria = session.createCriteria( Period.class );
-        criteria.add( Restrictions.gt( "endDate", startDate ) );
-        criteria.add( Restrictions.lt( "startDate", endDate ) );
+        criteria.add( Restrictions.ge( "endDate", startDate ) );
+        criteria.add( Restrictions.le( "startDate", endDate ) );
         
         return criteria.list();
     }

=== 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	2010-12-08 07:17:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2011-03-01 08:15:27 +0000
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -21,6 +22,7 @@
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.comparator.ProgramStageInstanceComparator;
 
 public class GetDataRecordsAction
     extends ActionPagingSupport<Patient>
@@ -134,6 +136,13 @@
         return programInstances;
     }
 
+    private Map<ProgramInstance, List<ProgramStageInstance>> programStageInstanceMap = new HashMap<ProgramInstance,List<ProgramStageInstance>>();
+    
+    public Map<ProgramInstance, List<ProgramStageInstance>> getProgramStageInstanceMap()
+    {
+        return programStageInstanceMap;
+    }
+
     private Map<Integer, String> colorMap = new HashMap<Integer, String>();
 
     public Map<Integer, String> getColorMap()
@@ -246,7 +255,11 @@
 
                     patinetAttributeValueMap.put( patient, patientAttributeValue );
 
-                    programStageInstances.addAll( programInstance.getProgramStageInstances() );
+                    List<ProgramStageInstance> programStageInstanceList = new ArrayList<ProgramStageInstance>( programInstance.getProgramStageInstances() );
+                    Collections.sort( programStageInstanceList, new ProgramStageInstanceComparator() );
+                    
+                    programStageInstanceMap.put( programInstance, programStageInstanceList );
+                    programStageInstances.addAll( programStageInstanceList );
                 }
             }
         }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2011-01-20 06:06:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2011-03-01 08:15:27 +0000
@@ -31,7 +31,7 @@
 							<td>$!patientAttributeValue.value</td>
 						#end
                         <td><a href="javascript:showPatientDetails( $programInstance.patient.id )" title="$i18n.getString( "show_details" )">$patient.getFullName()</a></td>                    
-                        #foreach( $programStageInstance in $programInstance.programStageInstances )
+                        #foreach( $programStageInstance in $programStageInstanceMap.get( $programInstance ) )
                             #if( $programStageInstance.executionDate )
                                 <td style="text-align:center" bgcolor="$colorMap.get( $programStageInstance.id )">
                                     <a href="javascript:viewPrgramStageRecords( $programStageInstance.id );">$format.formatDate( $programStageInstance.executionDate )</a>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2011-02-18 12:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2011-03-01 08:15:27 +0000
@@ -46,6 +46,15 @@
 			<result name="success" type="velocity">/main.vm </result>
             <param name="page">/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm</param>
 			<param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+			<param name="requiredAuthorities">F_DATAADMIN_LOCK</param>
+		</action>
+
+		<action name="collectiveDataLockingForUnlocking"
+			class="org.hisp.dhis.dataadmin.action.lock.CollectiveDataLockingAction">
+			<result name="success" type="velocity">/main.vm </result>
+            <param name="page">/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm</param>
+			<param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+			<param name="requiredAuthorities">F_DATAADMIN_UNLOCK</param>
 		</action>
 		
 		<action name="getPeriodsForLock"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm	2010-10-07 09:15:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm	2011-03-01 08:15:27 +0000
@@ -79,7 +79,9 @@
 		<tr>
 			<td>
 				<input type="submit" id="lock" name="lock" onclick="setClickedButtonElementValue( true )" value="$i18n.getString( 'lock' )" style="width:10em" disabled="true"/>
-				<input type="submit" id="unlock" name="unlock" onclick="setClickedButtonElementValue( false )" value="$i18n.getString( 'unlock' )" style="width:10em" disabled="true"/>
+				#if( $auth.hasAccess( "dhis-web-maintenance-dataadmin", "collectiveDataLockingForUnlocking") )
+					<input type="submit" id="unlock" name="unlock" onclick="setClickedButtonElementValue( false )" value="$i18n.getString( 'unlock' )" style="width:10em" disabled="true"/>
+				#end	
 			</td>
 		</tr>
 	</table>