Skip to content

Commit

Permalink
TRUNK-6006: OrderService prevents saving Order Frequencies (openmrs#3790
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mseaton authored Jun 1, 2021
1 parent 0e5e23f commit 501662b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
5 changes: 0 additions & 5 deletions api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,6 @@ private void stopOrder(Order orderToStop, Date discontinueDate, boolean isRetros
*/
@Override
public OrderFrequency saveOrderFrequency(OrderFrequency orderFrequency) throws APIException {
if (orderFrequency.getOrderFrequencyId() != null
&& dao.isOrderFrequencyInUse(orderFrequency)) {
throw new CannotUpdateObjectInUseException("Order.frequency.cannot.edit");
}

return dao.saveOrderFrequency(orderFrequency);
}

Expand Down
14 changes: 0 additions & 14 deletions api/src/test/java/org/openmrs/api/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1496,20 +1496,6 @@ public void saveOrderFrequency_shouldEditAnExistingOrderFrequencyThatIsNotInUse(
orderService.saveOrderFrequency(orderFrequency);
}

/**
* @see OrderService#saveOrderFrequency(OrderFrequency)
*/
@Test
public void saveOrderFrequency_shouldNotAllowEditingAnExistingOrderFrequencyThatIsInUse() {
OrderFrequency orderFrequency = orderService.getOrderFrequency(1);
assertNotNull(orderFrequency);

orderFrequency.setFrequencyPerDay(4d);
expectedException.expect(CannotUpdateObjectInUseException.class);
expectedException.expectMessage("Order.frequency.cannot.edit");
orderService.saveOrderFrequency(orderFrequency);
}

/**
* @see OrderService#purgeOrderFrequency(OrderFrequency)
*/
Expand Down

0 comments on commit 501662b

Please sign in to comment.