X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FLedgerTransaction.java;h=001c107e0193b2a5c5a272bb6c60ec232a1a5e74;hb=25cd3a8bb9b8196cddd1f66b7757cadc8248a37f;hp=2eba45e9cd4ea1e58d243b794c59d3547b2aaa81;hpb=93545c6fbf1244fbd96ecfc50e1115dbdc25f9ae;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java index 2eba45e9..001c107e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java @@ -53,18 +53,17 @@ public class LedgerTransaction { return Float.compare(o1.getAmount(), o2.getAmount()); }; private final long profile; - private final Integer id; + private final long id; private final List accounts; private SimpleDate date; private String description; private String comment; private String dataHash; private boolean dataLoaded; - public LedgerTransaction(Integer id, String dateString, String description) - throws ParseException { + public LedgerTransaction(long id, String dateString, String description) throws ParseException { this(id, Globals.parseLedgerDate(dateString), description); } - public LedgerTransaction(Integer id, SimpleDate date, String description, + public LedgerTransaction(long id, SimpleDate date, String description, MobileLedgerProfile profile) { this.profile = profile.getId(); this.id = id; @@ -74,11 +73,11 @@ public class LedgerTransaction { this.dataHash = null; dataLoaded = false; } - public LedgerTransaction(Integer id, SimpleDate date, String description) { + public LedgerTransaction(long id, SimpleDate date, String description) { this(id, date, description, Data.getProfile()); } public LedgerTransaction(SimpleDate date, String description) { - this(null, date, description); + this(0, date, description); } public LedgerTransaction(int id) { this(id, (SimpleDate) null, null); @@ -126,7 +125,7 @@ public class LedgerTransaction { public void setComment(String comment) { this.comment = comment; } - public int getId() { + public long getId() { return id; } protected void fillDataHash() { @@ -169,8 +168,8 @@ public class LedgerTransaction { return; try (Cursor cTr = db.rawQuery( - "SELECT year, month, day, description, comment from transactions WHERE profile=? " + - "AND id=?", new String[]{String.valueOf(profile), String.valueOf(id)})) + "SELECT year, month, day, description, comment from transactions WHERE id=?", + new String[]{String.valueOf(id)})) { if (cTr.moveToFirst()) { date = new SimpleDate(cTr.getInt(0), cTr.getInt(1), cTr.getInt(2)); @@ -181,8 +180,8 @@ public class LedgerTransaction { try (Cursor cAcc = db.rawQuery( "SELECT account_name, amount, currency, comment FROM " + - "transaction_accounts WHERE profile=? AND transaction_id = ?", - new String[]{String.valueOf(profile), String.valueOf(id)})) + "transaction_accounts WHERE transaction_id = ?", + new String[]{String.valueOf(id)})) { while (cAcc.moveToNext()) { // debug("transactions",