]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java
fix legacy new transaction submission with no date (use today's)
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / async / SendTransactionTask.java
index e3675b177ba738950b27234ee98f2a0e5297375e..796da9310d5fcf8445b505b846785aa8e62207aa 100644 (file)
@@ -63,8 +63,8 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
     private String token;
     private String session;
     private LedgerTransaction transaction;
-    private MobileLedgerProfile mProfile;
-    private boolean simulate;
+    private final MobileLedgerProfile mProfile;
+    private final boolean simulate;
 
     public SendTransactionTask(TaskCallback callback, MobileLedgerProfile profile,
                                boolean simulate) {
@@ -177,10 +177,9 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
         if (token != null)
             params.addPair("_token", token);
 
-        SimpleDate transactionDate = transaction.getDate();
-        if (transactionDate == null) {
+        SimpleDate transactionDate = transaction.getDateIfAny();
+        if (transactionDate == null)
             transactionDate = SimpleDate.today();
-        }
 
         params.addPair("date", Globals.formatLedgerDate(transactionDate));
         params.addPair("description", transaction.getDescription());
@@ -318,7 +317,7 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
 
     public enum API {
         auto(0), html(-1), pre_1_15(-2), post_1_14(-3);
-        private static SparseArray<API> map = new SparseArray<>();
+        private static final SparseArray<API> map = new SparseArray<>();
 
         static {
             for (API item : API.values()) {