← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4293: Fixed bug: could not add organisation units with more than one data set

 

------------------------------------------------------------
revno: 4293
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-08-15 10:17:24 +0200
message:
  Fixed bug: could not add organisation units with more than one data set
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.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-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2011-07-21 06:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2011-08-15 08:17:24 +0000
@@ -70,8 +70,9 @@
             "rangelength" : [ 2, 25 ]
         },
         "code" : {
-            "required" : true,
-            "rangelength" : [ 0, 25 ]
+            "rangelength" : [ 0, 25 ],
+            "alphanumericwithbasicpuncspaces" : true,
+            "notOnlyDigits" : false
         },
         "openingDate" : {
             "required" : true

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java	2011-05-30 14:56:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java	2011-08-15 08:17:24 +0000
@@ -256,13 +256,18 @@
             parent.getChildren().add( organisationUnit );
         }
 
+        // ---------------------------------------------------------------------
+        // Must persist org unit before adding data sets because association are
+        // updated on both sides (and this side is inverse)
+        // ---------------------------------------------------------------------
+
+        organisationUnitId = organisationUnitService.addOrganisationUnit( organisationUnit );
+
         for ( String id : dataSets )
         {
             organisationUnit.addDataSet( dataSetService.getDataSet( Integer.parseInt( id ) ) );
         }
         
-        organisationUnitId = organisationUnitService.addOrganisationUnit( organisationUnit );
-
         for ( String id : selectedGroups )
         {
             OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( id ) );
@@ -274,6 +279,8 @@
             }
         }
 
+        organisationUnitService.updateOrganisationUnit( organisationUnit );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm	2011-06-23 12:53:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm	2011-08-15 08:17:24 +0000
@@ -21,7 +21,7 @@
 		<td><input type="text" id="shortName" name="shortName" style="width:20em"/></td>
 	</tr>
 	<tr>
-		<td><label for="code">$i18n.getString( "code" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><label for="code">$i18n.getString( "code" )</label></td>
 		<td><input type="text" id="code" name="code" style="width:20em"/></td>
 	</tr>
 	<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm	2011-06-23 12:53:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm	2011-08-15 08:17:24 +0000
@@ -38,7 +38,7 @@
 		<td><input type="text" id="shortName" name="shortName" value="$encoder.htmlEncode( $organisationUnit.shortName )" style="width:20em"></td>
 	</tr>
 	<tr>
-		<td><label for="code">$i18n.getString( "code" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+		<td><label for="code">$i18n.getString( "code" )</label></td>
 		<td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $organisationUnit.code )" style="width:20em"/></td>
 	</tr>
 	<tr>
@@ -109,7 +109,7 @@
 		<td style="height:15px" colspan="2">
 	</tr>
     <tr>
-		<th colspan="2">$i18n.getString( "assign_to_data_set" )</th>
+		<th colspan="2">$i18n.getString( "data_sets" )</th>
     </tr>
     <tr>
     	<td><label for="availableDataSets">$i18n.getString( "available_data_sets" )</label></td>