← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7578: [mobile]

 

------------------------------------------------------------
revno: 7578
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-11 16:13:18 +0700
message:
  [mobile]
  - validate name length
  - replace type="date" with type="text"
  - show identifier in program summary
  - add proposed date for repeatable events 
  - remove database ID for person
  - add DoB type in person registration form
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java
  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/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/GetRepeatableEventRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.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/resources/org/hisp/dhis/light/i18n_module.properties
  dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm
  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/programStageForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/repeatableEventRegistrationForm.vm
  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/singleevent/singleEventForm.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/anonymous/action/ShowAnonymousFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2012-06-19 03:45:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2012-07-11 09:13:18 +0000
@@ -28,7 +28,6 @@
 package org.hisp.dhis.light.anonymous.action;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 

=== 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	2012-05-24 14:51:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java	2012-07-11 09:13:18 +0000
@@ -27,28 +27,91 @@
 
 package org.hisp.dhis.light.beneficiaryregistration.action;
 
+import java.util.Collection;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+
 import com.opensymphony.xwork2.Action;
 
-public class RegisterBeneficiaryAction implements Action
+public class RegisterBeneficiaryAction
+    implements Action
 {
-    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    public PatientIdentifierTypeService getPatientIdentifierTypeService()
+    {
+        return patientIdentifierTypeService;
+    }
+
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+
+    private PatientAttributeService patientAttributeService;
+
+    public PatientAttributeService getPatientAttributeService()
+    {
+        return patientAttributeService;
+    }
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
     private Integer orgUnitId;
-    
+
     public Integer getOrgUnitId()
     {
         return orgUnitId;
     }
 
-
     public void setOrgUnitId( Integer orgUnitId )
     {
         this.orgUnitId = orgUnitId;
     }
 
+    private Collection<PatientIdentifierType> patientIdentifierTypes;
+
+    public Collection<PatientIdentifierType> getPatientIdentifierTypes()
+    {
+        return patientIdentifierTypes;
+    }
+
+    public void setPatientIdentifierTypes( Collection<PatientIdentifierType> patientIdentifierTypes )
+    {
+        this.patientIdentifierTypes = patientIdentifierTypes;
+    }
+
+    private Collection<PatientAttribute> patientAttributes;
+
+    public Collection<PatientAttribute> getPatientAttributes()
+    {
+        return patientAttributes;
+    }
+
+    public void setPatientAttributes( Collection<PatientAttribute> patientAttributes )
+    {
+        this.patientAttributes = patientAttributes;
+    }
+
     @Override
     public String execute()
         throws Exception
     {
+        patientIdentifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
+        patientAttributes = patientAttributeService.getAllPatientAttributes();
         return SUCCESS;
     }
 

=== 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	2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java	2012-07-11 09:13:18 +0000
@@ -98,7 +98,7 @@
     {
         this.patientFullName = patientFullName;
     }
-    
+
     private String gender;
 
     public String getGender()
@@ -159,6 +159,18 @@
         this.previousValues = previousValues;
     }
 
+    private String dobType;
+
+    public String getDobType()
+    {
+        return dobType;
+    }
+
+    public void setDobType( String dobType )
+    {
+        this.dobType = dobType;
+    }
+
     @Override
     public String execute()
         throws Exception
@@ -167,9 +179,9 @@
 
         patient.setOrganisationUnit( organisationUnitService.getOrganisationUnit( orgUnitId ) );
 
