← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11942: Only load the selected repeatable stage in Create Event box when clicking Complete button in entr...

 

------------------------------------------------------------
revno: 11942
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-06 12:27:42 +0700
message:
  Only load the selected repeatable stage in Create Event box when clicking Complete button in entry form;Remove relatedPatient field in Add/Update program stage form;Fixed bug when to load DobType as Approximated, the custom entry form cannot be saved.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.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/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-09-06 05:27:42 +0000
@@ -70,6 +70,8 @@
 
     public static String FIXED_ATTR_BIRTH_DATE = "birthDate";
     public static String FIXED_ATTR_AGE = "age";
+    public static String FIXED_ATTR_INTERGER_AGE = "integerValueOfAge";
+    public static String FIXED_ATTR_REGISTRATION_DATE = "registrationDate";
 
     private Integer id;
 

=== 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-09-03 14:59:12 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-09-06 05:27:42 +0000
@@ -179,7 +179,7 @@
                 String hidden = "";
                 if ( patient != null )
                 {
-                    Object object = getValueFromPatient( StringUtils.capitalize( fixedAttr ), patient );
+                    Object object = getValueFromPatient( fixedAttr, patient );
                     if ( object != null )
                     {
                         if ( object instanceof Date )
@@ -536,6 +536,12 @@
 
     private Object getValueFromPatient( String property, Patient patient )
     {
+        if ( property.equals( Patient.FIXED_ATTR_AGE ) )
+        {
+            property = Patient.FIXED_ATTR_INTERGER_AGE;
+        }
+        property = StringUtils.capitalize( property );
+
         try
         {
             return Patient.class.getMethod( "get" + property ).invoke( patient );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-09-06 05:27:42 +0000
@@ -425,6 +425,10 @@
                 {
                     patientWhere += " ((DATE(now()) - DATE(birthdate))/365) " + value;
                 }
+                else if(id.equals( Patient.FIXED_ATTR_REGISTRATION_DATE ))
+                {
+                    patientWhere += "p." + id + value;
+                }
                 else
                 {
                     patientWhere += " lower(p." + id + ")='" + value + "'";

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-09-05 17:59:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-09-06 05:27:42 +0000
@@ -75,13 +75,11 @@
 	#end
 </div>
 
-<table id='entryPostComment' class='listTable hidden' style="width:600px;">
+<table id='entryPostComment' class='listTable hidden' style="width:100%;">
 <tr>
-	<th class='coordinates1'><label for="postComment">$i18n.getString('post_comment'):</label></th>
-	<th>
+	<th><label for="postComment">$i18n.getString('post_comment'):</label>
 		<input type="text" class="{validate:{maxlength:160}} criteria" id="commentInput" name='commentInput'
-				style="width:380px;#if($programStage.captureCoordinates=='false') margin-left:11px; padding-left: 2px;  #end "
-			   onkeypress="keypressOnComment( event, this );">
+			style="width:85%" onkeypress="keypressOnComment( event, this );" value="" >
 		<input id="commentButton" name='commentButton' type="button" style='width:40px' value="$i18n.getString('add')" onclick='addComment( byId("commentInput"), $programStageInstance.id )'>
 	</th>
 </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-09-05 17:59:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-09-06 05:27:42 +0000
@@ -123,6 +123,11 @@
 	{
 		element.replaceWith( getAgeTextBox() );
 	}
+	else if ( attributeId=='fixedAttr_registrationDate' )
+	{
+		element.replaceWith( getRegistrationDate(container) );
+		datePickerValid( 'searchText_' + container );
+	}
 	else if ( valueType=='bool' )
 	{
 		element.replaceWith( getTrueFalseBox() );
@@ -159,6 +164,13 @@
 	return ageField;
 }
 
+function getRegistrationDate( container )
+{
+	var registrationDateField = '<select id="dateOperator" name="dateOperator" style="width:40px"><option value=">"> > </option><option value=">="> >= </option><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option></select>';
+	registrationDateField += '<input type="text" id="searchText_' + container + '" name="searchText" style="width:160px;">';
+	return registrationDateField;
+}
+
 function getDateField( container )
 {
 	var dateField = '<select id="dateOperator_' + container + '" name="dateOperator" style="width:40px"><option value=">"> > </option><option value=">="> >= </option><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option></select>';
@@ -544,29 +556,47 @@
 
 function showCreateNewEvent( programInstanceId, programStageId )
 {
+	var flag = false;
+	if(programStageId!=undefined)
+	{
+		jQuery('#repeatableProgramStage_' + programInstanceId + " option ").each(function(){
+			if( jQuery(this).css("display")!='none' && programStageId==jQuery(this).val()){
+				jQuery(this).attr("selected","selected");
+				setSuggestedDueDate( programInstanceId );
+				flag = true;
+			}
+		});
+		jQuery('#repeatableProgramStage_' + programInstanceId ).attr('disabled',true);
+	}
+	else
+	{
+		jQuery('#repeatableProgramStage_' + programInstanceId ).attr('disabled',false);
+	}
+	
+	if(!flag){
+		jQuery('#repeatableProgramStage_' + programInstanceId + " option ").each(function(){
+			if( jQuery(this).css("display")!='none' && !flag ){
+				jQuery(this).attr("selected","selected");
+				setSuggestedDueDate( programInstanceId );
+				flag = true;
+			}
+		});
+	}
+	
+	if(!flag){
+		jQuery('#repeatableProgramStage_' + programInstanceId).val("");
+	}
+	
 	setInnerHTML('createEventMessage_' + programInstanceId, '');
 	jQuery('#createNewEncounterDiv_' + programInstanceId ).dialog({
-			title: i18n_create_new_event,
-			maximize: true, 
-			closable: true,
-			modal:false,
-			overlay:{background:'#000000', opacity:0.1},
-			width: 450,
-			height: 160
-		}).show('fast');
-		
-	var flag = false;
-	jQuery('#repeatableProgramStage_' + programInstanceId + " option ").each(function(){
-		if( jQuery(this).css("display")!='none' && !flag){
-			jQuery(this).attr("selected","selected");
-			setSuggestedDueDate( programInstanceId );
-			flag = true;
-		}
-	});
-	
-	if(!flag){
-		jQuery('#repeatableProgramStage_' + programInstanceId).val("");
-	}
+		title: i18n_create_new_event,
+		maximize: true, 
+		closable: true,
+		modal:false,
+		overlay:{background:'#000000', opacity:0.1},
+		width: 450,
+		height: 160
+	}).show('fast');
 }
 
 function setSuggestedDueDate( programInstanceId )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-09-02 21:20:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-09-06 05:27:42 +0000
@@ -699,6 +699,7 @@
 		jQuery('#delete_' + id ).hide();
 	});
 	jQuery('.date-field').removeClass('datefield');
+	enable('uncompleteBtn');
 }
 
 function unblockEntryForm()

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-09-03 14:59:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-09-06 05:27:42 +0000
@@ -270,13 +270,14 @@
 #end
 
 <script>
-	#if($!patient.dobType && $!patient.dobType=='A') 
+	if(getFieldValue('dobType')=='A'){
 		showById('age');
 		hideById('birthDate');
-	#else
+	}
+	else{
 		hideById('age');
 		showById('birthDate');
-	#end
+	}
 	
 	#if( $!patient.phoneNumber )
 		if(!addRelationship){

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-09-03 03:58:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-09-06 05:27:42 +0000
@@ -99,7 +99,7 @@
 				<select id='repeatableProgramStage_$!programInstance.id' name='repeatableProgramStageId_$!programInstance.id' onchange="setSuggestedDueDate('$programInstance.id')">
 					#foreach( $programStage in $programInstance.program.programStages )
 						#if( $programStage.irregular=='true')
-							<option value="$programStage.id" standardInterval='$programStage.standardInterval' selected repeatable="true">$!programStage.displayName</option>
+							<option value="$programStage.uid" localid='$programStage.id' standardInterval='$programStage.standardInterval' selected repeatable="true">$!programStage.displayName</option>
 						#else
 							#set($hasEvent="false")
 							#foreach( $programStageInstance in $programInstance.programStageInstances )
@@ -108,7 +108,7 @@
 								#end
 							#end
 							
-							<option #if($hasEvent=="true") style="display:none;" #else selected #end value="$programStage.id" standardInterval='$programStage.minDaysFromStart' repeatable="false">$!programStage.displayName</option>
+							<option #if($hasEvent=="true") style="display:none;" #else selected #end value="$programStage.uid" localid='$programStage.id' standardInterval='$programStage.minDaysFromStart' repeatable="false">$!programStage.displayName</option>
 						#end
 					#end
 				</select>
@@ -128,7 +128,7 @@
 		<tr>
 			<td></td>
 			<td>
-				<input type='button' value='$i18n.getString("create")' onclick='registerIrregularEncounter( "$!programInstance.id",getFieldValue("repeatableProgramStage_$!programInstance.id"), jQuery("#repeatableProgramStage_$!programInstance.id option:selected").text(),getFieldValue("dueDateNewEncounter_$programInstance.id" ) );' />
+				<input type='button' value='$i18n.getString("create")' onclick='registerIrregularEncounter( "$!programInstance.id",jQuery("#repeatableProgramStage_$!programInstance.id option:selected").attr("localid"), jQuery("#repeatableProgramStage_$!programInstance.id option:selected").text(),getFieldValue("dueDateNewEncounter_$programInstance.id" ) );' />
 				<input type='button' value='$i18n.getString("cancel")' onclick="closeDueDateDiv('$!programInstance.id');" />
 			</td>
 		</tr>

=== 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-09-05 19:08:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-09-06 05:27:42 +0000
@@ -103,6 +103,7 @@
 				<option value="prg">$i18n.getString( "search_by_program" )</option>
 				
 				#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
+					<option value="fixedAttr_registrationDate">$i18n.getString( "registration_date" )</option>
 					<option value="fixedAttr_birthDate">$i18n.getString( "date_of_birth" )</option>
 					<option value="fixedAttr_age">$i18n.getString( "age_year" )</option>
 					<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>
@@ -119,13 +120,13 @@
 			<tr>
 				<td></td>
 				<td></td>
-				<td name='addAndSearchBtn' rowspan='2' style='padding-top:5px;'>
+				<td name='addAndSearchBtn' rowspan='2' style='padding-bottom:2px;' valign='bottom'>
 					<input type="button" class='normal-button' value='$i18n.getString( "add" )' onclick='addAttributeOption();'>
 				</td>
-				<td name='addAndSearchBtn' rowspan='2' style='padding-top:5px;' align="right" >
+				<td name='addAndSearchBtn' rowspan='2' style='padding-bottom:2px;' valign='bottom' align="right" align="bottom">
 					<input type="button" class='normal-button' value='$i18n.getString( "search" )' onclick='validateAdvancedSearch();' id='searchPatientBtn'>
 				</td>
-				<td name='addAndSearchBtn' rowspan='2' style='padding-top:5px;' align="right" >
+				<td name='addAndSearchBtn' rowspan='2' style='padding-bottom:2px;' valign='bottom' align="right" align="bottom">
 					<input type="button" class='normal-button hidden' id='sendSmsToListBtn' value="$i18n.getString('sms')" onclick="setFieldValue('sendToList', true);showSendSmsForm();" >
 				</td>
 			</tr>
@@ -138,6 +139,7 @@
 					<option value="prg">$i18n.getString( "search_by_program" )</option>
 					
 					#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
+						<option value="fixedAttr_registrationDate">$i18n.getString( "registration_date" )</option>
 						<option value="fixedAttr_birthDate">$i18n.getString( "date_of_birth" )</option>
 						<option value="fixedAttr_age">$i18n.getString( "age_year" )</option>
 						<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm	2013-09-02 21:20:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm	2013-09-06 05:27:42 +0000
@@ -3,7 +3,6 @@
     "id": "${programStage.id}",
 	"name": "$!encoder.jsonEncode( ${programStage.name} )",
 	"description": "$!encoder.jsonEncode( ${programStage.description} )",
-	"relatedPatient": "${programStage.relatedPatient}",
 	"minDaysFromStart": "${programStage.minDaysFromStart}",
 	"dataElementCount": "${programStageDataElements.size()}",
 	"standardInterval": "$!programStage.standardInterval",

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-09-02 21:20:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2013-09-06 05:27:42 +0000
@@ -45,11 +45,6 @@
 		<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' checked /></td>
 	</tr>
 	
-	<tr>
-		<td><label>$i18n.getString( "related_patient" )</em></label></td>
-		<td><input type="checkbox" id="relatedPatient" name="relatedPatient" value='true'/></td>
-	</tr>
-	
 	<tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
 	
 	<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2013-09-02 21:20:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2013-09-06 05:27:42 +0000
@@ -46,11 +46,6 @@
 				<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' #if( $programStage.autoGenerateEvent && $programStage.autoGenerateEvent=='true' ) checked #end /></td>
 			</tr>
 			
-			<tr>
-				<td><label>$i18n.getString( "related_patient" )</em></label></td>
-				<td><input type="checkbox" id="relatedPatient" name="relatedPatient" value='true' #if( $programStage.relatedPatient=='true') checked #end /></td>
-			</tr>
-			
 			<tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
 	
 			<tr>