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

Fixed #614 - create transaction from template: fallback to default account if...

Fixed #614 - create transaction from template: fallback to default account if template uses hidden/readonly account
parent 7333d8bd
No related branches found
No related tags found
No related merge requests found
......@@ -139,13 +139,13 @@ public class TemplateController extends BaseController
if(newTransaction.getAmount() == null && newTransaction.isExpenditure() == null)
{
template.setIsExpenditure(true);
newTransaction.setIsExpenditure(true);
}
final DateTime date = dateService.getDateTimeFromCookie(cookieDate);
transactionService.prepareModelNewOrEdit(model, false, date, null, template, accountService.getAllActivatedAccountsAsc());
transactionService.prepareModelNewOrEdit(model, false, date, null, newTransaction, accountService.getAllActivatedAccountsAsc());
if(template.isTransfer())
if(newTransaction.isTransfer())
{
return "transactions/newTransactionTransfer";
}
......
......@@ -91,6 +91,12 @@ public class TemplateService implements Resettable, AccessAllEntities<Template>
{
template.setAccount(accountService.getRepository().findByIsDefault(true));
}
final Account transferAccount = template.getTransferAccount();
if(transferAccount != null && transferAccount.getAccountState() != AccountState.FULL_ACCESS)
{
template.setTransferAccount(accountService.getRepository().findByIsDefault(true));
}
}
public void prepareModelNewOrEdit(Model model, boolean isEdit, TransactionBase item, List<Account> accounts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment