]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java
stop resetting the date when an old transaction is loaded into the form
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / new_transaction / NewTransactionModel.java
index 54bb31af257307abb6a7d9aac4fc252785a96367..311226dacd6ec85504e562bc30bab73bf1697e63 100644 (file)
@@ -314,7 +314,7 @@ public class NewTransactionModel extends ViewModel {
 
         if (group != null) {
             int grp = group;
-            if (grp > 0 & grp <= m.groupCount())
+            if (grp > 0 && grp <= m.groupCount())
                 try {
                     return Integer.parseInt(m.group(grp));
                 }
@@ -331,7 +331,7 @@ public class NewTransactionModel extends ViewModel {
 
         if (group != null) {
             int grp = group;
-            if (grp > 0 & grp <= m.groupCount())
+            if (grp > 0 && grp <= m.groupCount())
                 return m.group(grp);
         }
 
@@ -343,7 +343,7 @@ public class NewTransactionModel extends ViewModel {
 
         if (group != null) {
             int grp = group;
-            if (grp > 0 & grp <= m.groupCount())
+            if (grp > 0 && grp <= m.groupCount())
                 try {
                     return Float.valueOf(m.group(grp));
                 }
@@ -469,8 +469,12 @@ public class NewTransactionModel extends ViewModel {
         List<Item> newList = new ArrayList<>();
         Item.resetIdDispenser();
 
+        Item currentHead = items.getValue()
+                                .get(0);
         TransactionHead head = new TransactionHead(tr.transaction.getDescription());
         head.setComment(tr.transaction.getComment());
+        if (currentHead instanceof TransactionHead)
+            head.setDate(((TransactionHead) currentHead).date);
 
         newList.add(head);