-        if ( this.patientFullName.trim().equals( "" ) )
+        if ( this.patientFullName.trim().length() < 2 )
         {
-            validationMap.put( "fullName", "is_empty" );
+            validationMap.put( "fullName", "is_invalid_name" );
         }
         else
         {
@@ -204,15 +216,31 @@
 
         patient.setGender( gender );
         patient.setRegistrationDate( new Date() );
-        try
+        patient.setDobType( dobType.charAt( 0 ) );
+        
+        if ( dobType.equals( "A" ) )
         {
-            DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
-            DateTime date = sdf.parseDateTime( dateOfBirth );
-            patient.setBirthDate( date.toDate() );
+            try
+            {
+                patient.setBirthDateFromAge( Integer.parseInt( dateOfBirth ), Patient.AGE_TYPE_YEAR );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                validationMap.put( "dob", "is_invalid_number" );
+            }
         }
-        catch ( Exception e )
+        else
         {
-            validationMap.put( "dob", "is_invalid_date" );
+            try
+            {
+                DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
+                DateTime date = sdf.parseDateTime( dateOfBirth );
+                patient.setBirthDate( date.toDate() );
+            }
+            catch ( Exception e )
+            {
+                validationMap.put( "dob", "is_invalid_date" );
+            }
         }
 
         if ( this.validationMap.size() > 0 )
@@ -221,7 +249,8 @@
             this.previousValues.put( "fullName", this.patientFullName );
             this.previousValues.put( "gender", this.gender );
             this.previousValues.put( "dob", this.dateOfBirth );
-            return SUCCESS;
+            this.previousValues.put( "dobType", this.dobType );
+            return ERROR;
         }
 
         patientService.savePatient( patient );

=== 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	2012-06-11 10:11:21 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2012-07-11 09:13:18 +0000
@@ -32,9 +32,10 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
@@ -65,6 +66,18 @@
     {
         this.programInstanceService = programInstanceService;
     }
+    
+    private PatientIdentifierService patientIdentifierService;
+    
+    public PatientIdentifierService getPatientIdentifierService()
+    {
+        return patientIdentifierService;
+    }
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
 
     private ProgramService programService;
 
@@ -215,6 +228,18 @@
     {
         this.validated = validated;
     }
+    
+    private Collection<PatientIdentifier> patientIdentifiers;
+    
+    public Collection<PatientIdentifier> getPatientIdentifiers()
+    {
+        return patientIdentifiers;
+    }
+
+    public void setPatientIdentifiers( Collection<PatientIdentifier> patientIdentifiers )
+    {
+        this.patientIdentifiers = patientIdentifiers;
+    }
 
     @Override
     public String execute()
@@ -249,6 +274,7 @@
         }
         
         relationshipTypes = relationshipTypeService.getAllRelationshipTypes();
+        patientIdentifiers = patientIdentifierService.getPatientIdentifiers( patient );
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRepeatableEventRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRepeatableEventRegistrationFormAction.java	2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRepeatableEventRegistrationFormAction.java	2012-07-11 09:13:18 +0000
@@ -26,6 +26,9 @@
  */
 package org.hisp.dhis.light.namebaseddataentry.action;
 
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
@@ -127,12 +130,32 @@
         this.patientId = patientId;
     }
 
+    private String defaultDueDate;
+    
+    public String getDefaultDueDate()
+    {
+        return defaultDueDate;
+    }
+
+    public void setDefaultDueDate( String defaultDueDate )
+    {
+        this.defaultDueDate = defaultDueDate;
+    }
+
     @Override
     public String execute()
         throws Exception
     {
         programStage = programStageService.getProgramStage( programStageId );
         patientId = programInstanceService.getProgramInstance( programInstanceId ).getPatient().getId();
+
+        Calendar cal = Calendar.getInstance();
+        int standardIntervalDay = 0;
+        if (programStage.getStandardInterval() != null) {
+            standardIntervalDay = programStage.getStandardInterval();
+        }
+        cal.add( Calendar.DATE,  standardIntervalDay);
+        defaultDueDate = new SimpleDateFormat( "yyyy-MM-dd" ).format( cal.getTime() );
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-05-24 14:51:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-07-11 09:13:18 +0000
@@ -32,6 +32,8 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
@@ -122,11 +124,11 @@
         return this.update;
     }
 
-    private List<String> dynForm = new ArrayList<String>( 100 );
+    List<DataElement> dataElements = new ArrayList<DataElement>();
 
-    public List<String> getDynForm()
+    public List<DataElement> getDataElements()
     {
-        return dynForm;
+        return dataElements;
     }
 
     private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
@@ -153,7 +155,14 @@
         ProgramStage programStage = program.getProgramStages().iterator().next();
         programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
         Collections.sort( programStageDataElements, OrderBySortOrder );
