Skip to content

Commit

Permalink
fix #369. Do not modify existing tickets if category is (or was) dynamic
Browse files Browse the repository at this point in the history
(cherry picked from commit 6398e10)
  • Loading branch information
cbellone committed Dec 11, 2017
1 parent 8dd55ab commit aeefa06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/alfio/manager/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,14 @@ private void handleTicketAllocationStrategyChange(Event event, TicketCategory or
}

void handlePriceChange(Event event, TicketCategory original, TicketCategory updated) {
if(original.getSrcPriceCts() == updated.getSrcPriceCts()) {
if(original.getSrcPriceCts() == updated.getSrcPriceCts() || !original.isBounded()) {
return;
}
final List<Integer> ids = ticketRepository.selectTicketInCategoryForUpdate(event.getId(), updated.getId(), updated.getMaxTickets(), singletonList(TicketStatus.FREE.name()));
if(ids.size() < updated.getMaxTickets()) {
throw new IllegalStateException("Tickets have already been sold (or are in the process of being sold) for this category. Therefore price update is not allowed.");
}
//there's no need to calculate final price, vat etc, since these values will be update at the time of reservation
//there's no need to calculate final price, vat etc, since these values will be updated at the time of reservation
ticketRepository.updateTicketPrice(updated.getId(), event.getId(), updated.getSrcPriceCts(), 0, 0, 0);
}

Expand Down

0 comments on commit aeefa06

Please sign in to comment.