← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9226: FRED-API: minor NPE fix

 

------------------------------------------------------------
revno: 9226
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-12-08 19:49:44 +0300
message:
  FRED-API: minor NPE fix
modified:
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java
  dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.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-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java	2012-12-08 16:07:13 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java	2012-12-08 16:49:44 +0000
@@ -75,10 +75,13 @@
 
         Collection<String> dataSets = (Collection<String>) facility.getProperties().get( "dataSets" );
 
-        for ( String uid : dataSets )
+        if ( dataSets != null )
         {
-            DataSet dataSet = dataSetService.getDataSet( uid );
-            organisationUnit.getDataSets().add( dataSet );
+            for ( String uid : dataSets )
+            {
+                DataSet dataSet = dataSetService.getDataSet( uid );
+                organisationUnit.getDataSets().add( dataSet );
+            }
         }
 
         organisationUnit.setFeatureType( OrganisationUnit.FEATURETYPE_POINT );

=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm	2012-12-08 16:07:13 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm	2012-12-08 16:49:44 +0000
@@ -34,9 +34,9 @@
 
         $('#facilityForm').submit(function (e) {
             e.preventDefault();
+            $('#facilitySubmit').attr('disabled', true).text('Saving');
 
             $.get('$baseUrl/facilities/${entity.id}.json').success(function (data) {
-
                 delete data.createdAt;
                 delete data.updatedAt;
                 delete data.url;
@@ -57,8 +57,11 @@
                     dataType: 'json'
                 }).success(function (data) {
                     console.log("save success!", data);
+                    updateMap([lat, lng]);
+                    $('#facilitySubmit').removeAttr('disabled').text('Save');
                 }).error(function (data) {
                     console.log("could not update!", data);
+                    $('#facilitySubmit').removeAttr('disabled').text('Save');
                 });
             });
         });
@@ -98,7 +101,7 @@
                 <input #if(!$canEdit)disabled#end id="facilityLongitude" type="text" class="$inputSize" value=""/>
             </fieldset>
 
-            <button #if(!$canEdit)disabled#end type="submit" class="btn btn-info">Update</button>
+            <button #if(!$canEdit)disabled#end type="submit" id="facilitySubmit" class="btn btn-info">Save</button>
         </form>
     </div>