GnuCash
Contact   Instructions
Bug 794767 - Dates default to 01/01/1970
Summary: Dates default to 01/01/1970
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: General (show other bugs)
Version: 2.7.x
Hardware: Other Linux
: Normal major
Target Milestone: ---
Assignee: general
QA Contact: general
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-28 10:52 EDT by François Guerraz
Modified: 2018-04-14 12:50 EDT (History)
5 users (show)

See Also:


Attachments
global options (3.50 KB, text/plain)
2018-04-01 16:04 EDT, François Guerraz
no flags Details

Description François Guerraz 2018-03-28 10:52:55 EDT
On 2.7.8, dates default to 01/01/1970 instead of the date of the current day (for example in Business -> Vendor -> New invoice).

Then even if the date is set properly, the reports stubbornly display that default date, for example:

Invoice Date: 	01/01/1970
Due Date: 	01/01/1970
Comment 1 John Ralls 2018-03-29 16:13:34 EDT
Can't reproduce, Debian 9 x86_64. (BTW it's either Vendor->New Bill or Customer->New Invoice, not that that matters). We have seen timezone issues like this in the past, though, so what TZ are you in?
Comment 2 François Guerraz 2018-03-30 06:25:53 EDT
I'm in the BST time zone, on arch linux
Comment 3 John Ralls 2018-03-30 09:46:18 EDT
That's British Standard Time?
Comment 4 François Guerraz 2018-03-30 10:13:27 EDT
It is indeed, sorry if that was ambiguous.
Comment 5 Geert Janssens 2018-03-31 09:19:14 EDT
Would this be a symptom of the issue reported in bug 794730 ? 01/01/1970 equals time64=0, which used to be taken as the invalid date in 2.6 and before, but no longer is on 2.7 and up. However parts of the code still test on this value to check whether a date was set.

For bug 794730 John fixed this yesterday for the business invoice post window though you report it for New Bill/New Invoice.
Comment 6 François Guerraz 2018-03-31 09:58:54 EDT
Since the fix of bug 794730, date in reports is shown properly after the invoice is posted.
However, I still get 01/01/1970 for new invoices by default and in printouts of unposted invoices.
Comment 7 Christopher Lam 2018-03-31 11:27:52 EDT
Francois: I'm hacking scheme ie the reporting infrastructure.

Would you mind letting me know if you're using latest unstable? Which invoice template are you using - Printable Invoice, Easy Invoice, Fancy Invoice, Tax Invoice, Australian Tax Invoice? The posted/unposted invoice logic was recently changed - it was formerly testing date = MAXINT, now it is testing if the invoice has a posted account. Perhaps your invoice has an erroneous posted account?

Would you mind reviewing your AP account? If the invoice transaction exists, which date is the transaction set at?

On my current unstable in GMT+8 I have no issue. All dates ie posted/due/current are as expected.
Comment 8 François Guerraz 2018-03-31 14:18:39 EDT
Hi Chris,

I'm using the latest unstable indeed. I'm using the Tax invoice report and now I'm only seeing the problem when the invoice is not posted, so not in A/R yet.

I'm also seeing the problem when I go Business -> Customer -> New invoice or Business -> Vendor -> New bill. The date field in the dialogue is 01/01/1970.
Comment 9 Christopher Lam 2018-03-31 18:24:28 EDT
The Tax Invoice (and other tax reports) logic should be sound - if invoice is in AP/AR account, then display posted + due date; if it doesn't then display "Invoice in progress...". Other bug reporters have submitted screenshots/videos; would you mind sharing?
Comment 10 François Guerraz 2018-04-01 03:33:41 EDT
Here it is, with the test case from bug 794730

https://drive.google.com/open?id=1OklRWhlCtghKBUaPa74AdS0dbfYfDstY
Comment 11 Christopher Lam 2018-04-01 11:30:41 EDT
Hi Francois - I've downloaded the small Test case (7.36 KB) and found your invoice #0002, and everything checks out fine from my end. My locale is en_AU.UTF-8.

May I suggest a clean rebuild and retest? Something is certainly odd from your video.