-        dynForm.clear();
+
+        if ( programStageDataElements != null )
+        {
+            for ( ProgramStageDataElement each : programStageDataElements )
+            {
+                dataElements.add( each.getDataElement() );
+            }
+        }
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2012-06-18 10:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2012-07-11 09:13:18 +0000
@@ -34,7 +34,12 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -50,7 +55,10 @@
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.util.ContextUtils;
+
 import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
 
 public class SaveSingleEventAction
     implements Action
@@ -112,6 +120,13 @@
     {
         this.util = util;
     }
+    
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
 
     // -------------------------------------------------------------------------
     // Input Output
@@ -123,6 +138,25 @@
     {
         return typeViolations;
     }
+    
+    private Map<String, String> prevDataValues = new HashMap<String, String>();
+
+    public Map<String, String> getPrevDataValues()
+    {
+        return prevDataValues;
+    }
+    
+    List<DataElement> dataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    public void setDataElements( List<DataElement> dataElements )
+    {
+        this.dataElements = dataElements;
+    }
 
     private Integer programId;
 
@@ -197,7 +231,7 @@
     {
         return this.instId;
     }
-
+    
     private List<String> dynForm = new ArrayList<String>();
 
     public void setDynForm( List<String> dynForm )
@@ -250,29 +284,50 @@
 
         programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
         Collections.sort( programStageDataElements, OrderBySortOrder );
+        
+        for ( ProgramStageDataElement each : programStageDataElements )
+        {
+            dataElements.add( each.getDataElement() );
+        }
+        
+        HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
+            ServletActionContext.HTTP_REQUEST );
+        Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
+        
+        typeViolations.clear();
+
+        prevDataValues.clear();
 
         // -------------------------------------------------------------------------
         // Validation
         // -------------------------------------------------------------------------
-
-        int i = 0;
-        for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+        
+        
+        for ( String key : parameterMap.keySet() )
         {
-            DataElement dataElement = programStageDataElement.getDataElement();
-            String value = dynForm.get( i ).trim();
-            Boolean valueIsEmpty = (value == null || value.length() == 0);
-
-            if ( !valueIsEmpty )
+            if ( key.startsWith( "DE" ) )
             {
-                String typeViolation = util.getTypeViolation( dataElement, value );
-
-                if ( typeViolation != null )
+                Integer dataElementId = Integer.parseInt( key.substring( 2, key.length() ) );
+
+                String value = parameterMap.get( key );
+
+                DataElement dataElement = dataElementService.getDataElement( dataElementId );
+
+                value = value.trim();
+
+                Boolean valueIsEmpty = (value == null || value.length() == 0);
+
+                if ( !valueIsEmpty )
                 {
-                    typeViolations.put( String.valueOf( dataElement.getId() ), typeViolation );
+                    String typeViolation = util.getTypeViolation( dataElement, value );
+
+                    if ( typeViolation != null )
+                    {
+                        typeViolations.put( key, typeViolation );
+                    }
+                    prevDataValues.put( key, value );
                 }
             }
-
-            i++;
         }
         
         if ( !typeViolations.isEmpty() )
@@ -297,17 +352,26 @@
         programStageInstance.setCompleted( false );
         programStageInstanceService.addProgramStageInstance( programStageInstance );
 
-        i = 0;
+
         for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
         {
             DataElement dataElement = programStageDataElement.getDataElement();
 
             PatientDataValue patientDataValue = new PatientDataValue();
+
             patientDataValue.setDataElement( dataElement );
-            patientDataValue.setValue( dynForm.get( i ).trim() );
+
+            String id = "DE" + dataElement.getId();
+
+            patientDataValue.setValue( parameterMap.get( id ) );
+
             patientDataValue.setProgramStageInstance( programStageInstance );
+
+            patientDataValue.setProvidedElsewhere( false );
+
+            patientDataValue.setTimestamp( new Date() );
+
             patientDataValueService.savePatientDataValue( patientDataValue );
-            i++;
         }
 
         return SUCCESS;

=== 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	2012-06-18 10:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2012-07-11 09:13:18 +0000
@@ -207,6 +207,7 @@
 		<property name="relationshipTypeService"
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
 	</bean>
 
 	<bean
