← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9110: Add validCompleteOnly property for program-stage.

 

------------------------------------------------------------
revno: 9110
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-11-23 15:38:39 +0700
message:
  Add validCompleteOnly  property for program-stage.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml
  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/entry.js
  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/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  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/javascript/programStage.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.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/program/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-10-01 03:06:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-11-23 08:38:39 +0000
@@ -84,6 +84,8 @@
 
     private Boolean autoGenerateEvent = true;
 
+    private Boolean validCompleteOnly = false;
+    
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -252,6 +254,16 @@
         this.autoGenerateEvent = autoGenerateEvent;
     }
 
+    public Boolean getValidCompleteOnly()
+    {
+        return validCompleteOnly;
+    }
+
+    public void setValidCompleteOnly( Boolean validCompleteOnly )
+    {
+        this.validCompleteOnly = validCompleteOnly;
+    }
+
     public String getDataEntryType()
     {
         if ( dataEntryForm != null )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-11-12 07:04:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-11-23 08:38:39 +0000
@@ -151,7 +151,8 @@
         executeSql( "ALTER TABLE programvalidation DROP COLUMN leftside" );
         executeSql( "ALTER TABLE programvalidation DROP COLUMN rightside" );
         executeSql( "ALTER TABLE programvalidation DROP COLUMN dateType" );
-
+        
+        executeSql( "UPDATE programstage SET validCompleteOnly=false WHERE validCompleteOnly is null" );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-10-01 06:20:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-11-23 08:38:39 +0000
@@ -46,5 +46,7 @@
     
     <property name="autoGenerateEvent"/>
     
+    <property name="validCompleteOnly"/>
+    
   </class>
 </hibernate-mapping>

=== 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	2012-11-13 02:57:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-11-23 08:38:39 +0000
@@ -24,6 +24,7 @@
 <input type='hidden' name='completed' id='completed' value='$!programStageInstance.completed'>
 <input type='hidden' name='programStageId' id='programStageId' value='$!programStageInstance.programStage.id'>
 <input type='hidden' name='programId' id='programId' value='$!programStageInstance.programInstance.program.id'>
+<input type='hidden' name='validCompleteOnly' id='validCompleteOnly' value='$!programStageInstance.programStage.validCompleteOnly'>
 
 <div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>					
 	#if( $customDataEntryFormCode )

=== 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	2012-11-15 04:44:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-11-23 08:38:39 +0000
@@ -443,25 +443,33 @@
 }
 
 function doComplete(isCreateEvent){
-	jQuery.get( 'validateProgram.action'
-		, function(html){ 
-			$('#validateProgramDiv').html(html);
-			if(getFieldValue('violateValidation')=='true'){
-				$('#validateProgramDiv' ).dialog({
-					title: i18n_violate_validation,
-					maximize: true, 
-					closable: true,
-					modal:true,
-					overlay:{background:'#000000', opacity:0.1},
-					width: 800,
-					height: 450
-				});
-			}
-			else{
-				hideById('validateProgramDiv');
-				runCompleteEvent( isCreateEvent );
-			}
-	});
+	
+	if(getFieldValue('validCompleteOnly')=="true")
+	{
+		jQuery.get( 'validateProgram.action'
+			, function(html){ 
+				$('#validateProgramDiv').html(html);
+				if(getFieldValue('violateValidation')=='true'){
+					$('#validateProgramDiv' ).dialog({
+						title: i18n_violate_validation,
+						maximize: true, 
+						closable: true,
+						modal:true,
+						overlay:{background:'#000000', opacity:0.1},
+						width: 800,
+						height: 450
+					});
+				}
+				else{
+					hideById('validateProgramDiv');
+					runCompleteEvent( isCreateEvent );
+				}
+		});
+	}
+	else
+	{
+		runCompleteEvent( isCreateEvent );
+	}
 }
 
 function runCompleteEvent( isCreateEvent )

