← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16644: Data entry, docs

 

------------------------------------------------------------
revno: 16644
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-09-07 23:05:12 -0400
message:
  Data entry, docs
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js


--
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-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2014-09-08 03:05:12 +0000
@@ -470,8 +470,8 @@
         MapMap<Integer, DataElementOperand, Double> map = new MapMap<>();
 
         if ( dataElements.isEmpty() || periodTypes.isEmpty()
-                || ( cogDimensionConstraints != null && cogDimensionConstraints.isEmpty() )
-                || ( coDimensionConstraints != null && coDimensionConstraints.isEmpty() ) )
+            || ( cogDimensionConstraints != null && cogDimensionConstraints.isEmpty() )
+            || ( coDimensionConstraints != null && coDimensionConstraints.isEmpty() ) )
         {
             return map;
         }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-09-02 20:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-09-08 03:05:12 +0000
@@ -1751,23 +1751,9 @@
 // Validation
 // -----------------------------------------------------------------------------
 
-function displayValidationDialog( data, height )
-{
-	height = isDefined( height ) ? height : 500;
-	
-	$( '#validationDiv' ).html( data );
-	
-    $( '#validationDiv' ).dialog( {
-        modal: true,
-        title: 'Validation',
-        width: 920,
-        height: height
-    } );
-}
-
 function validate( ignoreSuccessfulValidation, successCallback )
 {
-	var compulsoryCombinationsValid = validateCompulsoryCombinations();
+	var compulsoryCombinationsValid = dhis2.de.validateCompulsoryCombinations();
 	
 	// Check for compulsory combinations and return false if violated
 	
@@ -1776,7 +1762,7 @@
     	var html = '<h3>' + i18n_validation_result + ' &nbsp;<img src="../images/warning_small.png"></h3>' +
         	'<p class="bold">' + i18n_all_values_for_data_element_must_be_filled + '</p>';
 		
-    	displayValidationDialog( html, 300 );
+    	dhis2.de.displayValidationDialog( html, 300 );
 	
 		return false;
 	}
@@ -1814,11 +1800,11 @@
         	
         	if ( hasViolations )
         	{
-        		displayValidationDialog( response, 500 );
+        		dhis2.de.displayValidationDialog( response, 500 );
         	}
         	else if ( !ignoreSuccessfulValidation )
         	{
-        		displayValidationDialog( successHtml, 200 );
+        		dhis2.de.displayValidationDialog( successHtml, 200 );
         	}        	
         }
         
@@ -1829,7 +1815,32 @@
     } );
 }
 
-function validateCompulsoryCombinations()
+/**
+ * Displays the validation dialog.
+ * 
+ * @param html the html content to display in the dialog.
+ * @param height the height of the dialog.
+ */
+dhis2.de.displayValidationDialog = function( html, height )
+{
+	height = isDefined( height ) ? height : 500;
+	
+	$( '#validationDiv' ).html( html );
+	
+    $( '#validationDiv' ).dialog( {
+        modal: true,
+        title: 'Validation',
+        width: 920,
+        height: height
+    } );
+}
+
+/**
+ * Validates that all category option combinations have all values or no values
+ * per data element given that the fieldCombinationRequired is true for the 
+ * current data set.
+ */
+dhis2.de.validateCompulsoryCombinations = function()
 {
 	var fieldCombinationRequired = dhis2.de.dataSets[dhis2.de.currentDataSetId].fieldCombinationRequired;