@Jralls it would be an interesting debug tool to dump all global options, such as I've done in gnc:render-options-changed - are you aware any tool?
Comment 12 John Ralls 2018-04-01 15:55:30 EDT
What do you mean by "Global Options"? The preferences? There's a tool for that on MacOS, "defaults read -a Gnucash". Gnome Desktop probably has something similar. Windows is harder because GSettings puts everything in the Registry.
Comment 13 François Guerraz 2018-04-01 16:04:48 EDT
Created attachment 370423 [details]
global options

In case that's what you want, this is the gsettings dump

$ gsettings list-recursively org.gnucash
Comment 14 François Guerraz 2018-04-01 16:25:49 EDT
Also I've tried with a fresh user account and the problem persists. Same with your locale.
Comment 15 Christopher Lam 2018-04-02 10:26:01 EDT
Then I'm stumped; the datafile seems fine; I can't see how reports in current unstable can fail to identify the invoice as unposted; there must be something amiss in running gncInvoiceIsPosted in gncInvoice.c
Comment 16 Christopher Lam 2018-04-05 14:24:51 EDT
Francois would you be comfortable replacing .scm files with customized debug ones?
Comment 17 François Guerraz 2018-04-05 14:38:10 EDT
Of course, I could even provide remote access for you if you want, but it happens on both my arch machines, so I presume you could try by yourself.
Comment 18 Christopher Lam 2018-04-08 10:47:16 EDT
Francois - we were discussing on IRC - perhaps try the following change to gncInvoice.c as a test to determine if our (warlord geert and I) theory was sound? If you prefer the .scm equivalent I'll need to construct and come back!

libgnucash/engine/gncInvoice.c
@@ -1859,7 +1859,7 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn,
 gboolean gncInvoiceIsPosted (const GncInvoice *invoice)
 {
     if (!invoice) return FALSE;
-    return GNC_IS_ACCOUNT(gncInvoiceGetPostedAcc(invoice));
+    return GNC_IS_TRANSACTION(gncInvoiceGetPostedTxn(invoice));
 }
 
 gboolean gncInvoiceIsPaid (const GncInvoice *invoice)
Comment 19 Christopher Lam 2018-04-12 03:04:08 EDT
I've just been checking the branches regarding gncInvoiceIsPosted logic:

2.7.8 was testing if posted-date = MAXINT
3.0 and unstable are currently testing if posted-acc = null
we're considering testing if posted-txn = null

Francois - can you confirm this bug still exists in latest unstable or 3.0 as pulled from current github? Because your datafile confirms the posted-date=0, and the date would be displayed as 01/01/1970 on 2.7.8, but should not be displayed in unstable.
Comment 20 François Guerraz 2018-04-12 04:43:59 EDT
Hi, sorry for not getting back to you earlier, I'm on a business trip.

Non-posted invoices do not show the 1970 date any more on 3.0.
However, the default date for new invoices or bills is still showing the issue.
Comment 21 Christopher Lam 2018-04-13 20:31:57 EDT
Ok in case there's any doubt, I don't think there's any issue with the report logic anymore.

There are a few other 01-01-1970 dates in UI; some were related to timezones, or DST changes; others due to invalid dates eg year incorrectly entered as 0206. I'm afraid I can't help myself.
Comment 22 Geert Janssens 2018-04-14 12:34:25 EDT
(In reply to John Ralls from comment #12)
> What do you mean by "Global Options"? The preferences? There's a tool for
> that on MacOS, "defaults read -a Gnucash". Gnome Desktop probably has
> something similar. Windows is harder because GSettings puts everything in
> the Registry.

On linux that would be
dconf dump /org/gnucash/
Comment 23 Geert Janssens 2018-04-14 12:38:01 EDT
Oh and the gsettings trick should work as well.
Comment 24 Geert Janssens 2018-04-14 12:50:39 EDT
The default date was effectively still using the wrong test to determine what date to offer.
I have fixed the test to properly detect invalid dates.
The invoice dates should now default again to today.

Thanks for reporting this.

Note: I have also changed the test for the post state as suggested in comment 19
which should also fix a slew of subtle and less subtle side effects.

Will be in gnucash 3.1.

Note You need to log in before you can comment on or make changes to this bug.