← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9973: Fix bug occurs when to load custom registration if a patient-attribute in the form is deleted.

 

------------------------------------------------------------
revno: 9973
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-05 11:09:58 +0700
message:
  Fix bug occurs when to load custom registration if a patient-attribute in the form is deleted.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.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-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-02-13 16:20:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-03-05 04:09:58 +0000
@@ -195,55 +195,73 @@
                 Integer id = Integer.parseInt( identifierMatcher.group( 1 ) );
                 PatientIdentifierType identifierType = identifierTypeService.getPatientIdentifierType( id );
 
-                // Get value
-                String value = "";
-                if ( patient != null )
-                {
-                    PatientIdentifier patientIdentifier = identifierService.getPatientIdentifier( identifierType,
-                        patient );
-                    if ( patientIdentifier != null )
-                    {
-                        value = patientIdentifier.getIdentifier();
-                    }
-                }
-
-                inputHtml = "<input id=\"iden" + id + "\" name=\"iden" + id + "\" tabindex=\"" + index + "\" value=\""
-                    + value + "\" ";
-
-                inputHtml += "class=\"{validate:{required:" + identifierType.isMandatory() + ",";
-                if ( identifierType.getNoChars() != null )
-                {
-                    inputHtml += "maxlength:" + identifierType.getNoChars() + ",";
-                }
-
-                if ( PatientIdentifierType.VALUE_TYPE_NUMBER.equals( identifierType.getType() ) )
-                {
-                    inputHtml += "number:true";
-                }
-                else if ( PatientIdentifierType.VALUE_TYPE_LETTER.equals( identifierType.getType() ) )
-                {
-                    inputHtml += "lettersonly:true";
-                }
-                inputHtml += "}}\" " + TAG_CLOSE;
+                if ( identifierType == null )
+                {
+                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + id
+                        + "]' title='[" + i18n.getString( "missing_patient_identifier_type" ) + " " + id + "]'>/";
+                }
+                else
+                {
+                    // Get value
+                    String value = "";
+                    if ( patient != null )
+                    {
+                        PatientIdentifier patientIdentifier = identifierService.getPatientIdentifier( identifierType,
+                            patient );
+                        if ( patientIdentifier != null )
+                        {
+                            value = patientIdentifier.getIdentifier();
+                        }
+                    }
+
+                    inputHtml = "<input id=\"iden" + id + "\" name=\"iden" + id + "\" tabindex=\"" + index
+                        + "\" value=\"" + value + "\" ";
+
+                    inputHtml += "class=\"{validate:{required:" + identifierType.isMandatory() + ",";
+                    if ( identifierType.getNoChars() != null )
+                    {
+                        inputHtml += "maxlength:" + identifierType.getNoChars() + ",";
+                    }
+
+                    if ( PatientIdentifierType.VALUE_TYPE_NUMBER.equals( identifierType.getType() ) )
+                    {
+                        inputHtml += "number:true";
+                    }
+                    else if ( PatientIdentifierType.VALUE_TYPE_LETTER.equals( identifierType.getType() ) )
+                    {
+                        inputHtml += "lettersonly:true";
+                    }
+                    inputHtml += "}}\" " + TAG_CLOSE;
+                }
             }
             else if ( dynamicAttrMatcher.find() && dynamicAttrMatcher.groupCount() > 0 )
             {
                 Integer id = Integer.parseInt( dynamicAttrMatcher.group( 1 ) );
                 PatientAttribute attribute = attributeService.getPatientAttribute( id );
 
-                // Get value
-                String value = "";
-                if ( patient != null )
-                {
-                    PatientAttributeValue attributeValue = attributeValueService.getPatientAttributeValue( patient,
-                        attribute );
-                    if ( attributeValue != null )
+                if ( attribute == null )
+                {
+                    inputHtml = "<input value='[" + i18n.getString( "missing_patient_attribute" ) + " " + id
+                        + "]' title='[" + i18n.getString( "missing_patient_attribute" ) + " " + id + "]'>/";
+                }
+                else
+                {
+
+                    // Get value
+                    String value = "";
+                    if ( patient != null )
                     {
-                        value = attributeValue.getValue();
+                        PatientAttributeValue attributeValue = attributeValueService.getPatientAttributeValue( patient,
+                            attribute );
+                        if ( attributeValue != null )
+                        {
+                            value = attributeValue.getValue();
+                        }
                     }
+
+                    inputHtml = getAttributeField( inputHtml, attribute, value, i18n, index );
                 }
 
-                inputHtml = getAttributeField( inputHtml, attribute, value, i18n, index );
             }
             else if ( programMatcher.find() && programMatcher.groupCount() > 0 )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-04 14:05:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-05 04:09:58 +0000
@@ -570,4 +570,6 @@
 enter_a_number = Enter a number
 for = For
 date_scheduled = Date scheduled
-visit_schedule_form = Visit schedule
\ No newline at end of file
+visit_schedule_form = Visit schedule
+missing_patient_attribute = Missing person attribute
+missing_patient_identifier_type = Missing patient identifier type
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-03-04 14:05:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-03-05 04:09:58 +0000
@@ -39,7 +39,21 @@
 					#end
 				</td>
 				
-				<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.id' )">$patient.getFullName()</a></td>
+				<td><a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.id' )">
+					#set($value="")
+					#foreach( $identifierType in $identifierTypes)
+						#foreach( $identifier in $patient.identifiers)
+							#if($identifier.identifierType.id==$identifierType.id)
+								#set($value=$identifier.identifier)
+							#end
+						#end
+					#end
+					#if($value=="")
+						#set($value=$patient.getFullName())
+					#end
+					
+					$value
+				</a></td>
 				
 				<td>$!patient.phoneNumber</td>
 				

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-03-04 14:05:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-03-05 04:09:58 +0000
@@ -124,6 +124,7 @@
 
 <script>
 	unSave = false;
+	statusSearching = 2;
 	var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")' + ']';
 	var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';
 	var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-02-08 12:46:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-03-05 04:09:58 +0000
@@ -29,9 +29,12 @@
 					}
 			});
 		
