Skip to content
Snippets Groups Projects
Commit 156dab34 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#722 - cleanup: selecting the first transactions if repeating is no longer necessary since #703

parent 0b97a73e
No related branches found
No related tags found
No related merge requests found
......@@ -372,23 +372,17 @@ public class TransactionController extends BaseController
@GetMapping("/{ID}/newFromExisting")
public String newFromExisting(Model model, @PathVariable("ID") Integer ID, @CookieValue("currentDate") String cookieDate)
{
Optional<Transaction> transactionOptional = transactionService.getRepository().findById(ID);
final Optional<Transaction> transactionOptional = transactionService.getRepository().findById(ID);
if(transactionOptional.isEmpty())
{
throw new ResourceNotFoundException();
}
Transaction existingTransaction = transactionOptional.get();
final Transaction existingTransaction = transactionOptional.get();
// select first transaction in order to provide correct start date for repeating transactions
if(existingTransaction.getRepeatingOption() != null)
{
existingTransaction = existingTransaction.getRepeatingOption().getReferringTransactions().get(0);
}
LocalDate date = dateService.getDateTimeFromCookie(cookieDate);
final LocalDate date = dateService.getDateTimeFromCookie(cookieDate);
Transaction newTransaction = new Transaction(existingTransaction);
final Transaction newTransaction = new Transaction(existingTransaction);
newTransaction.setID(null);
newTransaction.setDate(null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment