← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13515: [mobile] fix bug validate date type attribute in mobile light

 

------------------------------------------------------------
revno: 13515
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Tue 2013-12-31 04:55:24 +0700
message:
  [mobile] fix bug validate date type attribute in mobile light
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.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/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2013-12-16 15:45:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2013-12-30 21:55:24 +0000
@@ -41,6 +41,8 @@
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
@@ -74,6 +76,13 @@
     {
         this.patientIdentifierService = patientIdentifierService;
     }
+    
+    private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
 
     private ProgramService programService;
 
@@ -212,14 +221,31 @@
 
     private Collection<PatientIdentifier> patientIdentifiers;
 
+    public void setPatientIdentifiers( Collection<PatientIdentifier> patientIdentifiers )
+    {
+        this.patientIdentifiers = patientIdentifiers;
+    }
+    
+    public PatientAttributeValueService getPatientAttributeValueService()
+    {
+        return patientAttributeValueService;
+    }
+
     public Collection<PatientIdentifier> getPatientIdentifiers()
     {
         return patientIdentifiers;
     }
-
-    public void setPatientIdentifiers( Collection<PatientIdentifier> patientIdentifiers )
-    {
-        this.patientIdentifiers = patientIdentifiers;
+    
+    private Collection<PatientAttributeValue> patientAttributeValues;
+    
+    public void setPatientAttributeValues( Collection<PatientAttributeValue> patientAttributeValues )
+    {
+        this.patientAttributeValues = patientAttributeValues;
+    }
+    
+    public Collection<PatientAttributeValue> getPatientAttributeValues()
+    {
+        return patientAttributeValues;
     }
 
     private List<ProgramInstance> listOfCompletedProgram;
@@ -279,6 +305,8 @@
         relationshipTypes = relationshipTypeService.getAllRelationshipTypes();
 
         patientIdentifiers = patientIdentifierService.getPatientIdentifiers( patient );
+        
+        patientAttributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
 
         Collection<ProgramInstance> listOfProgramInstance = patient.getProgramInstances();
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-12-16 18:01:29 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-12-30 21:55:24 +0000
@@ -258,6 +258,7 @@
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2013-09-16 17:07:25 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2013-12-30 21:55:24 +0000
@@ -97,13 +97,6 @@
 <p>
 	<ul>
 		<li><strong>$i18n.getString("gender"):</strong>  #if ($patient.gender == "F") Female #else Male #end</li>
-		#set($day = $patient.birthDate.date)
-		#set($month = $patient.birthDate.month+1)
-		#set($year = $patient.birthDate.year + 1900)
-		<li><strong>$i18n.getString("date_of_birth"):</strong>  $year - $month - $day </li>
-		#if($patient.getPhoneNumber())
-			<li><strong>$i18n.getString("phone_number"):</strong>  $patient.getPhoneNumber()</li>
-		#end
 		<li><strong>$i18n.getString("orgunit"):</strong>  $patient.getOrganisationUnit().getName() <a href="showPatientLocationForm.action?patientId=$patient.id">[$i18n.getString("change")]</a></li>
         #if($patient.getIsDead() == true) <li><strong>$i18n.getString("status"):</strong> $i18n.getString("dead")</li> #end
 		#foreach($patientIdentifier in $patientIdentifiers)
@@ -111,6 +104,12 @@
 				<li><strong>$patientIdentifier.getIdentifierType().getName():</strong>  $patientIdentifier.getIdentifier()</li>
 			#end
 		#end
+		
+		#foreach($pav in $patientAttributeValues)
+			#if($pav.getValue())
+				<li><strong>$pav.getPatientAttribute().getName():</strong>  $pav.getValue()</li>
+			#end
+		#end
 					
 	</ul>
 </p>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm	2013-11-13 07:16:38 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm	2013-12-30 21:55:24 +0000
@@ -28,72 +28,6 @@
      	#end
 
 		<input type="text" name="patientFullName" value="$!previousValues.get("fullName")" />
-
-		<label>$i18n.getString( "gender" )</label>
-		<select name="gender">
-		
-		<option value="F"
-			#if($previousValues.get("gender") == "F")
-				selected
-			#end
-			>$i18n.getString( "female" )</option>
-			
-			<option value="M"
-			#if($previousValues.get("gender") == "M")
-				selected
-			#end
-			>$i18n.getString( "male" )</option>
-			
-			
-			
-			<option value="T"
-			#if($previousValues.get("gender") == "T")
-				selected
-			#end
-			>$i18n.getString( "transgender" )</option>
-		</select>
-		
-		<label>$i18n.getString( "date_of_birth" )</label>
-		<select name="dobType">
-			<option value="A"
-			#if($previousValues.get("dobType") == "A")
-				selected
-			#end
-			>$i18n.getString( "approximated" )</option>
-			
-			<option value="D"
-			#if($previousValues.get("dobType") == "D")
-				selected
-			#end
-			>$i18n.getString( "declared" )</option>
-			
-			<option value="V"
-			#if($previousValues.get("dobType") == "V")
-				selected
-			#end
-			>$i18n.getString( "verified" )</option>
-		</select>
-		<label>$i18n.getString( "date_of_birth_hint" )</label><br/>
-		#if( $validationMap.get( "dob" ) )
-           	<span style="color: #990000;"> $i18n.getString($validationMap.get( "dob" ))</span>
-     	#end
-		<input type="text" name="dateOfBirth" value="$!previousValues.get("dob")" />
-		
-		<label>$i18n.getString( "phone_number" )</label>
-		
-		#if( $validationMap.get( "phoneNumber" ) )
-           	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "phoneNumber" ))</span>
-     	#end
-     	
-     	
-     	#if ($previousValues.get("phoneNumber"))
-     		#set($phoneValue = $previousValues.get("phoneNumber"))
-     	#else
-     		#set($phoneValue = $phoneNumberAreaCode)
-	    #end
-	    
-		<input type="text" name="phoneNumber" value="$phoneValue" />
-		
 		
 		#foreach($patientIdentifierType in $patientIdentifierTypes)
 			#if(! $patientIdentifierType.program)
