← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10019: Use uid instead of id of objects defined in custom person registration form.

 

------------------------------------------------------------
revno: 10019
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-07 12:15:13 +0700
message:
  Use uid instead of id of objects defined in custom person registration form.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.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-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java	2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java	2013-03-07 05:15:13 +0000
@@ -43,6 +43,8 @@
     void updatePatientAttribute( PatientAttribute patientAttribute );
 
     PatientAttribute getPatientAttribute( int id );
+    
+    PatientAttribute getPatientAttribute( String uid );
 
     PatientAttribute getPatientAttributeByName( String name );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2013-01-28 05:28:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2013-03-07 05:15:13 +0000
@@ -118,4 +118,9 @@
         return i18n( i18nService, patientAttributeStore.getWithoutGroup() );
     }
 
+    public PatientAttribute getPatientAttribute( String uid )
+    {
+        return i18n( i18nService, patientAttributeStore.getByUid( uid ) );
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-03-05 04:09:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-03-07 05:15:13 +0000
@@ -192,13 +192,13 @@
             }
             else if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
-                Integer id = Integer.parseInt( identifierMatcher.group( 1 ) );
-                PatientIdentifierType identifierType = identifierTypeService.getPatientIdentifierType( id );
+                String uid = identifierMatcher.group( 1 );
+                PatientIdentifierType identifierType = identifierTypeService.getPatientIdentifierType( uid );
 
                 if ( identifierType == null )
                 {
-                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + id
-                        + "]' title='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + id + "]'>/";
+                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + uid
+                        + "]' title='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + uid + "]'>/";
                 }
                 else
                 {
@@ -214,7 +214,7 @@
                         }
                     }
 
-                    inputHtml = "<input id=\"iden" + id + "\" name=\"iden" + id + "\" tabindex=\"" + index
+                    inputHtml = "<input id=\"iden" + uid + "\" name=\"iden" + uid + "\" tabindex=\"" + index
                         + "\" value=\"" + value + "\" ";
 
                     inputHtml += "class=\"{validate:{required:" + identifierType.isMandatory() + ",";
@@ -236,13 +236,13 @@
             }
             else if ( dynamicAttrMatcher.find() && dynamicAttrMatcher.groupCount() > 0 )
             {
-                Integer id = Integer.parseInt( dynamicAttrMatcher.group( 1 ) );
-                PatientAttribute attribute = attributeService.getPatientAttribute( id );
+                String uid = dynamicAttrMatcher.group( 1 );
+                PatientAttribute attribute = attributeService.getPatientAttribute( uid );
 
                 if ( attribute == null )
                 {
-                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_attribute" ) + " " + id
-                        + "]' title='[" + i18n.getString( "missing_patient_attribute" ) + " " + id + "]'>/";
+                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_attribute" ) + " " + uid
+                        + "]' title='[" + i18n.getString( "missing_patient_attribute" ) + " " + uid + "]'>/";
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-03-07 04:29:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-03-07 05:15:13 +0000
@@ -971,7 +971,7 @@
         {
             sql += "LIMIT " + limit;
         }
-        System.out.println( "\n\n === \n " + sql );
+        
         return sql;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm	2013-02-28 07:29:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm	2013-03-07 05:15:13 +0000
@@ -1,4 +1,4 @@
-<h3>$i18n.getString( "patient_registration_form_management" ) #openHelp( "program" )</h3>
+<h3>$i18n.getString( "patient_registration_form_management" ) #openHelp( "person_registration_form" )</h3>
 
 <table width="70%">
 	#set($display = 'block')

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-02-26 08:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-03-07 05:15:13 +0000
@@ -151,7 +151,7 @@
 			<td>
 				<select id="identifiersSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'iden' )">
 					#foreach( $identifierType in $identifierTypes )
-						<option value="$identifierType.id" mandatory='$identifierType.mandatory' #if($identifierType.mandatory=='true') class="bold" #end >$encoder.htmlEncode($identifierType.displayName)</option>
+						<option value="$identifierType.uid" mandatory='$identifierType.mandatory' #if($identifierType.mandatory=='true') class="bold" #end >$encoder.htmlEncode($identifierType.displayName)</option>
 					#end
 				</select>
 			</td>
@@ -169,7 +169,7 @@
 			<td>
 				<select id="attributesSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'attr' )">
 				#foreach( $attribute in $attributes )
-					<option value="$attribute.id" mandatory='$attribute.mandatory' #if($attribute.mandatory=='true') class="bold" #end >$encoder.htmlEncode($attribute.displayName)</option>
+					<option value="$attribute.uid" mandatory='$attribute.mandatory' #if($attribute.mandatory=='true') class="bold" #end >$encoder.htmlEncode($attribute.displayName)</option>
 				#end
 				</select>
 			</td>