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

#577 - show button for transactions from readonly accounts too

parent 33a31b80
No related branches found
No related tags found
No related merge requests found
......@@ -232,6 +232,23 @@ public class Transaction implements TransactionBase
return isAccountEditable && isTransferAccountEditable;
}
/**
* States whether this transaction is allowed to be used to create a new transaction
* and prefill all inputs with the data from this transaction.
*/
public boolean isAllowedToFillNewTransaction()
{
boolean isRestCategory = category.getType().equals(CategoryType.REST);
if(isRestCategory)
{
return false;
}
boolean isAccountEditable = account.getAccountState().equals(AccountState.FULL_ACCESS);
boolean isAccountReadOnly = account.getAccountState().equals(AccountState.READ_ONLY);
return isAccountEditable || isAccountReadOnly;
}
@Override
public String toString()
{
......
......@@ -53,6 +53,8 @@
<#if transaction.isEditable()>
<@header.buttonFlat url='/transactions/' + transaction.ID?c + '/edit' icon='edit' localizationKey='' classes="no-padding text-default"/>
<@header.buttonFlat url='/transactions/' + transaction.ID?c + '/requestDelete' icon='delete' localizationKey='' classes="no-padding text-default button-request-delete-transaction" isDataUrl=true/>
</#if>
<#if transaction.isAllowedToFillNewTransaction()>
<@header.buttonFlat url='/transactions/' + transaction.ID?c + '/newFromExisting' icon='content_copy' localizationKey='' classes="no-padding text-default button-new-from-existing"/>
</#if>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment