dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43213
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21950: enrollment(s) now return orgunitName
------------------------------------------------------------
revno: 21950
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-02-11 16:31:13 +0100
message:
enrollment(s) now return orgunitName
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.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/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2016-01-04 14:27:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2016-02-11 15:31:13 +0000
@@ -164,6 +164,7 @@
if ( programInstance.getOrganisationUnit() != null )
{
enrollment.setOrgUnit( programInstance.getOrganisationUnit().getUid() );
+ enrollment.setOrgUnitName( programInstance.getOrganisationUnit().getName() );
}
enrollment.setCreated( programInstance.getCreated() );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java 2016-01-04 14:27:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java 2016-02-11 15:31:13 +0000
@@ -61,6 +61,8 @@
private EnrollmentStatus status;
private String orgUnit;
+
+ private String orgUnitName;
private Date enrollmentDate;
@@ -175,6 +177,18 @@
{
this.orgUnit = orgUnit;
}
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public String getOrgUnitName()
+ {
+ return orgUnitName;
+ }
+
+ public void setOrgUnitName( String orgUnitName )
+ {
+ this.orgUnitName = orgUnitName;
+ }
@JsonProperty( required = true )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java 2016-02-01 07:36:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java 2016-02-11 15:31:13 +0000
@@ -126,7 +126,7 @@
if ( fields.isEmpty() )
{
- fields.add( "enrollment,created,lastUpdated,trackedEntity,trackedEntityInstance,program,status,orgUnit,enrollmentDate,incidentDate,followup" );
+ fields.add( "enrollment,created,lastUpdated,trackedEntity,trackedEntityInstance,program,status,orgUnit,orgUnitName,enrollmentDate,incidentDate,followup" );
}
Set<String> orgUnits = TextUtils.splitToArray( ou, TextUtils.SEMICOLON );
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2016-02-11 15:31:13 +0000
@@ -9,7 +9,6 @@
DateUtils,
SessionStorageService,
CurrentSelection,
- OrgUnitService,
EnrollmentService,
$route,
DialogService,
@@ -59,16 +58,6 @@
});
angular.forEach($scope.enrollments, function(enrollment){
- if(enrollment.orgUnit !== $scope.selectedOrgUnit.id) {
- OrgUnitService.get(enrollment.orgUnit).then(function(ou){
- if(ou){
- enrollment.orgUnitName = $scope.selectedOrgUnit.name;
- }
- });
- }
- else{
- enrollment.orgUnitName = $scope.selectedOrgUnit.name;
- }
if(enrollment.program === $scope.selectedProgram.id ){
if(enrollment.status === 'ACTIVE'){
selectedEnrollment = enrollment;
=== 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 2016-02-10 21:08:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2016-02-11 15:31:13 +0000
@@ -260,26 +260,7 @@
}
};
})
-
- /*Orgunit service for local db */
- .service('OrgUnitService', function($rootScope, $q){
-
- return {
- get: function(uid){
- var def = $q.defer();
- selection.getOrganisationUnit(uid).then(function(response){
- var ou = response && response[uid] && response[uid].n ? {id: uid, name: response[uid].n} : null;
- $rootScope.$apply(function(){
- def.resolve(ou);
- });
- }, function(){
- def.resolve(null);
- });
- return def.promise;
- }
- };
- })
-
+
/* service for common utils */
.service('CommonUtils', function(DateUtils, OptionSetService, CurrentSelection, FileService){