← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10879: Error when to click Delete this form button in Design Person Registration form.

 

------------------------------------------------------------
revno: 10879
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-05-18 13:51:47 +0700
message:
  Error when to click Delete this form button in  Design Person Registration form.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/DelRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js
  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-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-03-07 05:15:13 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2013-05-18 06:51:47 +0000
@@ -62,7 +62,7 @@
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
-
+    
     public void deletePatientAttribute( PatientAttribute patientAttribute )
     {
         patientAttributeStore.delete( patientAttribute );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/DelRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/DelRegistrationFormAction.java	2013-04-24 07:53:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/DelRegistrationFormAction.java	2013-05-18 06:51:47 +0000
@@ -81,7 +81,7 @@
         PatientRegistrationForm registrationForm = null;
         if ( id != null )
         {
-            Program program = programService.getProgram( id );
+             = programService.getProgram( id );
 
             registrationForm = patientRegistrationFormService.getPatientRegistrationForm( program );
         }
@@ -89,7 +89,7 @@
         {
             registrationForm = patientRegistrationFormService.getCommonPatientRegistrationForm();
         }
-
+        
         patientRegistrationFormService.deletePatientRegistrationForm( registrationForm );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2013-05-16 07:31:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2013-05-18 06:51:47 +0000
@@ -356,12 +356,3 @@
 	} );
 }
 
-function deleteRegistrationFormFromView()
-{
-	var result = window.confirm( i18n_confirm_delete + '\n\n' + name );
-	if ( result )
-	{
-		window.location.href = 'delRegistrationEntryFormAction.action?id=' + id;
-	}
-}
-

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js	2013-04-28 12:07:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js	2013-05-18 06:51:47 +0000
@@ -126,6 +126,7 @@
 		requiredFields['fixedattributeid=registrationDate'] = i18n_registration_date;
 		requiredFields['fixedattributeid=fullName'] = i18n_full_name;
 		requiredFields['fixedattributeid=gender'] = i18n_gender;