@@ -261,7 +262,9 @@
 	<bean
 		id="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
 		class="org.hisp.dhis.light.beneficiaryregistration.action.RegisterBeneficiaryAction"
-		scope="prototype">
+		scope="prototype">
+		<property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>
 
 	<bean
@@ -364,7 +367,8 @@
 			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 	</bean>
 
 	<!-- Dashboard -->

=== 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	2012-06-19 03:45:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2012-07-11 09:13:18 +0000
@@ -29,6 +29,7 @@
 is_invalid_integer=is not a valid integer
 is_invalid_positive_integer=is not a valid positive integer
 is_invalid_negative_integer=is not a valid negative integer
+is_invalid_name=is not a valid name
 warnings_and_errors=Warnings and errors
 validation_rule_violation_warnings=Validation Rule Violation Warnings
 minmax_violation_warnings=Min/Max Violation Warnings
@@ -91,4 +92,8 @@
 related_person_search=Related Person Search
 related_person_list=Related Person List
 add_relationship=Add Relationship
-anonymous_menu=Anonymous Menu
\ No newline at end of file
+anonymous_menu=Anonymous Menu
+date_of_birth_type=Date of Birth Type
+approximated=Approximated
+declared=Declared
+verified=Verified
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-06-27 08:00:02 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2012-07-11 09:13:18 +0000
@@ -221,7 +221,8 @@
 
     <action name="saveBeneficiary"
         class="org.hisp.dhis.light.beneficiaryregistration.action.SaveBeneficiaryAction">
-      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+		<result name="success" type="redirect">/light/showBeneficiarySearchingForm.action</result>
+      <result name="error" type="velocity">/dhis-web-light/main.vm</result>
       <param name="page">/dhis-web-light/registration/beneficiaryRegistrationForm.vm</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2012-06-19 03:45:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2012-07-11 09:13:18 +0000
@@ -22,17 +22,13 @@
 			#set( $dataElementName = $dataElement.name )
 		#end		
 		#if (! $dataElement.getOptionSet())
-
 			#set( $key = "DE${dataElement.id}" )
-			
-			<label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end
-			</label><br/>
-			
+			<label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
 			#if( $typeViolations.get( $key ) )
                 #set( $typeViolation = $typeViolations.get( $key ) )
             	<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
             #end
-			
+            
 			#if($dataElement.type=="bool")
 				<select name="$key">
 					<option value="">$i18n.getString("please_select")</option>
@@ -40,47 +36,21 @@
 					<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 				</select>
 			#else
-				<input type=
-				#if($dataElement.type=="string") 
-					"text"
-				#elseif ($dataElement.type=="int" ) 
-					"text" 
-				#else 
-					"$dataElement.type" 
-				#end 
-				name="$key" value="$!prevDataValues.get($key)" />
+				<input type="text" name="$key" value="$!prevDataValues.get($key)" />
 			#end	
-			
 		#elseif ($dataElement.getOptionSet())
-		
 			#set( $options = $dataElement.getOptionSet().getOptions() )
 			#set( $key = "DE${dataElement.id}" )
-			
-			$dataElementName
-			
+			<label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>		
 			#if( $typeViolations.get( $key ) )
 				#set( $typeViolation = $typeViolations.get( $key ) )
 				<br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
             #end
-			
-			<select type=
-			#if($dataElement.type=="string") 
-				"text"
-			#elseif($dataElement.type=="int" ) 
-				"text"
-			#else 
-				"$dataElement.type"
-			#end 
-			name="$key" />
-
+			<select type="text" name="$key" />
 			#set( $selected=false )	
-			
+			<option selected > $i18n.getString("select_option") </option>
 			#foreach ($option in $options)
-				<option value="$option"> $option </option>
-			#end
-			
-			#if( !$selected ) 
-				<option selected > $i18n.getString("select_option") </option>
+				<option value="$option" #if($prevDataValues.get($key) == $option) selected #end> $option </option>
 			#end
 			</select>
 		#end

=== 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	2012-06-11 10:11:21 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-07-11 09:13:18 +0000
@@ -27,7 +27,6 @@
 <h2>$i18n.getString("details")</h2>
 <p>
 	<ul>
