← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19859: tracker-capture: when a tei is set to inactive, only read operations are allowed

 

------------------------------------------------------------
revno: 19859
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-26 12:26:31 +0200
message:
  tracker-capture: when a tei is set to inactive, only read operations are allowed
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  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/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties


--
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/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-08-25 21:48:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-08-26 10:26:31 +0000
@@ -328,10 +328,12 @@
             importSummary.getImportCount().incrementIgnored();
 
             return importSummary;
-        }
-
+        }        
+        
+        entityInstance.setInactive( trackedEntityInstance.isInactive() );
+        
         removeRelationships( entityInstance );
-        removeAttributeValues( entityInstance );
+        removeAttributeValues( entityInstance );        
         teiService.updateTrackedEntityInstance( entityInstance );
 
         updateRelationships( trackedEntityInstance, entityInstance );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java	2015-08-25 21:48:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java	2015-08-26 10:26:31 +0000
@@ -216,6 +216,7 @@
             ", created='" + created + '\'' +
             ", relationships=" + relationships +
             ", attributes=" + attributes +
+            ", inactive=" + inactive +
             '}';
     }	
 }

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-08-25 22:19:06 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-08-26 10:26:31 +0000
@@ -160,6 +160,12 @@
         }
     };
     
+    var setInactiveMessage = function(){
+        if($scope.selectedTei.inactive){
+            setHeaderDelayMessage($translate.instant('tei_inactive_only_read'));
+        }
+    };
+    
     if($scope.selectedTeiId){
         
         //get option sets
@@ -181,6 +187,8 @@
                 //Fetch the selected entity
                 TEIService.get($scope.selectedTeiId, $scope.optionSets, $scope.attributesById).then(function(response){
                     $scope.selectedTei = response;
+                    
+                    setInactiveMessage();                   
 
                     //get the entity type
                     TEService.get($scope.selectedTei.trackedEntity).then(function(te){                    
@@ -229,6 +237,7 @@
         });
     }    
     
+    
     //listen for any change to program selection
     //it is possible that such could happen during enrollment.
     $scope.$on('mainDashboard', function(event, args) {
@@ -352,6 +361,7 @@
 
             $scope.selectedTei.inactive = st;
             TEIService.update($scope.selectedTei, $scope.optionSets, $scope.attributesById).then(function (data) {
+                setInactiveMessage();
                 $scope.broadCastSelections($scope.selectedTei);                
             });
         }, function(){            

=== 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-08-21 09:37:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-08-26 10:26:31 +0000
@@ -245,10 +245,11 @@
 
                         if (dhis2Event.eventDate) {
                             dhis2Event.eventDate = DateUtils.formatFromApiToUser(dhis2Event.eventDate);
-                            dhis2Event.sortingDate = dhis2Event.eventDate;
-                            dhis2Event.editingNotAllowed = setEventEditing(dhis2Event, eventStage);
+                            dhis2Event.sortingDate = dhis2Event.eventDate;                            
                         }
 
+                        dhis2Event.editingNotAllowed = setEventEditing(dhis2Event, eventStage);
+                        
                         dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event);
                         dhis2Event = EventUtils.processEvent(dhis2Event, eventStage, $scope.optionSets, $scope.prStDes);
                         $scope.eventsByStage[dhis2Event.programStage].push(dhis2Event);
@@ -266,7 +267,7 @@
     };
 
     var setEventEditing = function (dhis2Event, stage) {
-        return dhis2Event.editingNotAllowed = dhis2Event.orgUnit !== $scope.selectedOrgUnit.id || (stage.blockEntryForm && dhis2Event.status === 'COMPLETED');
+        return dhis2Event.editingNotAllowed = dhis2Event.orgUnit !== $scope.selectedOrgUnit.id || (stage.blockEntryForm && dhis2Event.status === 'COMPLETED') || $scope.selectedEntity.inactive;
     };
 
     $scope.enableRescheduling = function () {

=== 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-07-14 18:32:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-08-26 10:26:31 +0000
@@ -97,10 +97,10 @@
                         <span ng-if="invalidDate" class="error">{{'date_required'| translate}}</span>
                     </div>
                     <div class="col-md-6">
-                        <span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED'">
+                        <span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate">
                             {{'due_date'| translate}}
                         </span>
-                        <span ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED'">
+                        <span ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED' && !selectedEntity.inactive">
                             <a href ng-click="enableRescheduling()" title="{{ schedulingEnabled ? 'disable_rescheduling' : 'enable_rescheduling' | translate}}"><span class="text-primary bold">{{'reschedule_duedate'| translate}}</span></a>                        
                         </span>                    
                         <input type="text" 
@@ -164,22 +164,22 @@
                     <div class='row'><hr></div>
                     <a href ng-click="completeIncompleteEvent()" 
                        class="btn btn-warning" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.orgUnit !== selectedOrgUnit.id"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
                        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' || currentEvent.editingNotAllowed && currentEvent.orgUnit !== selectedOrgUnit.id"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
                        ng-if="currentEvent.eventDate && currentEvent.status === 'COMPLETED'">{{'incomplete'| translate}}</a>                       
                     <a href ng-click="validateEvent()" 
                        class="btn btn-info" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.orgUnit !== selectedOrgUnit.id" 
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id" 
                        ng-if="currentEvent.eventDate">{{'validate'| translate}}</a>                        
                     <a href ng-click="skipUnskipEvent()" 
                        class="btn btn-warning" 
-                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.orgUnit !== selectedOrgUnit.id"
+                       ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
                        ng-if="!currentEvent.eventDate">{{currentEvent.status === 'SKIPPED' ? 'unskip' : 'skip'| translate}}</a>
                     <a href ng-click="deleteEvent()" 
-                       ng-disabled="currentEvent.enrollmentStatus === 'COMPLETED' || currentEvent.editingNotAllowed && currentEvent.orgUnit !== selectedOrgUnit.id"
+                       ng-disabled="currentEvent.enrollmentStatus === 'COMPLETED' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
                        class="btn btn-danger">{{'delete'| translate}}</a>
                 </div>
                 <!-- data entry/event buttons ends -->

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-08-07 10:37:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-08-26 10:26:31 +0000
@@ -5,7 +5,7 @@
         <span class="nav-pills" ng-show="selectedProgram && currentEnrollment && currentEnrollment !== selectedEnrollment">
             | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [showEnrollmentDiv]">{{'current'| translate}}</span></a>
         </span>
-        <span class="nav-pills" ng-show="selectedProgram && !currentEnrollment">
+        <span class="nav-pills" ng-show="selectedProgram && !currentEnrollment && !selectedTei.inactive">
             | <a href ng-click="showNewEnrollment()" title="{{'new'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [showEnrollmentDiv]">{{'new'| translate}}</span></a>
         </span>
         <span class="nav-pills" ng-show="hasEnrollmentHistory">
@@ -56,13 +56,13 @@
 
                 <button type="button" 
                         class="btn btn-primary"
-                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || selectedTei.inactive"
                         ng-click="completeEnrollment()">
                     {{'complete'| translate}}
                 </button>
                 <button type="button" 
                         class="btn btn-warning"
-                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || selectedTei.inactive"
                         ng-click="terminateEnrollment()">
                     {{'terminate'| translate}}
                 </button>   
@@ -70,7 +70,7 @@
                 <button type="button"
                         title="{{'unmark_for_followup'| translate}}"
                         class="btn btn-danger horizonal-spacing"
-                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || selectedTei.inactive"
                         ng-if="selectedEnrollment.followup"
                         ng-click="markForFollowup()">
                     <i class="fa fa-exclamation-triangle"></i>
@@ -78,7 +78,7 @@
                 <button type="button" 
                         title="{{'mark_for_followup'| translate}}"
                         class="btn btn-default horizonal-spacing"
-                        ng-disabled="selectedEnrollment.status !== 'ACTIVE'"
+                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || selectedTei.inactive"
                         ng-if="!selectedEnrollment.followup"
                         ng-click="markForFollowup()">
                     <i class="fa fa-exclamation-triangle"></i>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2015-03-25 16:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2015-08-26 10:26:31 +0000
@@ -1,7 +1,7 @@
 <div class="panel panel-info" ng-controller="ProfileController">
     <div class="panel-heading handle bold">
         {{profileWidget.title| translate}}
-        <span class="nav-pills" ng-if="!enrollmentEditing">
+        <span class="nav-pills" ng-if="!enrollmentEditing && !selectedTei.inactive">
             | <a href ng-click="enableEdit()" title="{{'edit_profile'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [!editingDisabled]">{{'edit'| translate}}</span></a>
         </span>
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html	2015-08-06 14:14:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html	2015-08-26 10:26:31 +0000
@@ -1,11 +1,11 @@
 <div class="panel panel-info" ng-controller="RelationshipController">
     <div class="panel-heading handle bold">
         {{relationshipWidget.title| translate}}
-        <span class="nav-pills" ng-if="selectedTei && selectedProgram.relationshipText">
+        <span class="nav-pills" ng-if="selectedTei && selectedProgram.relationshipText  && !selectedTei.inactive">
             | <a href ng-click="showAddRelationship(true)" title="{{'add_relationship'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showAddRelationshipDiv]">{{selectedProgram.relationshipText}}</span></a>
         </span>        
         
-        <span class="nav-pills" ng-if="selectedTei">
+        <span class="nav-pills" ng-if="selectedTei  && !selectedTei.inactive">
             | <a href ng-click="showAddRelationship(false)" title="{{'add_relationship'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showAddRelationshipDiv]">{{'add' | translate}}</span></a>
         </span>
         
@@ -37,7 +37,7 @@
                     <td title="{{'go_to_dashboard'| translate}}" ng-click="showDashboard(rel.trackedEntityInstance, rel.relId)" ng-repeat="att in attributes" ng-if="att.displayInListNoProgram">
                         {{rel.attributes[att.id]}}
                     </td>
-                    <td ng-click="removeRelationship(rel)" title="{{'delete_relationship'| translate}}">
+                    <td ng-click="removeRelationship(rel)" title="{{'delete_relationship'| translate}}" ng-if="!selectedTei.inactive">
                         <i class="fa fa-trash-o red"></i>
                     </td>
                 </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-08-25 22:19:06 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-08-26 10:26:31 +0000
@@ -353,4 +353,5 @@
 greater_than=greater than
 inactive=Inactive
 activate_tei=Set TEI to active
-deactivate_tei=Set TEI to inactive
\ No newline at end of file
+deactivate_tei=Set TEI to inactive
+tei_inactive_only_read=The TEI is inactive. Only read operations are allowed.
\ No newline at end of file