@@ -109,24 +43,30 @@
 		#foreach($patientAttribute in $patientAttributes)
 			#if(! $patientAttribute.program)
 				#set($key = "AT${patientAttribute.id}")
-				<label>$patientAttribute.getName()#if( $patientAttribute.isMandatory() )*#end  </label>
+				<label>$patientAttribute.getName()#if( $patientAttribute.isMandatory() )*#end  #if( $patientAttribute.getValueType() == "date" )[yyyy-mm-dd] #end</label>
 				#if( $validationMap.get( $key ) )
 		           	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( $key ))</span>
 		     	#end
-				#if($patientAttribute.getValueType() == "COMBO")
+				#if($patientAttribute.getValueType() == "combo")
 					<select type="text" name="$key">
 					#foreach($option in $patientAttribute.getAttributeOptions())
-						<option value="$option.id"
-							#if( $prevDataValues.get( $key ) == $option.id ) 
+						<option value="$option.id" 
+							#if( $previousValues.get( $key ) == $option.id ) 
 								selected="selected"
 							#end
 							> $option.getName() </option>
 					#end
 					</select>
-				#elseif( $patientAttribute.getValueType() == "YES/NO" )
-					<select name="$key">
-							<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
-							<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
+				#elseif( $patientAttribute.getValueType() == "bool" )
+					<select name="$key">
+							<option value="">$i18n.getString("select")</option>
+							<option #if( $previousValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
+							<option #if( $previousValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
+					</select>
+				#elseif( $patientAttribute.getValueType() == "trueOnly" )
+					<select name="$key">
+							<option value="">$i18n.getString("select")</option>
+							<option #if( $previousValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
 					</select>
 				#else
 					<input type="text" name="$key" value="$!previousValues.get($key)" />