-		datePickerValid( 'patientForm [id=registrationDate]' );
-		datePickerValid( 'patientForm [id=birthDate]' );
-		datePickerValid( 'patientForm [id=deathDate]' );
+		#if($!customRegistrationForm)
+		#else
+			datePickerValid( 'patientForm [id=registrationDate]' );
+			datePickerValid( 'patientForm [id=birthDate]' );
+			datePickerValid( 'patientForm [id=deathDate]' );
+		#end
 		addEventForPatientForm( 'patientForm' );
 	});	
 	hideById('patientForm [id=age]');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm	2013-03-05 04:09:58 +0000
@@ -30,7 +30,11 @@
 		jQuery('#patientForm [id^="iden"]').val("");
 		hideById('patientForm [id=age]');
 
+		#if($!customRegistrationForm)
+		#else
 		datePickerValid( 'patientForm [id=birthDate]' );
+		#end
+		
 		addEventForPatientForm('patientForm');
 		jQuery('[name=mainPagelink]').html(i18n_main_form_link);
 	});		

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-02-18 12:16:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-03-05 04:09:58 +0000
@@ -28,9 +28,11 @@
 						}
 					}
 			});
-		
-		datePickerValid( 'patientForm [id=registrationDate]' );
-		datePickerValid( 'patientForm [id=birthDate]' );
+		#if($!customRegistrationForm)
+		#else
+			datePickerValid( 'patientForm [id=registrationDate]' );
+			datePickerValid( 'patientForm [id=birthDate]' );
+		#end
 		addEventForPatientForm( 'patientForm' );
 	});	
 	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-04 14:05:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-05 04:09:58 +0000
