=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-03-28 09:24:30 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-03-30 10:40:41 +0000 @@ -149,8 +149,6 @@ section.open = true; }); - $scope.customForm = CustomFormService.getForProgramStage($scope.selectedProgramStage); - $scope.prStDes = []; $scope.eventGridColumns = []; $scope.filterTypes = {}; @@ -195,13 +193,14 @@ $scope.filterText[prStDe.dataElement.id]= {}; } }); + + $scope.customForm = CustomFormService.getForProgramStage($scope.selectedProgramStage, $scope.prStDes); if($scope.selectedProgramStage.captureCoordinates){ $scope.newDhis2Event.coordinate = {}; } $scope.newDhis2Event.eventDate = ''; - ErrorMessageService.setErrorMessages(errorMessages); ProgramValidationService.getByProgram($scope.selectedProgram.id).then(function(pvs){ === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-03-28 09:24:30 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-03-30 10:40:41 +0000 @@ -191,9 +191,7 @@ function getCalendarSetting() { - var SessionStorageService = angular.element('body').injector().get('SessionStorageService'); - - if( SessionStorageService.get('CALENDAR_SETTING') ){ + if(localStorage['CALENDAR_SETTING']){ return; } @@ -203,7 +201,7 @@ url: '../api/systemSettings?key=keyCalendar&key=keyDateFormat', type: 'GET' }).done(function(response) { - SessionStorageService.set('CALENDAR_SETTING', response); + localStorage['CALENDAR_SETTING'] = JSON.stringify(response); def.resolve(); }).fail(function(){ def.resolve(); === 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-03-27 14:31:13 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-03-30 10:40:41 +0000 @@ -185,14 +185,13 @@ $scope.programStageNames = []; //get programs valid for the selected ou and tei - angular.forEach(programs, function(program){ - $scope.programNames[program.id] = {id: program.id, name: program.name}; - angular.forEach(program.programStages, function(stage){ - $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name}; - }); - if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) && - program.trackedEntity.id === $scope.selectedTei.trackedEntity){ + angular.forEach(programs, function(program){ + if( program.trackedEntity.id === $scope.selectedTei.trackedEntity ){ $scope.programs.push(program); + $scope.programNames[program.id] = {id: program.id, name: program.name}; + angular.forEach(program.programStages, function(stage){ + $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name}; + }); if($scope.selectedProgramId && program.id === $scope.selectedProgramId || selectedEnrollment && selectedEnrollment.program === program.id){ $scope.selectedProgram = program; === 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-03-27 14:31:13 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-03-30 10:40:41 +0000 @@ -235,7 +235,7 @@ section.open = true; }); - $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage); + $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage, $scope.prStDes); $scope.displayCustomForm = $scope.customForm ? true:false; $scope.currentEventOriginal = angular.copy($scope.currentEvent); @@ -247,28 +247,32 @@ angular.forEach(event.dataValues, function(dataValue){ - var val = dataValue.value; - var de = $scope.prStDes[dataValue.dataElement].dataElement; - if(de){ - if(val && de.type === 'string' && de.optionSet && $scope.optionSets[de.optionSet.id].options ){ - val = OptionSetService.getName($scope.optionSets[de.optionSet.id].options, val); - } - if(val && de.type === 'date'){ - val = DateUtils.formatFromApiToUser(val); - } - if(de.type === 'trueOnly'){ - if(val === 'true'){ - val = true; - } - else{ - val = ''; - } - } - } - event[dataValue.dataElement] = val; - if(dataValue.providedElsewhere){ - event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere; + var prStDe = $scope.prStDes[dataValue.dataElement]; + + if( prStDe ){ + var val = dataValue.value; + if(prStDe.dataElement){ + if(val && prStDe.dataElement.type === 'string' && prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id].options ){ + val = OptionSetService.getName($scope.optionSets[prStDe.dataElement.optionSet.id].options, val); + } + if(val && prStDe.dataElement.type === 'date'){ + val = DateUtils.formatFromApiToUser(val); + } + if(prStDe.dataElement.type === 'trueOnly'){ + if(val === 'true'){ + val = true; + } + else{ + val = ''; + } + } + } + event[dataValue.dataElement] = val; + if(dataValue.providedElsewhere){ + event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere; + } } + }); if(stage.captureCoordinates){ @@ -276,12 +280,13 @@ longitude: event.coordinate.longitude ? event.coordinate.longitude : ''}; } - event.allowProvidedElsewhereExists = false; - angular.forEach(stage.programStageDataElements, function(prStDe){ - if(prStDe.allowProvidedElsewhere){ - event.allowProvidedElsewhereExists = true; + event.allowProvidedElsewhereExists = false; + for(var i=0; i/g, match, === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2015-01-14 04:26:26 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2015-03-30 10:40:41 +0000 @@ -11,6 +11,8 @@ $( '#submit' ).attr( 'disabled', 'disabled' ); sessionStorage.removeItem( 'ouSelected' ); + sessionStorage.removeItem( 'USER_PROFILE' ); + sessionStorage.removeItem( 'USER_ROLES' ); } ); var locale = localStorage[login.localeKey];