From 0342b9d5ede076718e9bfa8a9ba23e7e622caa4d Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Wed, 10 Jun 2020 22:14:27 +0200
Subject: [PATCH] Fixed #521 - use template: template ID is set as transaction
 ID

---
 .../budgetmaster/templates/TemplateController.java           | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateController.java b/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateController.java
index e47499375..a29f6371b 100644
--- a/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateController.java
+++ b/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateController.java
@@ -125,6 +125,11 @@ public class TemplateController extends BaseController
 		}
 
 		final Template template = templateOptional.get();
+
+		// set ID to null, otherwise the transaction form is prefilled with the template ID and saving the transaction
+		// may then override an existing transactions if the ID is also already used in transactions table
+		template.setID(null);
+
 		templateService.prepareTemplateForNewTransaction(template, true);
 
 		boolean isPayment = true;
-- 
GitLab