=== 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	2012-10-09 10:03:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramStage.vm	2012-11-23 08:38:39 +0000
@@ -15,10 +15,9 @@
 	  }#if( $velocityCount < $programStage.patientReminders.size() ),#end
 	#end 
 	],
-	
 	"irregular": "$!programStage.irregular",
 	"autoGenerateEvent": "$!programStage.autoGenerateEvent",
-	
+	"validCompleteOnly": "$!programStage.validCompleteOnly",
 	#set( $size = ${programStageDataElements.size()} )
 	"dataElement": [
 	#foreach($d in $programStageDataElements)

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-11-08 04:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-11-23 08:38:39 +0000
@@ -191,6 +191,13 @@
         this.displayInReports = displayInReports;
     }
 
+    private Boolean validCompleteOnly;
+
+    public void setValidCompleteOnly( Boolean validCompleteOnly )
+    {
+        this.validCompleteOnly = validCompleteOnly;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -201,7 +208,8 @@
         minDaysFromStart = (minDaysFromStart == null) ? 0 : minDaysFromStart;
         irregular = (irregular == null) ? false : irregular;
         autoGenerateEvent = (autoGenerateEvent == null) ? false : autoGenerateEvent;
-
+        validCompleteOnly = (validCompleteOnly == null) ? false : validCompleteOnly;
+        
         ProgramStage programStage = new ProgramStage();
         Program program = programService.getProgram( id );
 
@@ -213,6 +221,7 @@
         programStage.setIrregular( irregular );
         programStage.setMinDaysFromStart( minDaysFromStart );
         programStage.setAutoGenerateEvent( autoGenerateEvent );
+        programStage.setValidCompleteOnly( validCompleteOnly );
 
         Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
         for ( int i = 0; i < daysAllowedSendMessages.size(); i++ )
@@ -230,7 +239,7 @@
             DataElement dataElement = dataElementService.getDataElement( selectedDataElementsValidator.get( i ) );
             Boolean allowed = allowProvidedElsewhere.get( i ) == null ? false : allowProvidedElsewhere.get( i );
             Boolean displayInReport = displayInReports.get( i ) == null ? false : displayInReports.get( i );
-            
+
             ProgramStageDataElement programStageDataElement = new ProgramStageDataElement( programStage, dataElement,
                 this.compulsories.get( i ), new Integer( i ) );
             programStageDataElement.setAllowProvidedElsewhere( allowed );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2012-11-08 04:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2012-11-23 08:38:39 +0000
@@ -184,6 +184,13 @@
         this.displayInReports = displayInReports;
     }
 
