diff --git a/ui/app/common/config/services/configurations.js b/ui/app/common/config/services/configurations.js index f97d19630a..07f58b6ad6 100644 --- a/ui/app/common/config/services/configurations.js +++ b/ui/app/common/config/services/configurations.js @@ -79,10 +79,6 @@ angular.module('bahmni.common.config') return this.configs.defaultEncounterType; }; - this.registrationSMSToggle = function () { - return this.configs.registrationSMSToggle; - }; - this.helpDeskNumber = function () { return this.configs.helpDeskNumber; }; diff --git a/ui/app/common/domain/services/configurationService.js b/ui/app/common/domain/services/configurationService.js index 8f3b2416cf..bcb161c6a7 100644 --- a/ui/app/common/domain/services/configurationService.js +++ b/ui/app/common/domain/services/configurationService.js @@ -171,18 +171,6 @@ angular.module('bahmni.common.domain') }); }; - configurationFunctions.registrationSMSToggle = function () { - return $http.get(Bahmni.Common.Constants.globalPropertyUrl, { - params: { - property: 'sms.enableRegistrationSMSAlert' - }, - withCredentials: true, - transformResponse: [function (data) { - return data; - }] - }); - }; - configurationFunctions.helpDeskNumber = function () { return $http.get(Bahmni.Common.Constants.globalPropertyUrl, { params: { diff --git a/ui/app/common/services/smsService.js b/ui/app/common/services/smsService.js deleted file mode 100644 index 82a79ba80b..0000000000 --- a/ui/app/common/services/smsService.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -angular.module('bahmni.common.util') - .factory('smsService', ['$http', 'messagingService', function ($http, messagingService) { - var sendSMS = function (phoneNumber, message) { - getSMSUrl().then(function (smsEndpoint) { - if (smsEndpoint.data != '') { - var data = { - "phoneNumber": phoneNumber, - "message": message - }; - return $http.post(smsEndpoint.data, data, { - withCredentials: true, - headers: { - "Content-Type": "application/json", - "Accept": "text/plain" - } - }); - } else { - messagingService.showMessage("error", "SMS endpoint not configured for sending SMS notification"); - } - }); - }; - - var getSMSUrl = function () { - return $http.get(Bahmni.Common.Constants.globalPropertyUrl, { - method: "GET", - params: { - property: 'sms.endpoint' - }, - withCredentials: true, - headers: { - Accept: 'text/plain' - } - }); - }; - return { - sendSMS: sendSMS - }; - }]); diff --git a/ui/app/registration/controllers/createPatientController.js b/ui/app/registration/controllers/createPatientController.js index dda7cea1a1..073839ae28 100644 --- a/ui/app/registration/controllers/createPatientController.js +++ b/ui/app/registration/controllers/createPatientController.js @@ -1,8 +1,8 @@ 'use strict'; angular.module('bahmni.registration') - .controller('CreatePatientController', ['$scope', '$rootScope', '$state', 'patientService', 'smsService', 'patient', 'spinner', 'appService', 'messagingService', 'ngDialog', '$q', '$translate', - function ($scope, $rootScope, $state, patientService, smsService, patient, spinner, appService, messagingService, ngDialog, $q, $translate) { + .controller('CreatePatientController', ['$scope', '$rootScope', '$state', 'patientService', 'patient', 'spinner', 'appService', 'messagingService', 'ngDialog', '$q', '$translate', + function ($scope, $rootScope, $state, patientService, patient, spinner, appService, messagingService, ngDialog, $q, $translate) { var dateUtil = Bahmni.Common.Util.DateUtil; $scope.actions = {}; var errorMessage; @@ -203,12 +203,6 @@ angular.module('bahmni.registration') if (errorMessage) { messagingService.showMessage("error", errorMessage); errorMessage = undefined; - } else { - if ($rootScope.registrationSMSToggle == "true" && ($scope.patient.phoneNumber != undefined)) { - var name = $scope.patient.givenName + " " + $scope.patient.familyName; - var message = patientService.getRegistrationMessage(patientId, name, $scope.patient.age.years, $scope.patient.gender); - smsService.sendSMS($scope.patient.phoneNumber, message); - } } }); }; diff --git a/ui/app/registration/index.html b/ui/app/registration/index.html index 0cb9323a1e..d38b192541 100644 --- a/ui/app/registration/index.html +++ b/ui/app/registration/index.html @@ -157,7 +157,6 @@ - diff --git a/ui/app/registration/initialization.js b/ui/app/registration/initialization.js index c134dbbe82..24d020c68c 100644 --- a/ui/app/registration/initialization.js +++ b/ui/app/registration/initialization.js @@ -4,7 +4,7 @@ angular.module('bahmni.registration').factory('initialization', ['$rootScope', '$q', 'configurations', 'authenticator', 'appService', 'spinner', 'preferences', 'locationService', 'mergeService', '$translate', function ($rootScope, $q, configurations, authenticator, appService, spinner, preferences, locationService, mergeService, $translate) { var getConfigs = function () { - var configNames = ['encounterConfig', 'patientAttributesConfig', 'identifierTypesConfig', 'addressLevels', 'genderMap', 'relationshipTypeConfig', 'relationshipTypeMap', 'loginLocationToVisitTypeMapping', 'registrationSMSToggle', 'helpDeskNumber']; + var configNames = ['encounterConfig', 'patientAttributesConfig', 'identifierTypesConfig', 'addressLevels', 'genderMap', 'relationshipTypeConfig', 'relationshipTypeMap', 'loginLocationToVisitTypeMapping', 'helpDeskNumber']; return configurations.load(configNames).then(function () { var mandatoryPersonAttributes = appService.getAppDescriptor().getConfigValue("mandatoryPersonAttributes"); var patientAttributeTypes = new Bahmni.Common.Domain.AttributeTypeMapper().mapFromOpenmrsAttributeTypes(configurations.patientAttributesConfig(), mandatoryPersonAttributes, {}, $rootScope.currentUser.userProperties.defaultLocale); @@ -17,10 +17,7 @@ angular.module('bahmni.registration').factory('initialization', $rootScope.addressLevels = configurations.addressLevels(); $rootScope.fieldValidation = appService.getAppDescriptor().getConfigValue("fieldValidation"); $rootScope.genderMap = configurations.genderMap(); - $rootScope.registrationSMSToggle = configurations.registrationSMSToggle(); - if ($rootScope.registrationSMSToggle) { - $rootScope.helpDeskNumber = configurations.helpDeskNumber(); - } + $rootScope.helpDeskNumber = configurations.helpDeskNumber(); Bahmni.Common.Util.GenderUtil.translateGender($rootScope.genderMap, $translate); $rootScope.relationshipTypeMap = configurations.relationshipTypeMap(); $rootScope.relationshipTypes = configurations.relationshipTypes(); diff --git a/ui/test/unit/registration/controllers/createPatientController.spec.js b/ui/test/unit/registration/controllers/createPatientController.spec.js index f28846eac1..3475bddea6 100644 --- a/ui/test/unit/registration/controllers/createPatientController.spec.js +++ b/ui/test/unit/registration/controllers/createPatientController.spec.js @@ -2,7 +2,7 @@ describe('CreatePatientController', function() { var $aController, q, scopeMock, rootScopeMock, stateMock, patientServiceMock, preferencesMock, spinnerMock, - appServiceMock, ngDialogMock, ngDialogLocalScopeMock, httpBackend, http, sections, identifiersMock, messagingService, smsServiceMock; + appServiceMock, ngDialogMock, ngDialogLocalScopeMock, httpBackend, http, sections, identifiersMock, messagingService; beforeEach(module('bahmni.registration')); beforeEach(module('bahmni.common.models')); @@ -44,7 +44,6 @@ describe('CreatePatientController', function() { spinnerMock = jasmine.createSpyObj('spinnerMock', ['forPromise']); appServiceMock = jasmine.createSpyObj('appServiceMock', ['getAppDescriptor']); messagingService = jasmine.createSpyObj('messagingService', ['showMessage']); - smsServiceMock = jasmine.createSpyObj('smsService', ['smsAlert']); ngDialogMock = jasmine.createSpyObj('ngDialogMock', ['open', 'close']); ngDialogLocalScopeMock = scopeMock; @@ -138,8 +137,7 @@ describe('CreatePatientController', function() { spinner: spinnerMock, appService: appServiceMock, ngDialog: ngDialogMock, - messagingService: messagingService, - smsService: smsServiceMock + messagingService: messagingService }); scopeMock.actions = { @@ -167,8 +165,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(scopeMock.patient["education"].conceptUuid).toBe("c2107f30-3f10-11e4-adec-0800271c1b75"); @@ -186,8 +183,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(scopeMock.patient["date"].toLocaleDateString()).toBe(new Date().toLocaleDateString()); @@ -217,8 +213,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(sections["additionalPatientInformation"].expand).toBeTruthy(); @@ -234,8 +229,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(sections["additionalPatientInformation"].expand).toBeTruthy(); @@ -262,8 +256,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(scopeMock.patient["education"]).toBeUndefined(); @@ -514,8 +507,7 @@ describe('CreatePatientController', function() { preferences: preferencesMock, spinner: spinnerMock, appService: appServiceMock, - ngDialog: ngDialogMock, - smsService: smsServiceMock + ngDialog: ngDialogMock }); expect(scopeMock.disablePhotoCapture).toBeTruthy(); });