Skip to content

Commit

Permalink
OLMIS-7992: Fix passing parameter to hasRoleWithRightForProgramAndSup…
Browse files Browse the repository at this point in the history
…ervisoryNode function
  • Loading branch information
saleksandra committed Oct 8, 2024
1 parent f53b35a commit a241180
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/requisition/requisition-cache.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@
function hasRightForRequisition(requisition) {
return permissionService.hasRoleWithRightForProgramAndSupervisoryNode(
REQUISITION_RIGHTS.REQUISITION_VIEW,
requisition.program.id,
requisition.supervisoryNode
requisition
);
}

Expand Down
10 changes: 4 additions & 6 deletions src/requisition/requisition-cache.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a241180

Please sign in to comment.