+    private Boolean validCompleteOnly;
+
+    public void setValidCompleteOnly( Boolean validCompleteOnly )
+    {
+        this.validCompleteOnly = validCompleteOnly;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -194,6 +201,7 @@
         minDaysFromStart = (minDaysFromStart == null) ? 0 : minDaysFromStart;
         irregular = (irregular == null) ? false : irregular;
         autoGenerateEvent = (autoGenerateEvent == null) ? false : autoGenerateEvent;
+        validCompleteOnly = (validCompleteOnly == null) ? false : validCompleteOnly;
 
         ProgramStage programStage = programStageService.getProgramStage( id );
 
@@ -204,6 +212,7 @@
         programStage.setMinDaysFromStart( minDaysFromStart );
         programStage.setIrregular( irregular );
         programStage.setAutoGenerateEvent( autoGenerateEvent );
+        programStage.setValidCompleteOnly( validCompleteOnly );
 
         Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
         for ( int i = 0; i < this.daysAllowedSendMessages.size(); i++ )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-11-14 17:55:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-11-23 08:38:39 +0000
@@ -320,4 +320,5 @@
 edit_right_side = Edit right side
 update_program_validation_rule = Edit program validation rule
 description_not_null = Description is not null
-expression_not_null = Expression is not null
\ No newline at end of file
+expression_not_null = Expression is not null
+complete_allowed_only_if_validation_passes = Complete allowed only if validation passes
\ No newline at end of file

=== 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	2012-11-08 04:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2012-11-23 08:38:39 +0000
@@ -4,7 +4,7 @@
 
 <h4>$program.name</h4>
 		
-<form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="get">
+<form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="post">
 	<input type="hidden" id="id" name="id" value="$program.id"/>
 	<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
 	<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
@@ -48,6 +48,11 @@
 	<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
 	
 	<tr>
+		<td><label>$i18n.getString( "complete_allowed_only_if_validation_passes" )</label></td>
+		<td><input type="checkbox" id="validCompleteOnly" name="validCompleteOnly" value="true" /></td>
+	</tr>
+	
+	<tr>
 		<td><label>$i18n.getString( "report_date_description" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td><input type="text" id="reportDateDescription" name="reportDateDescription" class="{validate:{required:true}}" /></td>
 	</tr>
@@ -70,7 +75,7 @@
 			<select id="selectedDataElementsValidator" name='selectedDataElementsValidator' multiple="multiple" class="hidden" ></select>
 			<select id="compulsories" name='compulsories' multiple="multiple" class="hidden"></select>     
 			<select id="allowProvidedElsewhere" name='allowProvidedElsewhere' multiple="multiple" class="hidden"></select>     
-			<select id="displayInReports" name='displayInReports' multiple="multiple" class=""></select>     
+			<select id="displayInReports" name='displayInReports' multiple="multiple" class="hidden"></select>     
 		</th>
       </tr>
     </thead>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2012-11-08 04:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2012-11-23 08:38:39 +0000
@@ -62,6 +62,9 @@
 		var autoGenerateEvent = (json.programStage.autoGenerateEvent=='true') ? i18n_yes : i18n_no;
 		setInnerHTML( 'autoGenerateEventField', autoGenerateEvent );  
 		
+		var validCompleteOnly = (json.programStage.validCompleteOnly=='true') ? i18n_yes : i18n_no;
+		setInnerHTML( 'validCompleteOnlyField', validCompleteOnly );  
+		
 		setInnerHTML( 'standardIntervalField', json.programStage.standardInterval );  
 		setInnerHTML( 'dataElementCountField', json.programStage.dataElementCount );   
 		setInnerHTML( 'reportDateDescriptionField', json.programStage.reportDateDescription );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2012-11-23 08:38:39 +0000
@@ -47,6 +47,7 @@
 				<p><label class="bold">$i18n.getString( "auto_generate_event" ):</label><br><span id="autoGenerateEventField"></span></p>
 				<p><label class="bold">$i18n.getString( "irregular" ):</label><br><span id="irregularField"></span></p>
 				<p><label class="bold">$i18n.getString( "standard_interval_days" ):</label><br><span id="standardIntervalField"></span></p>
+				<p><label class="bold">$i18n.getString( "complete_allowed_only_if_validation_passes" ):</label><br><span id="validCompleteOnlyField"></span></p>
 				<p><label class="bold">$i18n.getString( "report_date_description" ):</label><br><span id="reportDateDescriptionField"></span></p>
 				<p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>		
 				<p><span id="templateMessageField"></span></p>

=== 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	2012-11-08 04:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-11-23 08:38:39 +0000
@@ -51,6 +51,11 @@
 			<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
 	
 			<tr>
+				<td><label>$i18n.getString( "complete_allowed_only_if_validation_passes" )</label></td>
+				<td><input type="checkbox" id="validCompleteOnly" name="validCompleteOnly" value='true' #if( $programStage.validCompleteOnly && $programStage.validCompleteOnly=='true' ) checked #end /></td>
+			</tr>
+			
+			<tr>
 				<td><label>$i18n.getString( "report_date_description" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 				<td><input type="text" id="reportDateDescription" name="reportDateDescription" value='$!programStage.reportDateDescription' class="{validate:{required:true}}" /></td>
 			</tr>