From a2411800ec275e090a664bd9cba61b56bc23a5b6 Mon Sep 17 00:00:00 2001 From: saleksandra Date: Tue, 8 Oct 2024 09:17:07 +0200 Subject: [PATCH] OLMIS-7992: Fix passing parameter to hasRoleWithRightForProgramAndSupervisoryNode function --- CHANGELOG.md | 7 +++++++ src/requisition/requisition-cache.service.js | 3 +-- src/requisition/requisition-cache.service.spec.js | 10 ++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5fee73..128448da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ +7.0.13-SNAPSHOT / WIP +================== + +Bug fixes: +* [OLMIS-7992](https://openlmis.atlassian.net/browse/OLMIS-7992): Fix passing parameter to hasRoleWithRightForProgramAndSupervisoryNode function + 7.0.12 / 2024-04-19 ================== + New functionalities that are backwards-compatible: * [OLMIS-7838](https://openlmis.atlassian.net/browse/OLMIS-7838): Move BUQ and TM Monthly functionalities from Tanzania to Core instance diff --git a/src/requisition/requisition-cache.service.js b/src/requisition/requisition-cache.service.js index d7a911de..0c886f27 100644 --- a/src/requisition/requisition-cache.service.js +++ b/src/requisition/requisition-cache.service.js @@ -212,8 +212,7 @@ function hasRightForRequisition(requisition) { return permissionService.hasRoleWithRightForProgramAndSupervisoryNode( REQUISITION_RIGHTS.REQUISITION_VIEW, - requisition.program.id, - requisition.supervisoryNode + requisition ); } diff --git a/src/requisition/requisition-cache.service.spec.js b/src/requisition/requisition-cache.service.spec.js index e67b249e..4c4eca13 100644 --- a/src/requisition/requisition-cache.service.spec.js +++ b/src/requisition/requisition-cache.service.spec.js @@ -288,10 +288,9 @@ describe('requisitionCacheService', function() { }); this.permissionService.hasRoleWithRightForProgramAndSupervisoryNode - .andCallFake(function(right, program, supervisoryNode) { + .andCallFake(function(right, requisition) { return context.$q.resolve(!(right === context.REQUISITION_RIGHTS.REQUISITION_VIEW - && program === context.batchRequisitionOne.program.id - && supervisoryNode === context.batchRequisitionOne.supervisoryNode)); + && requisition === context.batchRequisitionOne)); }); var result; @@ -352,10 +351,9 @@ describe('requisitionCacheService', function() { it('should return requisition if user has not related right but has permission string', function() { var context = this; this.permissionService.hasRoleWithRightForProgramAndSupervisoryNode - .andCallFake(function(right, program, supervisoryNode) { + .andCallFake(function(right, requisition) { return !(right === context.REQUISITION_RIGHTS.REQUISITION_VIEW && - program === context.batchRequisitionOne.program.id && - supervisoryNode === context.batchRequisitionOne.supervisoryNode); + requisition === context.batchRequisitionOne); }); var result;