-		<li><strong>$i18n.getString("id"):</strong>  $patient.id</li>
 		<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)
@@ -35,7 +34,13 @@
 		<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			
+		#end
+		#foreach($patientIdentifier in $patientIdentifiers)
+			#if($patientIdentifier.getIdentifierType())
+				<li><strong>$patientIdentifier.getIdentifierType().getName():</strong>  $patientIdentifier.getIdentifier()</li>
+			#end
+		#end
+					
 	</ul>
 </p>
 	

=== 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-15 04:30:27 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2012-07-11 09:13:18 +0000
@@ -30,13 +30,10 @@
 				#set( $dataElementName = $dataElement.name )
 			#end
 				#if (! $dataElement.getOptionSet())			
-					
 					#set( $key = "DE${dataElement.id}" )
-
 					<label>$encoder.htmlEncode( $dataElementName )
 					#if($dataElement.type=="date") [yyyy-MM-dd] #end
 					</label>
-					
 					#if( $typeViolations.get( $key ) )
                 		#set( $typeViolation = $typeViolations.get( $key ) )
             			<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
@@ -49,41 +46,23 @@
 							<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 						</select>
 					#else
-						<input type=
-						#if($dataElement.type=="string") 
-							"text"
-						#elseif ($dataElement.type=="int" ) 
-							"text" 
-						#else 
-							"$dataElement.type" 
-						#end 
-						name="$key" value="$!prevDataValues.get($key)" />
+						<input type="text" name="$key" value="$!prevDataValues.get($key)" />
 					#end
 
 				#elseif ($dataElement.getOptionSet())
 					
 					#set( $options = $dataElement.getOptionSet().getOptions() )
 					#set( $key = "DE${dataElement.id}" )
-
-					$dataElementName
-
+					<label>$encoder.htmlEncode( $dataElementName )
+					#if($dataElement.type=="date") [yyyy-MM-dd] #end
+					</label>
 					#if( $typeViolations.get( $key ) )
                     	#set( $typeViolation = $typeViolations.get( $key ) )
                 		<br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
                 	#end
                 
-					<select type=
-					#if($dataElement.type=="string") 
-						"text"
-					#elseif($dataElement.type=="int" ) 
-						"text"
-					#else 
-						"$dataElement.type"
-					#end 
-					name="$key" />
-				
+					<select type="text" name="$key" />
 					#set( $selected=false )
-
 					#foreach ($option in $options)
 						<option value="$option"
 						#if( $prevDataValues.get( $key ) == $option ) 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/repeatableEventRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/repeatableEventRegistrationForm.vm	2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/repeatableEventRegistrationForm.vm	2012-07-11 09:13:18 +0000
@@ -9,7 +9,7 @@
 		#if( $validationMap.get( "enrollmentDate" ) )
            	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "dueDate" ))</span>
      	#end
-		<input type="text" name="nextDueDate" value="$!previousValues.get("dueDate")" />
+		<input type="text" name="nextDueDate" value="#if($previousValues.get("dueDate"))$previousValues.get("dueDate")#else$defaultDueDate#end" />
 	</p>
 </div>
 

=== 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	2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm	2012-07-11 09:13:18 +0000
@@ -39,11 +39,44 @@
 			>$i18n.getString( "transgender" )</option>
 		</select>
 		
-		<label>$i18n.getString( "date_of_birth" ) [yyyy-MM-dd] </label>
+		<label>$i18n.getString( "date_of_birth_type" )</label>
+		<select name="dobType">
+			<option value="A"
+			#if($previousValues.get("dobType") == "A")
+				selected
+			#end
+			>$i18n.getString( "approximated" )</option>
+			
+			<option value="F"
+			#if($previousValues.get("dobType") == "D")
+				selected
+			#end
+			>$i18n.getString( "declared" )</option>
+			
+			<option value="T"
+			#if($previousValues.get("dobType") == "V")
+				selected
+			#end
+			>$i18n.getString( "verified" )</option>
+		</select>
+		
+		<label>$i18n.getString( "date_of_birth" )</label>
 		#if( $validationMap.get( "dob" ) )
            	<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "dob" ))</span>
      	#end
 		<input type="text" name="dateOfBirth" value="$!previousValues.get("dob")" />