+		requiredFields['fixedattributeid=dobType'] = i18n_dob_type;
 		requiredFields['fixedattributeid=birthDate'] = i18n_date_of_birth;
 			
 		jQuery('#identifiersSelector option').each(function() {
@@ -202,8 +203,7 @@
 		violate = '<h3>' + i18n_validate_success + '<h3>';
 	}
 	
-	setInnerHTML('validateDiv', violate);
-	jQuery('#validateDiv').dialog({
+	jQuery('#validateDiv').html(violate).dialog({
 		title:i18n_required_fields_valivation,
 		maximize:true, 
 		closable:true,
@@ -432,6 +432,6 @@
 	var result = window.confirm( i18n_confirm_delete + '\n\n' + name );
 	if ( result )
 	{
-		window.location.href = 'delRegistrationEntryFormAction.action?id=' + id;
+		window.location.href = 'delRegistrationEntryFormAction.action?id=' + getFieldValue('id');
 	}
 }

=== 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-04-28 12:07:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-05-18 06:51:47 +0000
@@ -58,6 +58,10 @@
 <h3>$i18n.getString( "add_patient_registration_form" )</h3>
 <h4>$!program.displayName</h4>
 
+#set($disableRegistrationFields=false)
+#if($program)
+	#set($disableRegistrationFields=$program.disableRegistrationFields)
+#end
 <div class="container" >
 	<table id="detailsList" width="100%">
 		<col/>
@@ -104,7 +108,7 @@
 		    <button type="button" id="propertiesButton" onclick="openPropertiesSelector()"/>$i18n.getString( 'insert_properties' )</button>
 			<button type="button" id="insertImagesButton">$i18n.getString( 'insert_images' )</button>
 			&nbsp;&nbsp;<span style="color:#606060">|</span>&nbsp;
-		    <button type="button" id="deleteButton" #if($!registrationForm.dataEntryForm) style='display:none;' #end onclick="deleteRegistrationFormFromView();"  />$i18n.getString( 'delete_this_form' )</button>
+		    <button type="button" id="deleteButton" #if($!registrationForm.dataEntryForm) #else style='display:none;' #end onclick="deleteRegistrationFormFromView();"  />$i18n.getString( 'delete_this_form' )</button>
 			<input type="checkbox" id="autoSave" name="autoSave" value='$!autoSave' #if($autoSave && $autoSave=="true") checked #end onchange="setAutoSaveRegistrationSetting(this.checked)" />$i18n.getString( 'auto_save_patient_registration_forms' )
         </td>		
     </tr>
@@ -123,14 +127,14 @@
 		<tr>
 			<td>
 				<select id="fixedAttrSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'fixedAttr' )">
-					<option value="registrationDate" class="bold">$i18n.getString('registration_date')</option>
-					<option value="fullName" class="bold">$i18n.getString('full_name')</option>
-					<option value="gender" class="bold">$i18n.getString('gender')</option>
-					<option value="birthDate" class="bold">$i18n.getString('birth_date')</option>
+					<option value="registrationDate">$i18n.getString('registration_date') #if($disableRegistrationFields=='false')*#end</option>
+					<option value="fullName">$i18n.getString('full_name') #if($disableRegistrationFields=='false')*#end</option>
+					<option value="gender">$i18n.getString('gender') #if($disableRegistrationFields=='false')*#end</option>
+					<option value="dobType">$i18n.getString('dob_type') #if($disableRegistrationFields=='false')*#end</option>
+					<option value="birthDate">$i18n.getString('birth_date') #if($disableRegistrationFields=='false')*#end</option>
 					<option value="phoneNumber">$i18n.getString('phone_number')</option>
 					<option value="deathDate">$i18n.getString('death_date')</option>
 					<option value="isDead">$i18n.getString('is_dead')</option>
-					<option value="dobType">$i18n.getString('dob_type')</option>
 					<option value="healthWorker">$i18n.getString('health_worker')</option>
 				</select>
 			</td>
@@ -148,7 +152,7 @@
 			<td>
 				<select id="identifiersSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'iden' )">
 					#foreach( $identifierType in $identifierTypes )
-						<option value="$identifierType.uid" mandatory='$identifierType.mandatory' #if($identifierType.mandatory=='true') class="bold" #end >$encoder.htmlEncode($identifierType.displayName)</option>
+						<option value="$identifierType.uid" mandatory='$identifierType.mandatory'>$encoder.htmlEncode($identifierType.displayName) #if($identifierType.mandatory=='true' && $disableRegistrationFields=='false') * #end </option>
 					#end
 				</select>
 			</td>
@@ -166,7 +170,7 @@
 			<td>
 				<select id="attributesSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'attr' )">
 				#foreach( $attribute in $attributes )
-					<option value="$attribute.uid" mandatory='$attribute.mandatory' #if($attribute.mandatory=='true') class="bold" #end >$encoder.htmlEncode($attribute.displayName)</option>
+					<option value="$attribute.uid" mandatory='$attribute.mandatory'>$encoder.htmlEncode($attribute.displayName) #if($attribute.mandatory=='true') * #end</option>
 				#end
 				</select>
 			</td>
@@ -184,9 +188,9 @@
 		<tr>
 			<td>
 				<select id="programAttrSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'prg' )">
-					<option value="enrollmentDate" mandatory='true' class="bold">$encoder.htmlEncode($program.dateOfEnrollmentDescription)</option>
+					<option value="enrollmentDate" mandatory='true'>$encoder.htmlEncode($program.dateOfEnrollmentDescription) *</option>
 					#if($program.displayIncidentDate=='true')
-					<option value="dateOfIncident" mandatory='true' class="bold">$encoder.htmlEncode($program.dateOfIncidentDescription)</option>
+					<option value="dateOfIncident" mandatory='true'>$encoder.htmlEncode($program.dateOfIncidentDescription) *</option>
 					#end
 				</select>
 			</td>
@@ -244,7 +248,7 @@
 	var i18n_save_unsuccess_please_insert_all_required_fields = '$encoder.jsEscape( $i18n.getString( "save_unsuccess" ) , "'" )' + '. ' + '$encoder.jsEscape( $i18n.getString( "please_insert_all_required_fields" ) , "'" )';
 	var i18n_validate_success = '$encoder.jsEscape( $i18n.getString( "validate_success" ) , "'" )';
 	var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'" )';
-	
+	var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ) , "'" )';
 	jQuery(document).ready(	function(){
 		openPropertiesSelector();
 	});