← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12705: verify that at least one scope is selected when creating localId patient identifiers

 

------------------------------------------------------------
revno: 12705
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-16 10:49:06 +0200
message:
  verify that at least one scope is selected when creating localId patient identifiers
modified:
  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/addPatientIdentifierTypeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.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-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	2013-10-10 03:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-10-16 08:49:06 +0000
@@ -488,4 +488,5 @@
 default_value = Default value
 dashboard_shortcut_to_add_relative = Dashboard shortcut to add relative
 shortcut_link_label_eg_add_child = Shortcut link label (e.g. Add Child)
-relationship = Relationship
\ No newline at end of file
+relationship = Relationship
+select_at_least_one_scope=Select at least one scope for local id
\ 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/addPatientIdentifierTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2013-09-17 06:08:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2013-10-16 08:49:06 +0000
@@ -1,4 +1,7 @@
 <script type="text/javascript" src="javascript/addPatientIdentifierTypeForm.js"></script>
+<script>
+	var i18n_select_at_least_one_scope = '$encoder.jsEscape( $i18n.getString( "select_at_least_one_scope" ) , "'" )';
+</script>
 
 <h3>$i18n.getString( "create_new_patient_identifier_type" )</h3>
 								

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js	2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js	2013-10-16 08:49:06 +0000
@@ -1,10 +1,25 @@
-jQuery(document).ready(	function(){
-			
-	jQuery('name').focus();
-	
-	validation( 'addPatientIdentifierTypeForm', function(form){
-		form.submit();
-	}); 
-	
-	checkValueIsExist( "name", "validatePatientIdentifierType.action");			
-});		
\ No newline at end of file
+$(document).ready(function() {
+    $('name').focus();
+
+    validation('addPatientIdentifierTypeForm');
+
+    $('#addPatientIdentifierTypeForm').submit(function( e ) {
+        e.preventDefault();
+
+        if( $('#type').val() === 'localId' ) {
+            var orgunitScope = $('#orgunitScope').is(':checked');
+            var programScope = $('#programScope').is(':checked');
+            var periodSelected = $('#periodTypeName').val() !== "";
+
+            if( !orgunitScope && !programScope && !periodSelected ) {
+                setHeaderDelayMessage(i18n_select_at_least_one_scope);
+            } else {
+                this.submit();
+            }
+        } else {
+            this.submit();
+        }
+    });
+
+    checkValueIsExist("name", "validatePatientIdentifierType.action");
+});

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js	2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js	2013-10-16 08:49:06 +0000
@@ -1,10 +1,25 @@
-jQuery(document).ready(	function(){
-	
-	jQuery('name').focus();
-	
-	validation( 'updatePatientIdentifierTypeForm', function(form){
-		form.submit();
-	}); 
-	
-	checkValueIsExist( "name", "validatePatientIdentifierType.action", {id:getFieldValue('id')});
-});	
\ No newline at end of file
+$(document).ready(function() {
+    $('name').focus();
+
+    validation('updatePatientIdentifierTypeForm');
+
+    $('#updatePatientIdentifierTypeForm').submit(function( e ) {
+        e.preventDefault();
+
+        if( $('#type').val() === 'localId' ) {
+            var orgunitScope = $('#orgunitScope').is(':checked');
+            var programScope = $('#programScope').is(':checked');
+            var periodSelected = $('#periodTypeName').val() !== "";
+
+            if( !orgunitScope && !programScope && !periodSelected ) {
+                setHeaderDelayMessage(i18n_select_at_least_one_scope);
+            } else {
+                this.submit();
+            }
+        } else {
+            this.submit();
+        }
+    });
+
+    checkValueIsExist("name", "validatePatientIdentifierType.action", {id: getFieldValue('id')});
+});

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2013-09-17 06:08:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2013-10-16 08:49:06 +0000
@@ -1,7 +1,10 @@
 <script type="text/javascript" src="javascript/updatePatientIdentifierTypeForm.js"></script>
+<script>
+	var i18n_select_at_least_one_scope = '$encoder.jsEscape( $i18n.getString( "select_at_least_one_scope" ) , "'" )';
+</script>
 
 <h3>$i18n.getString( "edit_patient_identifier_type" )</h3>
-									
+
 <form id="updatePatientIdentifierTypeForm" action="updatePatientIdentifierType.action" method="post" >
 <input type="hidden" id="id" name="id" value="$patientIdentifierType.id"/>
 <table>