Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-2962 | Removed direct api call to sms service #657

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ui/app/common/config/services/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
12 changes: 0 additions & 12 deletions ui/app/common/domain/services/configurationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
40 changes: 0 additions & 40 deletions ui/app/common/services/smsService.js

This file was deleted.

10 changes: 2 additions & 8 deletions ui/app/registration/controllers/createPatientController.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
});
};
Expand Down
1 change: 0 additions & 1 deletion ui/app/registration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@

<script src="../common/displaycontrols/observation/init.js"></script>
<script src="../common/services/formService.js"></script>
<script src="../common/services/smsService.js"></script>
<script src="../common/displaycontrols/observation/helpers/groupingFunctions.js"></script>
<script src="../common/displaycontrols/observation/services/formHierarchyBuildService.js"></script>
<script src="../common/displaycontrols/observation/services/formRecordTreeBuildService.js"></script>
Expand Down
7 changes: 2 additions & 5 deletions ui/app/registration/initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -138,8 +137,7 @@ describe('CreatePatientController', function() {
spinner: spinnerMock,
appService: appServiceMock,
ngDialog: ngDialogMock,
messagingService: messagingService,
smsService: smsServiceMock
messagingService: messagingService
});

scopeMock.actions = {
Expand Down Expand Up @@ -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");
Expand All @@ -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());
Expand Down Expand Up @@ -217,8 +213,7 @@ describe('CreatePatientController', function() {
preferences: preferencesMock,
spinner: spinnerMock,
appService: appServiceMock,
ngDialog: ngDialogMock,
smsService: smsServiceMock
ngDialog: ngDialogMock
});

expect(sections["additionalPatientInformation"].expand).toBeTruthy();
Expand All @@ -234,8 +229,7 @@ describe('CreatePatientController', function() {
preferences: preferencesMock,
spinner: spinnerMock,
appService: appServiceMock,
ngDialog: ngDialogMock,
smsService: smsServiceMock
ngDialog: ngDialogMock
});

expect(sections["additionalPatientInformation"].expand).toBeTruthy();
Expand All @@ -262,8 +256,7 @@ describe('CreatePatientController', function() {
preferences: preferencesMock,
spinner: spinnerMock,
appService: appServiceMock,
ngDialog: ngDialogMock,
smsService: smsServiceMock
ngDialog: ngDialogMock
});

expect(scopeMock.patient["education"]).toBeUndefined();
Expand Down Expand Up @@ -514,8 +507,7 @@ describe('CreatePatientController', function() {
preferences: preferencesMock,
spinner: spinnerMock,
appService: appServiceMock,
ngDialog: ngDialogMock,
smsService: smsServiceMock
ngDialog: ngDialogMock
});
expect(scopeMock.disablePhotoCapture).toBeTruthy();
});
Expand Down
Loading