]> git.ktnx.net Git - mobile-ledger.git/commitdiff
pass transaction comment to the JSON API
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 13 May 2020 18:41:28 +0000 (21:41 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 17:39:53 +0000 (17:39 +0000)
as a 'same line' comment, e.g.

date description ; comment
 account 42
 account

the "preceding" comment is not working (at least with 1.14)

app/src/main/java/net/ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java
app/src/main/java/net/ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java

index e95c27c17aee7a85373bcef949ababf09fecac81..058319a3b4e250b12cc19b33afa241915b149af9 100644 (file)
@@ -48,7 +48,7 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse
     public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) {
         ParsedLedgerTransaction
                 result = new ParsedLedgerTransaction();
-        result.setTcomment("");
+        result.setTcomment(tr.getComment());
         result.setTprecedingcomment("");
 
         ArrayList<ParsedPosting> postings = new ArrayList<>();
index 2f6867dcff4f75f490fb8c0f7988df4b3c3198b7..1cffcfac2a5bafe104d179af65efbb9a6d6db59b 100644 (file)
@@ -46,7 +46,7 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse
     }
     public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) {
         ParsedLedgerTransaction result = new ParsedLedgerTransaction();
-        result.setTcomment("");
+        result.setTcomment(tr.getComment());
         result.setTprecedingcomment("");
 
         ArrayList<ParsedPosting> postings = new ArrayList<>();
index 39f53a97eb2f9a0cc074d488184442b0a27d4139..2b3adc9f42bebf434e0e0821f201b0849de87f0d 100644 (file)
@@ -201,6 +201,7 @@ public class NewTransactionFragment extends Fragment {
             LedgerTransaction tr =
                     new LedgerTransaction(null, date, viewModel.getDescription(), mProfile);
 
+            tr.setComment(viewModel.getComment());
             LedgerTransactionAccount emptyAmountAccount = null;
             float emptyAmountAccountBalance = 0;
             for (int i = 0; i < viewModel.getAccountCount(); i++) {