← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14419: [mobile light] remove fullName in tracked entity instance registration form; implement optionSet ...

 

------------------------------------------------------------
revno: 14419
committer: Hong Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 14:41:18 +0700
message:
  [mobile light] remove fullName in tracked entity instance registration form; implement optionSet for combo Value Type
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
  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/beneficiaryregistration/action/RegisterBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java	2014-03-26 07:41:18 +0000
@@ -33,6 +33,7 @@
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.setting.SystemSettingManager;
+import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
 
@@ -142,15 +143,28 @@
         this.phoneNumberAreaCode = phoneNumberAreaCode;
     }
 
+    private Collection<TrackedEntity> trackedEntities;
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
 
+    public Collection<TrackedEntity> getTrackedEntities()
+    {
+        return trackedEntities;
+    }
+
+    public void setTrackedEntities( Collection<TrackedEntity> trackedEntities )
+    {
+        this.trackedEntities = trackedEntities;
+    }
+
     @Override
     public String execute()
         throws Exception
     {
         patientAttributes = patientAttributeService.getAllTrackedEntityAttributes();
+
         phoneNumberAreaCode = (String) systemSettingManager
             .getSystemSetting( SystemSettingManager.KEY_PHONE_NUMBER_AREA_CODE );
         if ( phoneNumberAreaCode == null )

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java	2014-03-20 07:14:38 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java	2014-03-26 07:41:18 +0000
@@ -287,15 +287,6 @@
 
         patient.setOrganisationUnit( organisationUnitService.getOrganisationUnit( orgUnitId ) );
 
-        if ( this.patientFullName.trim().length() < 7 )
-        {
-            validationMap.put( "fullName", "is_invalid_name_length" );
-        }
-        else
-        {
-            patient.setName( patientFullName.trim() );
-        }
-
         HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get( StrutsStatics.HTTP_REQUEST );
         Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
 
@@ -312,16 +303,17 @@
             patientAttributeSet.add( patientAttribute );
 
             String key = "AT" + patientAttribute.getId();
+
             String value = parameterMap.get( key ).trim();
 
             if ( value != null )
             {
-               /* if ( patientAttribute.isMandatory() && value.trim().equals( "" ) )
-                {
-                    this.validationMap.put( key, "is_mandatory" );
-                }
-                else */
-                    if ( value.trim().length() > 0
+                /*
+                 * if ( patientAttribute.isMandatory() && value.trim().equals(
+                 * "" ) ) { this.validationMap.put( key, "is_mandatory" ); }
+                 * else
+                 */
+                if ( value.trim().length() > 0
                     && patientAttribute.getValueType().equals( TrackedEntityAttribute.TYPE_INT )
                     && !MathUtils.isInteger( value ) )
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2014-01-22 04:25:46 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2014-03-26 07:41:18 +0000
@@ -133,4 +133,5 @@
 last_recipients=Last recipients
 search_orgunit=Search Organisation Unit
 date_of_birth_hint=*Approximated: enter age. Declared or Verified: enter date in format [yyyy-mm-dd]
-select_attribute=Select attribute
\ No newline at end of file
+select_attribute=Select attribute
+tracked_entity=Tracked entity
\ No newline at end of file

=== 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	2014-01-23 14:18:27 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm	2014-03-26 07:41:18 +0000
@@ -21,14 +21,7 @@
 
 	
 	<p style="text-align: left;">
-		<label>$i18n.getString( "full_name" )*</label>
-
-		#if( $validationMap.get( "fullName" ) )
-           	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "fullName" ))</span>
-     	#end
-
-		<input type="text" name="patientFullName" value="$!previousValues.get("fullName")" />
-		
+
 		#foreach($patientAttribute in $patientAttributes)
 			#if(! $patientAttribute.program)
 				#set($key = "AT${patientAttribute.id}")
@@ -37,15 +30,11 @@
 		           	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( $key ))</span>
 		     	#end
 				#if($patientAttribute.getValueType() == "combo")
-					<select type="text" name="$key">
-					#foreach($option in $patientAttribute.getAttributeOptions())
-						<option value="$option.id" 
-							#if( $previousValues.get( $key ) == $option.id ) 
-								selected="selected"
-							#end
-							> $option.getName() </option>
-					#end
-					</select>
+				<select type="text" name="$key">
+				 #foreach ($option in $patientAttribute.optionSet.options )
+					 <option value="$option" #if("$value"=="$option") selected #end>$option</option>
+				#end
+				</select>
 				#elseif( $patientAttribute.getValueType() == "bool" )
 					<select name="$key">
 							<option value="">$i18n.getString("select")</option>