X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FLedgerTransactionAccount.java;h=4468724e5f3771490ce81221ec8d480ce30f3817;hb=2d09e6a32395295afec7deb5561b7eb2a82f8efc;hp=59e1dab00fb90d69b8d28ec45f465d9574db74a4;hpb=592803265bf5a0f6ea2da27dd061c9829ce2bf20;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java index 59e1dab0..4468724e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java @@ -19,6 +19,8 @@ package net.ktnx.mobileledger.model; import androidx.annotation.NonNull; +import net.ktnx.mobileledger.utils.Misc; + public class LedgerTransactionAccount { private String accountName; private String shortAccountName; @@ -31,12 +33,16 @@ public class LedgerTransactionAccount { this.setAccountName(accountName); this.amount = amount; this.amountSet = true; - this.currency = currency; - this.comment = comment; + this.currency = Misc.emptyIsNull(currency); + this.comment = Misc.emptyIsNull(comment); } public LedgerTransactionAccount(String accountName) { this.accountName = accountName; } + public LedgerTransactionAccount(String accountName, String currency) { + this.accountName = accountName; + this.currency = Misc.emptyIsNull(currency); + } public LedgerTransactionAccount(LedgerTransactionAccount origin) { // copy constructor setAccountName(origin.getAccountName()); @@ -67,22 +73,22 @@ public class LedgerTransactionAccount { return amount; } - public void setAmount(float account_amount) { this.amount = account_amount; this.amountSet = true; } - public void resetAmount() { this.amountSet = false; } - public boolean isAmountSet() { return amountSet; } public String getCurrency() { return currency; } + public void setCurrency(String currency) { + this.currency = Misc.emptyIsNull(currency); + } @NonNull public String toString() { if (!amountSet)