Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding asset account wrong start balance & date #1048

Closed
webence opened this issue Dec 10, 2017 · 11 comments
Closed

Adding asset account wrong start balance & date #1048

webence opened this issue Dec 10, 2017 · 11 comments
Assignees
Labels
bug Verified and replicated bugs and issues. fixed Bugs that are fixed (in a coming release).
Milestone

Comments

@webence
Copy link

webence commented Dec 10, 2017

I am running Firefly III version 4.6.11.1

When first starting Firefly III it asks to add a asset account including the start amount and start date. As I want to import 15 months back I've added 09/01/2016 as starting date including the balance at that time.

Same for the savings account. When looking at the accounts the start date is the date of 'today' (or whatever day you started with firefly). I then edit the account (add IBAN as well) and change the start date to 09/01/2016. But then after saving the start balance changes to a minus balance (so if you say it's 1000,- it will after saving say it's -1000). You cannot edit this.

When adding the asset/saving account manually this does not happen.

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

Mmm, that is strange. Thx for reporting it. Something similar has happened to another user as well, and I thought I had the problem solved.

Could you run a query on your database and tell me the result? I can use it to see what's wrong. Take the savings account ID from the URL (/accounts/show/x or /accounts/edit/x) and run this query:

select * from transactions where id=x

I'm not able to reproduce this so I'll have to dig deeper.

@webence
Copy link
Author

webence commented Dec 10, 2017

Correction: Cannot set startdate when initializing of course.

After initializing:

(1, '2017-12-10 07:15:10', '2017-12-10 07:15:10', NULL, 0, 1, 1, NULL, 1, 2000.000000000000, NULL, NULL, 0);

After changing date to 09/01/2016:

(1, '2017-12-10 07:15:10', '2017-12-10 07:17:25', NULL, 0, 1, 1, NULL, 1, -2000.000000000000, NULL, NULL, 0);

Entire transaction table:

(1, '2017-12-10 07:15:10', '2017-12-10 07:17:25', NULL, 0, 1, 1, NULL, 1, -2000.000000000000, NULL, NULL, 0),
(2, '2017-12-10 07:15:10', '2017-12-10 07:17:25', NULL, 0, 2, 1, NULL, 1, -2000.000000000000, NULL, NULL, 0),
(3, '2017-12-10 07:15:11', '2017-12-10 07:15:11', NULL, 0, 3, 2, NULL, 1, 1000.000000000000, NULL, NULL, 0),
(4, '2017-12-10 07:15:11', '2017-12-10 07:15:11', NULL, 0, 4, 2, NULL, 1, -1000.000000000000, NULL, NULL, 0);

(Did not change the date of the savings account)

MySQL 5.7.14 and PHP 7.1.12

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

In the after initializing, and after changing date: is there just one entry in the transactions table for the account?

@webence
Copy link
Author

webence commented Dec 10, 2017

The last 4 rows are all rows in the transactions table after changing the start date

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

That was a confusing question, my bad. I'll get back to you in a bit!

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

OK, in your transactions table, the entries where transaction_journal_id = 1 are both positive, AKA both 2000. Change one of them to -2000.

That should fix the problem. I'm looking at the code to see what is going wrong.

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

I've pushed a fix that should prevent this from happening in the future. In the next release, the command php artisan firefly:verify will check for, and fix this particular problem.

@JC5 JC5 self-assigned this Dec 10, 2017
@JC5 JC5 added bug Verified and replicated bugs and issues. fixed Bugs that are fixed (in a coming release). labels Dec 10, 2017
@JC5 JC5 added this to the 4.6.12 milestone Dec 10, 2017
JC5 added a commit that referenced this issue Dec 10, 2017
@webence
Copy link
Author

webence commented Dec 10, 2017

They are not both positive, but they are both negative. The savings account is both negative and positive (which I did not alter the starting date of).

If I change either one of the entries to the positive number (so the other one is negative) this does not seem to work as FireFly keeps insisting the account is -2000

@JC5
Copy link
Member

JC5 commented Dec 10, 2017

I think I forgot to ask you to clear your cache, I apologize.

For each pair of transactions (paired by the transaction_journal_id) one entry must be positive, the other one must be negative. If you change this yourself, as this bug forces you to, it could be that Firefly III shows the negative amount instead of the positive amount. However, you should be able to remedy this using Firefly III (no longer needing to edit rows).

To make sure it works:

  • Edit the rows.
  • Run php artisan cache:clear

And then, you can fix the amount in Firefly III itself (and it should stick). Let me know if it works!

@webence
Copy link
Author

webence commented Dec 10, 2017

Keep forgetting there is a cache :-)

That works if the first entry is positive and the second is negative. Not the other way around.

@JC5
Copy link
Member

JC5 commented Dec 28, 2017

Closed to clean up the list. I'm assuming this is no longer an issue?

@JC5 JC5 closed this as completed Dec 28, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified and replicated bugs and issues. fixed Bugs that are fixed (in a coming release).
Projects
None yet
Development

No branches or pull requests

2 participants