1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-01 12:08:37 -04:00

Move 'status' from transactions to splits

This allows for a transaction to clear one account before the other (and
mirrors how Gnucash, and I suspect most other pieces of software, do it)
This commit is contained in:
2017-05-31 08:23:19 -04:00
parent 11c7f199c4
commit b37a20536f
6 changed files with 86 additions and 69 deletions

View File

@ -109,7 +109,6 @@ func AccountImportHandler(w http.ResponseWriter, r *http.Request, user *User, ac
var transactions []Transaction
for _, transaction := range itl.Transactions {
transaction.UserId = user.UserId
transaction.Status = Imported
if !transaction.Valid() {
sqltransaction.Rollback()
@ -122,6 +121,7 @@ func AccountImportHandler(w http.ResponseWriter, r *http.Request, user *User, ac
// and fixup the SecurityId to be a valid one for this user's actual
// securities instead of a placeholder from the import
for _, split := range transaction.Splits {
split.Status = Imported
if split.AccountId != -1 {
if split.AccountId != importedAccount.AccountId {
sqltransaction.Rollback()