From 7ed77d68ee0788853df574916f083150177458bb Mon Sep 17 00:00:00 2001 From: Mark Polak Date: Mon, 26 Oct 2015 10:52:41 +0100 Subject: [PATCH] Accept-only user fix --- src/main/app.js | 12 +++++++++++- src/main/manifest.webapp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/app.js b/src/main/app.js index 5032cc1..ca07cf7 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -287,6 +287,9 @@ function appController(periodService, $scope, currentUser, mechanismsService, self.tabs.submit.access = false; self.tabs.submit.name = ['Unaccept']; self.tabs.submit.action = ['unaccept']; + self.tabs.unsubmit.access = true; + self.tabs.unsubmit.name = ['Return submission']; + self.tabs.unsubmit.action = ['unaccept']; } } else { if ((permissions.contains('F_APPROVE_DATA') || permissions.contains('F_APPROVE_DATA_LOWER_LEVELS'))) { @@ -618,7 +621,14 @@ function submittedTableViewController($scope, $controller) { jQuery.extend(this, $controller('tableViewController', {$scope: $scope})); var filterOnLevel = function (item) { - if ($scope.approvalLevel && item.level === $scope.approvalLevel.level && item.mayUnapprove === true) { + // User does not have an approval level so, everything is false + if (!$scope.approvalLevel) { + return false; + } + + var onLowerLevelAndAccepted = ((parseInt(item.level, 10) === parseInt($scope.approvalLevel.level, 10) + 1) && item.accepted); + + if (((item.level === $scope.approvalLevel.level) || onLowerLevelAndAccepted) && item.mayUnapprove === true) { return true; } return false; diff --git a/src/main/manifest.webapp b/src/main/manifest.webapp index a7fa3ab..ee21dea 100644 --- a/src/main/manifest.webapp +++ b/src/main/manifest.webapp @@ -1 +1 @@ -{"version":"0.4.7","name":"Data Approval","description":"Approvals app for PEPFAR","icons":{"48":"img/icons/dataapproval.png"},"developer":{"url":"http://www.dhis2.org","name":"Mark Polak","company":"DHIS2 Core Team","email":"markpo@ifi.uio.no"},"launch_path":"index.html?v=0.4.7","default_locale":"en","activities":{"dhis":{"href":"*"}}} \ No newline at end of file +{"version":"0.4.8","name":"Data Approval","description":"Approvals app for PEPFAR","icons":{"48":"img/icons/dataapproval.png"},"developer":{"url":"http://www.dhis2.org","name":"Mark Polak","company":"DHIS2 Core Team","email":"markpo@ifi.uio.no"},"launch_path":"index.html?v=0.4.8","default_locale":"en","activities":{"dhis":{"href":"*"}}} \ No newline at end of file