dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19077
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8181: [mobile] add the ability to create person while adding relationship
------------------------------------------------------------
revno: 8181
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Fri 2012-09-21 17:18:47 +0700
message:
[mobile] add the ability to create person while adding relationship
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/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/namebased/findRelatedPatientForm.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/beneficiaryregistration/action/RegisterBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java 2012-09-08 14:18:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/RegisterBeneficiaryAction.java 2012-09-21 10:18:47 +0000
@@ -110,6 +110,32 @@
{
this.patientAttributes = patientAttributes;
}
+
+ //Register person on-the-fly
+
+ private Integer originalPatientId;
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
// -------------------------------------------------------------------------
// Action Implementation
=== 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-09-08 14:18:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-09-21 10:18:47 +0000
@@ -271,6 +271,32 @@
{
this.patientAttributes = patientAttributes;
}
+
+ //Register patient on-the-fly
+
+ private Integer originalPatientId;
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
@Override
public String execute()
@@ -471,7 +497,10 @@
patient.setAttributes( patientAttributeSet );
patientId = patientService.createPatient( patient, null, null, patientAttributeValues );
validated = true;
-
+
+ if (this.originalPatientId != null) {
+ return "redirect";
+ }
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-09-14 08:40:13 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-09-21 10:18:47 +0000
@@ -241,7 +241,7 @@
<bean
id="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction"
- class="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction">
+ class="org.hisp.dhis.light.namebaseddataentry.action.AddNewRalationshipAction" scope="prototype">
<property name="relationshipTypeService"
ref="org.hisp.dhis.relationship.RelationshipTypeService" />
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
=== 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-09-19 09:46:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-09-21 10:18:47 +0000
@@ -116,4 +116,5 @@
dead=Dead
status=Status
visit_schedule=Visit Schedule
-visit_schedule_type=Visit Schedule Type
\ No newline at end of file
+visit_schedule_type=Visit Schedule Type
+or_register_new_person=or register new person
\ 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-09-20 08:52:26 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-09-21 10:18:47 +0000
@@ -242,6 +242,8 @@
class="org.hisp.dhis.light.beneficiaryregistration.action.SaveBeneficiaryAction">
<result name="success" type="redirect">/light/showPatientProgramList.action?patientId=${patientId}</result>
<result name="error" type="velocity">/dhis-web-light/main.vm</result>
+ <result name="redirect" type="redirect">/light/showAddNewRelationshipForm.action?originalPatientId=${originalPatientId}&relatedPatientId=${patientId}&relationshipTypeId=${relationshipTypeId}</result>
+ <result name="error" type="velocity">/dhis-web-light/main.vm</result>
<param name="page">/dhis-web-light/registration/beneficiaryRegistrationForm.vm</param>
<param name="requiredAuthorities">F_PATIENT_ADD</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm 2012-09-19 09:46:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm 2012-09-21 10:18:47 +0000
@@ -18,7 +18,7 @@
<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "fullName" ))</span>
#end
<input type="text" name="keyword" value="$!previousValues.get("fullName")" />
- <a href="registerBeneficiary.action?orgUnitId=$orgUnitId&originalPatientId=$originalPatientId&relationshipTypeId=$relationshipTypeId">or Register new Person</a>
+ <a href="registerBeneficiary.action?orgUnitId=$orgUnitId&originalPatientId=$originalPatientId&relationshipTypeId=$relationshipTypeId">$i18n.getString( "or_register_new_person" )</a>
</p>
<p style="text-align: left;">
<label>$i18n.getString( "select_orgunit" )</label>
=== 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-09-06 18:52:44 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm 2012-09-21 10:18:47 +0000
@@ -10,7 +10,16 @@
<form action="saveBeneficiary.action" method="POST">
<div class="header-box" align="center">
-<input type="hidden" name="orgUnitId" value="$orgUnitId"/>
+<input type="hidden" name="orgUnitId" value="$orgUnitId"/>
+#if ($originalPatientId)
+ <input type="hidden" name="originalPatientId" value="$originalPatientId"/>
+#end
+
+#if ($relationshipTypeId)
+ <input type="hidden" name="relationshipTypeId" value="$relationshipTypeId"/>
+#end
+
+
<p style="text-align: left;">
<label>$i18n.getString( "full_name" )*</label>