← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7428: [mobile] fix exception when search for patient, add current date as default date for enrollment

 

------------------------------------------------------------
revno: 7428
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-27 17:03:43 +0700
message:
  [mobile] fix exception when search for patient, add current date as default date for enrollment
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollment/programEnrollmentForm.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java	2012-05-24 14:51:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java	2012-06-27 10:03:43 +0000
@@ -27,6 +27,9 @@
 
 package org.hisp.dhis.light.beneficiaryenrollment.action;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
@@ -106,6 +109,20 @@
     }
 
     private Program program;
+    
+    private String now;
+    
+    
+
+    public String getNow()
+    {
+        return now;
+    }
+
+    public void setNow( String now )
+    {
+        this.now = now;
+    }
 
     @Override
     public String execute()
@@ -113,6 +130,8 @@
     {
         patient = patientService.getPatient( patientId );
         program = programService.getProgram( programId );
+        now = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java	2012-06-13 07:21:42 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java	2012-06-27 10:03:43 +0000
@@ -91,7 +91,7 @@
         {
             keyword = tokens[0] + "  " + tokens[1];
         }
-        patientList = new ArrayList<Patient>( patientService.getPatientsByNames( keyword, null, null ) );
+        patientList = new ArrayList<Patient>(patientService.getPatientsForMobile( keyword, 0 ) );
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollment/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollment/programEnrollmentForm.vm	2012-05-24 14:51:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollment/programEnrollmentForm.vm	2012-06-27 10:03:43 +0000
@@ -8,8 +8,7 @@
 		#if( $validationMap.get( "enrollmentDate" ) )
            	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "enrollmentDate" ))</span>
      	#end
-		<input type="text" name="enrollmentDate" value="$!previousValues.get("enrollmentDate")" />
-
+		<input type="text" name="enrollmentDate" value="#if($previousValues.get("enrollmentDate"))$previousValues.get("enrollmentDate")#else$now#end" />
 		<label>$i18n.getString( "incident_date" ) [yyyy-MM-dd] </label>
 		#if( $validationMap.get( "incidentDate" ) )
            	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "incidentDate" ))</span>