← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12339: display error message if you are adding/updating user without any organisation units assigned

 

------------------------------------------------------------
revno: 12339
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-30 17:02:38 +0200
message:
  display error message if you are adding/updating user without any organisation units assigned
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.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-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-09-30 04:33:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-09-30 15:02:38 +0000
@@ -451,7 +451,7 @@
 help_intro_header=Welcome to the DHIS 2 Help Center
 help_intro_text=Please select an item from the menu to the left.
 please_wait_while_the_system_is_processing=Please wait while the system is processing
-
+organisation_unit_required_for_user=User must be assigned to at least one organisation unit
 #-- Contact info ---------------------------------------------------------------#
 
 address=Address

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm	2013-09-14 19:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm	2013-09-30 15:02:38 +0000
@@ -3,8 +3,13 @@
 	    validation2( 'addUserForm', function( form )
 	    {
 	        jQuery( "#selectedList" ).children().attr( "selected", true );
-	        form.submit();
-	    }, {
+
+            if( $('#selectionTree').find('.selected').size() == 0 ) {
+                setHeaderDelayMessage('$i18n.getString( "organisation_unit_required_for_user" )');
+            } else {
+                form.submit();
+            }
+        }, {
 	        'beforeValidateHandler' : function()
 	        {
 	            listValidator( 'roleValidator', 'selectedList' );
@@ -141,7 +146,7 @@
 
 	<tr>
 		<td colspan="3">
-			#organisationUnitSelectionTree( true, true, true )
+			#organisationUnitSelectionTree( true, true, false )
 		</td>
 
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm	2013-09-14 19:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm	2013-09-30 15:02:38 +0000
@@ -7,7 +7,12 @@
 	    validation2( 'updateUserForm', function( form )
 	    {
 	        jQuery( "#selectedList" ).children().attr( "selected", true );
-	        form.submit();
+
+            if( $('#selectionTree').find('.selected').size() == 0 ) {
+                setHeaderDelayMessage('$i18n.getString( "organisation_unit_required_for_user" )');
+            } else {
+                form.submit();
+            }
 	    }, {
 	        'beforeValidateHandler' : function()
 	        {
@@ -155,7 +160,7 @@
 
 	<tr>
 		<td colspan="3">
-			#organisationUnitSelectionTree( false, true, true )
+			#organisationUnitSelectionTree( false, true, false )
 		</td>
 	</tr>
 </table>