import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import net.ktnx.mobileledger.json.ParsedLedgerTransaction;
-import net.ktnx.mobileledger.json.ParsedPosting;
import net.ktnx.mobileledger.utils.Digest;
import net.ktnx.mobileledger.utils.Globals;
import java.util.Comparator;
import java.util.Date;
-import static net.ktnx.mobileledger.utils.Logger.debug;
-
public class LedgerTransaction {
private static final String DIGEST_TYPE = "SHA-256";
public final Comparator<LedgerTransactionAccount> comparator =
dataLoaded = false;
}
public LedgerTransaction(Integer id, Date date, String description) {
- this(id, date, description, Data.profile.get());
+ this(id, date, description, Data.profile.getValue());
}
public LedgerTransaction(Date date, String description) {
this(null, date, description);
.rawQuery("SELECT 1 from transactions where data_hash = ?", new String[]{dataHash}))
{
boolean result = c.moveToFirst();
- debug("db", String.format("Transaction %d (%s) %s", id, dataHash,
- result ? "already present" : "not present"));
+// debug("db", String.format("Transaction %d (%s) %s", id, dataHash,
+// result ? "already present" : "not present"));
return result;
}
}
public void finishLoading() {
dataLoaded = true;
}
- public ParsedLedgerTransaction toParsedLedgerTransaction() {
- ParsedLedgerTransaction result = new ParsedLedgerTransaction();
- result.setTcomment("");
- result.setTprecedingcomment("");
-
- ArrayList<ParsedPosting> postings = new ArrayList<>();
- for (LedgerTransactionAccount acc : accounts) {
- if (!acc.getAccountName().isEmpty()) postings.add(acc.asParsedPosting());
- }
-
- result.setTpostings(postings);
- result.setTdate(Globals.formatIsoDate(date));
- result.setTdate2(null);
- result.setTindex(1);
- result.setTdescription(description);
- return result;
- }
}