+		
+		#foreach($patientIdentifierType in $patientIdentifierTypes)
+			<label>$patientIdentifierType.getName()</label>
+			<input type="text" name="$patientIdentifierType.getId()" value="$!previousValues.get($patientIdentifierType.getId())" />
+		#end
+		
+		#foreach($patientAttribute in $patientAttributes)
+			<label>$patientAttribute.getName()</label>
+			<input type="text" name="$patientAttribute.getId()" value="$!previousValues.get($patientAttribute.getId())" />
+		#end
+
+		
 	</p>
 </div>
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-05-24 14:51:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-07-11 09:13:18 +0000
@@ -4,36 +4,49 @@
 	<div class="header-box" align="center">
 		<p style="text-align: left;">
 		
-		#set( $i = 0 )
-		#foreach( $element in $programStageDataElements )
-
-				<label>$element.getDataElement().getName() #if($element.getDataElement().getType() == "date") (yyyy-mm-dd) #end</label>
-				#set( $key = $element.getDataElement().getId() + '' )
-				#if($typeViolations.get($key))
-					#set( $typeViolation = $typeViolations.get($key) )
-					<label style="color:red;"> $i18n.getString($typeViolation) </label> 
-				#end
-
-				#if ($element.getDataElement().getType() == "bool")
-					<br />
-			    	<select name="dynForm">
-					<option value="please_select">$i18n.getString("please_select")</option>
-					<option value="true" #if($dynForm.isEmpty() == false) #if($!dynForm.get($i) == "true") selected="selected" #end #end >$i18n.getString("Yes")</option>
-					<option value="false" #if($dynForm.isEmpty() == false) #if($!dynForm.get($i) == "false") selected="selected" #end #end >$i18n.getString("No")</option>
-					</select>
-					<br />
-				#elseif ($element.getDataElement().getType() == "date")
-					<input type="date" maxlength="255" size="24" name="dynForm" value="#if($dynForm.isEmpty() == false)$!dynForm.get($i)#end" />
-				#else
-					<input type="text" maxlength="255" size="24" name="dynForm" value="#if($dynForm.isEmpty() == false)$!dynForm.get($i)#end" />
-				#end
-				#set( $i = $i + 1)
+	#foreach( $dataElement in $dataElements)
+		#if( $dataElement.shortName )
+			#set( $dataElementName = $dataElement.shortName )
+		#else
+			#set( $dataElementName = $dataElement.name )
+		#end		
+		#if (! $dataElement.getOptionSet())
+			#set( $key = "DE${dataElement.id}" )
+			<label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
+			#if( $typeViolations.get( $key ) )
+                #set( $typeViolation = $typeViolations.get( $key ) )
+            	<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
+            #end
+			
+			#if($dataElement.type=="bool")
+				<select name="$key">
+					<option value="">$i18n.getString("please_select")</option>
+					<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>
+				</select>
+			#else
+				<input type="text" name="$key" value="$!prevDataValues.get($key)" />
+			#end	
+		#elseif ($dataElement.getOptionSet())
+			#set( $options = $dataElement.getOptionSet().getOptions() )
+			#set( $key = "DE${dataElement.id}" )
+			<label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
+			#if( $typeViolations.get( $key ) )
+				#set( $typeViolation = $typeViolations.get( $key ) )
+				<br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
+            #end
+            
+			<select type="text" name="$key" />
+				<option selected > $i18n.getString("select_option") </option>
+			#foreach ($option in $options)
+				<option value="$option" #if($prevDataValues.get($key) == $option) selected #end> $option </option>
+			#end
+			</select>
 		#end
-		
+	#end
 		<input type="hidden" name="organisationUnitId" value="$organisationUnitId" />
 		<input type="hidden" name="programId" value="$programId" />
 		<input type="hidden" name="patientId" value="$patientId" />
-
 		<input type="submit" value=$i18n.getString("Submit") />
 	    </p>
 	</div>