Creating a recurring transaction with amount overwrite returns an error

This commit is contained in:
2021-03-11 21:23:47 +01:00
parent 015c79d1eb
commit 7fe33e6313
2 changed files with 9 additions and 9 deletions

View File

@@ -1,12 +1,10 @@
package de.financer.controller; package de.financer.controller;
import de.financer.config.FinancerConfig; import de.financer.config.FinancerConfig;
import de.financer.dto.Order;
import de.financer.dto.PeriodOverviewDto; import de.financer.dto.PeriodOverviewDto;
import de.financer.dto.SearchTransactionsResponseDto; import de.financer.dto.SearchTransactionsResponseDto;
import de.financer.form.SearchTransactionsForm; import de.financer.form.SearchTransactionsForm;
import de.financer.template.FinancerRestTemplate; import de.financer.template.FinancerRestTemplate;
import de.financer.template.SearchTransactionsTemplate;
import de.financer.template.StringTemplate; import de.financer.template.StringTemplate;
import de.financer.template.exception.FinancerRestException; import de.financer.template.exception.FinancerRestException;
import de.financer.util.ControllerUtils; import de.financer.util.ControllerUtils;
@@ -58,7 +56,7 @@ public class PeriodController {
return "period/periodOverview"; return "period/periodOverview";
} }
private String showInternal(Model model, Long periodId, String fql, boolean showSum) { private String showInternal(Model model, String fql, boolean showSum) {
final SearchTransactionsForm form = new SearchTransactionsForm(); final SearchTransactionsForm form = new SearchTransactionsForm();
form.setFql(fql); form.setFql(fql);
@@ -100,7 +98,7 @@ public class PeriodController {
public String showAllTransactions(Model model, Long periodId) { public String showAllTransactions(Model model, Long periodId) {
final String fql = String.format("periodId = '%s' ORDER BY date DESC", periodId); final String fql = String.format("periodId = '%s' ORDER BY date DESC", periodId);
return showInternal(model, periodId, fql, false); return showInternal(model, fql, false);
} }
@GetMapping("/showIncomeTransactions") @GetMapping("/showIncomeTransactions")
@@ -108,7 +106,7 @@ public class PeriodController {
final String fql = String final String fql = String
.format("periodId = '%s' AND (fromAccountType = 'INCOME' OR (fromAccountType = 'LIABILITY' AND (toAccountType = 'BANK' OR toAccountType = 'CASH')) OR (fromAccountType = 'START' AND (toAccountType = 'BANK' OR toAccountType = 'CASH'))) ORDER BY date DESC", periodId); .format("periodId = '%s' AND (fromAccountType = 'INCOME' OR (fromAccountType = 'LIABILITY' AND (toAccountType = 'BANK' OR toAccountType = 'CASH')) OR (fromAccountType = 'START' AND (toAccountType = 'BANK' OR toAccountType = 'CASH'))) ORDER BY date DESC", periodId);
return showInternal(model, periodId, fql, true); return showInternal(model, fql, true);
} }
@GetMapping("/showExpenseTransactions") @GetMapping("/showExpenseTransactions")
@@ -116,7 +114,7 @@ public class PeriodController {
final String fql = String final String fql = String
.format("periodId = '%s' AND (fromAccountType = 'BANK' OR fromAccountType = 'CASH') AND toAccountType = 'EXPENSE' ORDER BY date DESC", periodId); .format("periodId = '%s' AND (fromAccountType = 'BANK' OR fromAccountType = 'CASH') AND toAccountType = 'EXPENSE' ORDER BY date DESC", periodId);
return showInternal(model, periodId, fql, true); return showInternal(model, fql, true);
} }
@GetMapping("/showLiabilityTransactions") @GetMapping("/showLiabilityTransactions")
@@ -124,6 +122,6 @@ public class PeriodController {
final String fql = String final String fql = String
.format("periodId = '%s' AND (fromAccountType = 'BANK' OR fromAccountType = 'CASH') AND toAccountType = 'LIABILITY' ORDER BY date DESC", periodId); .format("periodId = '%s' AND (fromAccountType = 'BANK' OR fromAccountType = 'CASH') AND toAccountType = 'LIABILITY' ORDER BY date DESC", periodId);
return showInternal(model, periodId, fql, true); return showInternal(model, fql, true);
} }
} }

View File

@@ -220,8 +220,6 @@ public class RecurringTransactionController {
@GetMapping("/recurringToTransactionWithAmount") @GetMapping("/recurringToTransactionWithAmount")
public String recurringToTransactionWithAmount(String recurringTransactionId, String sub, Model model) { public String recurringToTransactionWithAmount(String recurringTransactionId, String sub, Model model) {
ControllerUtils.addVersionAttribute(model, this.financerConfig);
RecurringToTransactionWithAmountForm form = new RecurringToTransactionWithAmountForm(); RecurringToTransactionWithAmountForm form = new RecurringToTransactionWithAmountForm();
form.setRecurringTransactionId(recurringTransactionId); form.setRecurringTransactionId(recurringTransactionId);
@@ -229,6 +227,10 @@ public class RecurringTransactionController {
model.addAttribute("form", form); model.addAttribute("form", form);
ControllerUtils.addVersionAttribute(model, this.financerConfig);
ControllerUtils.addCurrencySymbol(model, this.financerConfig);
ControllerUtils.addDarkMode(model, this.financerConfig);
return "recurringTransaction/recurringToTransactionWithAmount"; return "recurringTransaction/recurringToTransactionWithAmount";
} }