@@ -37,7 +37,7 @@
 		showById('showEventUpTo');
 		hideById('startDueDate');
 		hideById('endDueDate');
-		jQuery('#delete_startDueDate').remove();
+		jQuery('#delete_endDueDate').remove();
 		jQuery('#delete_endDueDate').remove();
 		jQuery('#startDueDate').datepicker("destroy");
 		jQuery('#endDueDate').datepicker("destroy");
@@ -205,23 +205,3 @@
 }
 
 function entryFormContainerOnReady (){}
-
-// ----------------------------------------------------------------
-// Click Back to main form
-// ----------------------------------------------------------------
-
-function onClickBackBtn()
-{
-	hideById('patientDashboard');
-	hideById('editPatientDiv');
-	hideById('resultSearchDiv');
-	hideById('enrollmentDiv');
-	hideById('listRelationshipDiv');
-	hideById('addRelationshipDiv');
-	hideById('migrationPatientDiv');
-	showById('mainLinkLbl');
-	showById('selectDiv');
-	showById('listPatientDiv');
-	showActitityList();
-}
-

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-02-26 06:26:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-03-05 04:09:58 +0000
@@ -241,8 +241,11 @@
 	showById('mainLinkLbl');
 	showById('selectDiv');
 	showById('searchDiv');
-	
-	if( statusSearching == 0)
+	if(statusSearching==2)
+	{
+		return;
+	}
+	else if( statusSearching == 0)
 	{
 		listAllPatient();
 	}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-03-04 14:05:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-03-05 04:09:58 +0000
@@ -14,7 +14,7 @@
 		<td rowspan='2' valign='bottom'>
 			<input type="button" class='large-button' id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" disabled >
 			<input type="button" class='large-button' id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();" disabled >
-			<input type="button" class='large-button' id='advancedSearchBtn' value='$i18n.getString( "search" )' onclick="jQuery('#advanced-search').toggle();" disabled>
+			<input type="button" class='large-button' id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();" disabled>
 		</td>
 	</tr> 
 	<tr id='programAddPatientTR'>
@@ -70,7 +70,9 @@
 				<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>
 				<option value="fixedAttr_phoneNumber">$i18n.getString( "phone_number" )</option>
 				#foreach( $attribute in $patientAttributes )
+					#if($attribute.valueType!='calculated')
 					<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
+					#end
 				#end
 			  </select>
 			  <em title="$i18n.getString( 'required' )" class="required">*</em></label>
@@ -100,7 +102,9 @@
 					<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>
 					<option value="fixedAttr_phoneNumber">$i18n.getString( "phone_number" )</option>
 					#foreach( $attribute in $patientAttributes )
+						#if($attribute.valueType!='calculated')
 						<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
+						#end
 					#end
 				  </select>
 				  <em title="$i18n.getString( 'required' )" class="required">*</em></label>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2013-02-13 16:20:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm	2013-03-05 04:09:58 +0000
@@ -34,7 +34,11 @@
 		});
 		
 		checkedDuplicate = false;
-		datePickerValid( 'patientForm [id=deathDate]' );
+		#if($!customRegistrationForm)
+		#else
+			datePickerValid( 'patientForm [id=deathDate]' );
+		#end
+		
 		addEventForPatientForm('patientForm');
 		if("$!patient.dobType" == 'A'){ 
 			var i18n_please_select_relationshipType = '$encoder.jsEscape( $i18n.getString( "please_verify_birthday" ) , "'")';
@@ -42,7 +46,11 @@
 			alert(i18n_please_select_relationshipType);
 		}
 		else{
-			datePickerValid( 'patientForm [id=birthDate]' );
+			#if($!customRegistrationForm)
+			#else
+				datePickerValid( 'patientForm [id=birthDate]' );
+			#end
+			
 			jQuery('#patientForm [id=age]').css("display","none");
 		}
 	});