← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7305: [mobile] bug fix for browser based application

 

------------------------------------------------------------
revno: 7305
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-15 11:30:27 +0700
message:
  [mobile] bug fix for browser based application
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/message.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.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-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2012-06-15 04:30:27 +0000
@@ -153,7 +153,11 @@
 
         for ( org.hisp.dhis.activityplan.Activity activity : activities )
         {
-            items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
+            if ( activity.getDueDate() != null )
+            {
+                items.add( getActivity( activity.getTask(), activity.getDueDate().getTime() < time ) );
+            }
+
         }
 
         if ( items.isEmpty() )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2012-06-15 04:30:27 +0000
@@ -156,7 +156,8 @@
     {
         Collection<Activity> activities = new ArrayList<Activity>();
 
-        Collection<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit );
+        Collection<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION,
+            organisationUnit );
 
         if ( programs.size() > 0 )
         {
@@ -182,7 +183,8 @@
 
         Collection<Activity> activities = new ArrayList<Activity>();
 
-        if ( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit ).containsAll( programs ) )
+        if ( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit ).containsAll(
+            programs ) )
         {
             Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( programs, false );
 
@@ -287,8 +289,8 @@
 
     public Collection<Activity> getActivitiesByProvider( OrganisationUnit organisationUnit, int min, int max )
     {
-        Collection<Integer> programStageInstanceIds = activityPlanStore.getActivitiesByProvider( organisationUnit
-            .getId(), min, max );
+        Collection<Integer> programStageInstanceIds = activityPlanStore.getActivitiesByProvider(
+            organisationUnit.getId(), min, max );
 
         Collection<Activity> activities = new ArrayList<Activity>();
 
@@ -386,7 +388,11 @@
                 Activity activity = new Activity();
                 activity.setBeneficiary( programInstance.getPatient() );
                 activity.setTask( nextStageInstance );
-                activity.setDueDate( nextStageInstance.getDueDate() );
+
+                if ( nextStageInstance != null )
+                {
+                    activity.setDueDate( nextStageInstance.getDueDate() );
+                }
 
                 activities.add( activity );
             }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2012-06-15 04:30:27 +0000
@@ -44,7 +44,9 @@
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.util.ContextUtils;
 import com.opensymphony.xwork2.Action;
@@ -249,6 +251,30 @@
         return prevDataValues;
     }
 
+    private Program program;
+
+    public Program getProgram()
+    {
+        return program;
+    }
+
+    public void setProgram( Program program )
+    {
+        this.program = program;
+    }
+
+    private Patient patient;
+
+    public Patient getPatient()
+    {
+        return patient;
+    }
+
+    public void setPatient( Patient patient )
+    {
+        this.patient = patient;
+    }
+
     @Override
     public String execute()
         throws Exception
@@ -263,8 +289,10 @@
         }
 
         programStage = util.getProgramStage( programId, programStageId );
-
+        program = programStageService.getProgramStage( programStageId ).getProgram();
+        patient = patientService.getPatient( patientId );
         dataElements = programStage.getDataElements();
+        
         int defaultCategoryOptionId = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo().getId();
         HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
             ServletActionContext.HTTP_REQUEST );

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/message.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/message.vm	2012-01-09 14:29:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/message.vm	2012-06-15 04:30:27 +0000
@@ -14,7 +14,7 @@
 
 #foreach( $message in $messages )
 <div class="header-box" align="center">
-	<h3 style="text-align: left;">Reply from $message.sender</h3>
+	<h3 style="text-align: left;">Reply from $message.sender.getName()</h3>
     <p style="text-align: left;">$message.text</p>
 </div>
 #end

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-06-15 04:30:27 +0000
@@ -30,10 +30,10 @@
 				#set( $dataElementName = $dataElement.name )
 			#end
 				#if (! $dataElement.getOptionSet())			
-					#set( $categoryOptionCombo = $dataElement.getCategoryOptionCombos().getModels().get( 0 ) )
+					
 					#set( $key = "DE${dataElement.id}" )
 
-					<label>$encoder.htmlEncode( $dataElementName ) #if( $categoryOptionCombo.name!="(default)")$encoder.htmlEncode( $categoryOptionCombo.name )#end 
+					<label>$encoder.htmlEncode( $dataElementName )
 					#if($dataElement.type=="date") [yyyy-MM-dd] #end
 					</label>