← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18238: tracker-capture: accessing events/enrollments from another organisation unit

 

------------------------------------------------------------
revno: 18238
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-12 15:25:04 +0100
message:
  tracker-capture: accessing events/enrollments from another organisation unit
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-02-09 08:53:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-02-12 14:25:04 +0000
@@ -581,7 +581,15 @@
         {
             programStageInstance.setStatus( EventStatus.VISITED );
         }
-
+        
+        OrganisationUnit organisationUnit = getOrganisationUnit( null, event.getOrgUnit() );
+
+        if ( organisationUnit == null )
+        {
+            organisationUnit = programStageInstance.getOrganisationUnit();
+        }
+
+        programStageInstance.setOrganisationUnit( organisationUnit );
         programStageInstance.setExecutionDate( executionDate );
         programStageInstanceService.updateProgramStageInstance( programStageInstance );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-02-11 11:52:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-02-12 14:25:04 +0000
@@ -76,11 +76,11 @@
     });
     
     $scope.getEvents = function(){
-        DHIS2EventFactory.getEventsByProgram($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(events){
+        DHIS2EventFactory.getEventsByProgram($scope.selectedEntity.trackedEntityInstance, $scope.selectedProgram.id).then(function(events){
             $scope.dhis2Events = [];
             if(angular.isObject(events)){
                 angular.forEach(events, function(dhis2Event){                    
-                    if(dhis2Event.enrollment === $scope.selectedEnrollment.enrollment){
+                    if(dhis2Event.enrollment === $scope.selectedEnrollment.enrollment && dhis2Event.orgUnit){
                         if(dhis2Event.notes){
                             dhis2Event.notes = orderByFilter(dhis2Event.notes, '-storedDate');            
                             angular.forEach(dhis2Event.notes, function(note){
@@ -99,6 +99,7 @@
                             if(dhis2Event.eventDate){
                                 dhis2Event.eventDate = DateUtils.formatFromApiToUser(dhis2Event.eventDate);
                                 dhis2Event.sortingDate = dhis2Event.eventDate;
+                                dhis2Event.editingNotAllowed = dhis2Event.orgUnit !== $scope.selectedOrgUnit.id;
                             }                       
 
                             dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event);
@@ -108,10 +109,11 @@
                                 $scope.showDataEntry($scope.currentEvent, true);
                             }
                         }
-                        
                         $scope.dhis2Events.push(dhis2Event);
                     }
                 });
+                
+                console.log('the events:  ', $scope.dhis2Events);
             }
             
             $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-sortingDate');            
@@ -191,7 +193,7 @@
         
         if(dummyEvent){    
             
-            if($scope.currentDummyEvent == dummyEvent){ 
+            if(angular.equals($scope.currentDummyEvent,dummyEvent)){ 
                 //clicked on the same stage, do toggling
                 $scope.currentDummyEvent = null;
                 $scope.showDummyEventDiv = !$scope.showDummyEventDiv;                
@@ -456,7 +458,7 @@
              status: $scope.currentEvent.status === 'SCHEDULE' ? 'ACTIVE' : $scope.currentEvent.status,
              program: $scope.currentEvent.program,
              programStage: $scope.currentEvent.programStage,
-             orgUnit: $scope.currentEvent.orgUnit,
+             orgUnit: $scope.currentEvent.dataValues && $scope.currentEvent.dataValues.length > 0 ? $scope.currentEvent.orgUnit : $scope.selectedOrgUnit.id,
              eventDate: DateUtils.formatFromUserToApi($scope.currentEvent.eventDate),
              trackedEntityInstance: $scope.currentEvent.trackedEntityInstance
             };
@@ -491,7 +493,7 @@
              status: $scope.currentEvent.status,
              program: $scope.currentEvent.program,
              programStage: $scope.currentEvent.programStage,
-             orgUnit: $scope.currentEvent.orgUnit,
+             orgUnit: $scope.selectedOrgUnit.id,
              trackedEntityInstance: $scope.currentEvent.trackedEntityInstance
             };
         

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-02-09 08:00:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-02-12 14:25:04 +0000
@@ -93,7 +93,7 @@
                                ng-class="{'input-success': eventDateSaved}"
                                d2-date 
                                ng-model="currentEvent.eventDate"
-                               ng-disabled="currentEvent.status === 'SKIPPED' || currentEvent.enrollmentStatus !== 'ACTIVE'"    
+                               ng-disabled="currentEvent.status === 'SKIPPED' || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"    
                                ng-required="true"
                                blur-or-change="saveEventDate()"/>
                         <span ng-if="invalidDate" class="error">{{'date_required'| translate}}</span>
@@ -112,7 +112,7 @@
                                d2-date 
                                ng-model="currentEvent.dueDate"
                                blur-or-change="saveDueDate()" 
-                               ng-disabled="currentEvent.eventDate || !schedulingEnabled || currentEvent.enrollmentStatus !== 'ACTIVE'"/>
+                               ng-disabled="currentEvent.eventDate || !schedulingEnabled || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"/>
                         <span ng-if="invalidDate" class="error">{{'date_required'| translate}}</span>
                     </div>                        
                 </div>
@@ -130,7 +130,7 @@
                                min="-90"
                                max="90"
                                ng-blur="saveCoordinate('LAT')"
-                               ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'"    
+                               ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"    
                                ng-required="false"/>
                         <span ng-show="outerForm.latitude.$invalid" class="required">{{'value_must_be_between'| translate}} [-90 ... 90]</span>
                     </div>
@@ -144,7 +144,7 @@
                                min="-180"
                                max="180"
                                ng-blur="saveCoordinate('LNG')"
-                               ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'" 
+                               ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                ng-required="false"/>
                         <span ng-show="outerForm.longitude.$invalid" class="required">{{'value_must_be_between'| translate}}[-180 ... 180]</span>
                     </div>                        
@@ -160,22 +160,22 @@
                     <div class='row'><hr></div>
                     <a href ng-click="completeIncompleteEvent()" 
                        class="btn btn-warning" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
                        ng-if="currentEvent.eventDate && ( currentEvent.status === 'SCHEDULE' || currentEvent.status === 'ACTIVE' || currentEvent.status === 'VISITED')">{{'complete'| translate}}</a>
                     <a href ng-click="completeIncompleteEvent()" 
                        class="btn btn-warning"
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
                        ng-if="currentEvent.eventDate && currentEvent.status === 'COMPLETED'">{{'incomplete'| translate}}</a>                       
                     <a href ng-click="validateEvent()" 
                        class="btn btn-info" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'" 
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                        ng-if="currentEvent.eventDate">{{'validate'| translate}}</a>                        
                     <a href ng-click="skipUnskipEvent()" 
                        class="btn btn-warning" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE'"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
                        ng-if="!currentEvent.eventDate">{{currentEvent.status === 'SKIPPED' ? 'unskip' : 'skip'| translate}}</a>
                     <a href ng-click="deleteEvent()" 
-                       ng-disabled="currentEvent.enrollmentStatus === 'COMPLETED'"
+                       ng-disabled="currentEvent.enrollmentStatus === 'COMPLETED' || currentEvent.editingNotAllowed"
                        class="btn btn-danger">{{'delete'| translate}}</a>
                 </div>
             </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-01-19 17:16:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-02-12 14:25:04 +0000
@@ -25,7 +25,7 @@
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                    ng-model="currentEvent[prStDe.dataElement.id]" 
                                    ng-required={{prStDe.compulsory}}
-                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                    ng-blur="saveDatavalue(prStDe)" 
                                    name="foo"/>
                             <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required'| translate}}</span>
@@ -37,7 +37,7 @@
                                         ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                         ng-model="currentEvent[prStDe.dataElement.id]" 
                                         ng-required={{prStDe.compulsory}} 
-                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                         typeahead="option.name as option.name for option in optionSets[prStDe.dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
                                         typeahead-open-on-focus 
                                         typeahead-editable="false"
@@ -51,7 +51,7 @@
                                             ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
                                             name={{currentEvent[prStDe.dataElement.id]}}
                                             ng-required={{prStDe.compulsory}} 
-                                            ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                            ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                             ng-model="currentEvent[prStDe.dataElement.id]"
                                             ng-change="saveDatavalue(prStDe)" 
                                             value=""> {{'no_value' | translate}}<br>                                       
@@ -62,7 +62,7 @@
                                                 ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
                                                 name={{currentEvent[prStDe.dataElement.id]}}
                                                 ng-required={{prStDe.compulsory}} 
-                                                ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                 ng-model="currentEvent[prStDe.dataElement.id]"
                                                 ng-change="saveDatavalue(prStDe)" 
                                                 value={{option.name}}> {{option.name}}
@@ -75,7 +75,7 @@
                                     ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                     ng-model="currentEvent[prStDe.dataElement.id]" 
                                     ng-required={{prStDe.compulsory}} 
-                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                     ng-blur="saveDatavalue(prStDe)" 
                                     name="foo"/>
                             </div>
@@ -84,7 +84,7 @@
                             <select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                     ng-model="currentEvent[prStDe.dataElement.id]" 
                                     ng-required={{prStDe.compulsory}} 
-                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                     ng-change="saveDatavalue(prStDe)" 
                                     name="foo">
                                 <option value="">{{'please_select'| translate}}</option>                        
@@ -101,7 +101,7 @@
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                    ng-model="currentEvent[prStDe.dataElement.id]"
                                    ng-required={{prStDe.compulsory}}  
-                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                    blur-or-change="saveDatavalue(prStDe)"
                                    name="foo"/>
                         </div>
@@ -110,7 +110,7 @@
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                    ng-model="currentEvent[prStDe.dataElement.id]"                                                               
                                    ng-required={{prStDe.compulsory}} 
-                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                    ng-change="saveDatavalue(prStDe)" 
                                    name="foo"/>
                         </div>
@@ -122,7 +122,7 @@
                 <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
                     <input type="checkbox" 
                            ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]" 
-                           ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                           ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                            ng-change="saveDatavalueLocation(prStDe)"/>                
                 </div>
             </td>
@@ -159,7 +159,7 @@
                                                    ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                    ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" 
                                                    ng-required={{prStDes[de.dataElement.id].compulsory}}
-                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                    ng-blur="saveDatavalue(prStDes[de.dataElement.id])" 
                                                    name="foo"/>
                                             <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required'| translate}}</span>
@@ -171,7 +171,7 @@
                                                         ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                         ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" 
                                                         ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                         typeahead="option.name as option.name for option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
                                                         typeahead-open-on-focus 
                                                         typeahead-editable="false"
@@ -185,7 +185,7 @@
                                                             ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,true)'
                                                             name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
                                                             ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                            ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                            ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                             ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
                                                             ng-change="saveDatavalue(prStDes[de.dataElement.id])" 
                                                             value=""> {{'no_value' | translate}}<br>                                       
@@ -196,7 +196,7 @@
                                                                 ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,true)'
                                                                 name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
                                                                 ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                                ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                                ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                                 ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
                                                                 ng-change="saveDatavalue(prStDes[de.dataElement.id])" 
                                                                 value={{option.name}}> {{option.name}}
@@ -209,7 +209,7 @@
                                                     ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                     ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" 
                                                     ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                     ng-blur="saveDatavalue(prStDes[de.dataElement.id])" 
                                                     name="foo"/>
                                             </div>
@@ -218,7 +218,7 @@
                                             <select ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                     ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" 
                                                     ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                     ng-change="saveDatavalue(prStDes[de.dataElement.id])" 
                                                     name="foo">
                                                 <option value="">{{'please_select'| translate}}</option>                        
@@ -235,7 +235,7 @@
                                                    ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                    ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
                                                    ng-required={{prStDes[de.dataElement.id].compulsory}}  
-                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                    blur-or-change="saveDatavalue(prStDes[de.dataElement.id])"
                                                    name="foo"/>
                                         </div>
@@ -244,7 +244,7 @@
                                                    ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                    ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"                                                               
                                                    ng-required={{prStDes[de.dataElement.id].compulsory}} 
-                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                                    ng-change="saveDatavalue(prStDes[de.dataElement.id])" 
                                                    name="foo"/>
                                         </div>
@@ -256,7 +256,7 @@
                                 <div class="align-center" ng-show="prStDes[de.dataElement.id].allowProvidedElsewhere">
                                     <input type="checkbox" 
                                            ng-model="currentEvent.providedElsewhere[prStDes[de.dataElement.id].dataElement.id]"
-                                           ng-disabled="selectedEnrollment.status !== 'ACTIVE'" 
+                                           ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                            ng-change="saveDatavalueLocation(prStDes[de.dataElement.id])"/>                
                                 </div>
                             </td>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-02-12 10:51:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-02-12 14:25:04 +0000
@@ -884,8 +884,8 @@
             });            
             return promise;
         },
-        getEventsByProgram: function(entity, orgUnit, program){   
-            var promise = $http.get( '../api/events.json?' + 'trackedEntityInstance=' + entity + '&orgUnit=' + orgUnit + '&program=' + program + '&paging=false').then(function(response){
+        getEventsByProgram: function(entity, program){   
+            var promise = $http.get( '../api/events.json?' + 'trackedEntityInstance=' + entity + '&program=' + program + '&paging=false').then(function(response){
                 return response.data.events;
             });            
             return promise;

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-02-06 20:22:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-02-12 14:25:04 +0000
@@ -248,7 +248,7 @@
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
                                                 ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
                                                 ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">';
                             }
@@ -260,7 +260,7 @@
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
                                                 ' input-field-id="' + fieldId + '"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' +
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"' +
                                                 ' typeahead="option.name as option.name for option in optionSets.'+optionSetId+'.options | filter:$viewValue | limitTo:20"' +
                                                 ' typeahead-editable="false" ' +
@@ -277,7 +277,7 @@
                                                 ' d2-validation ' +
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
                                                 ' input-field-id="' + fieldId + '"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
                                                 ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' +
                                                 ' ng-required="prStDes.' + fieldId + '.compulsory"> ';                                     
@@ -290,7 +290,7 @@
                                                 ' ng-model="currentEvent.' + fieldId + '" ' +
                                                 ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
                                                 ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">' + 
                                                 '<option value="">{{\'please_select\'| translate}}</option>' +
@@ -309,7 +309,7 @@
                                                 ' d2-date ' +
                                                 ' max-date="' + maxDate + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
                                                 ' blur-or-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> '; 
                             }
@@ -320,7 +320,7 @@
                                                 ' ng-model="currentEvent.' + fieldId + '"' +
                                                 ' input-field-id="' + fieldId + '"' +
                                                 ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\'"' +
+                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
                                                 ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' +
                                                 ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> ';
                             }