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

Fixed #529 - don't set template ID to null in controller, use ftl instead

parent e3d44feb
No related branches found
No related tags found
No related merge requests found
Pipeline #3606 passed
......@@ -126,8 +126,6 @@ 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);
......
......@@ -26,7 +26,9 @@
<#import "../helpers/validation.ftl" as validation>
<form name="NewTransaction" action="<@s.url '/transactions/newTransaction/normal'/>" method="post" onsubmit="return validateForm()">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<input type="hidden" name="ID" value="<#if transaction.getID()??>${transaction.getID()?c}</#if>">
<!-- only set ID for transactions not templates, otherwise the input is filled with the template ID and saving the transaction
may then override an existing transactions if the ID is also already used in transactions table -->
<input type="hidden" name="ID" value="<#if transaction.class.simpleName == "Transaction" && transaction.getID()??>${transaction.getID()?c}</#if>">
<#-- isPayment switch -->
<@newTransactionMacros.isExpenditureSwitch transaction isPayment/>
......
......@@ -26,7 +26,9 @@
<#import "../helpers/validation.ftl" as validation>
<form name="NewTransaction" action="<@s.url '/transactions/newTransaction/transfer'/>" method="post" onsubmit="return validateForm()">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<input type="hidden" name="ID" value="<#if transaction.getID()??>${transaction.getID()?c}</#if>">
<!-- only set ID for transactions not templates, otherwise the input is filled with the template ID and saving the transaction
may then override an existing transactions if the ID is also already used in transactions table -->
<input type="hidden" name="ID" value="<#if transaction.class.simpleName == "Transaction" && transaction.getID()??>${transaction.getID()?c}</#if>">
<input type="hidden" name="isPayment" value="true">
<#-- name -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment