After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794767 - Dates default to 01/01/1970
Dates default to 01/01/1970
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
2.7.x
Other Linux
: Normal major
: ---
Assigned To: gnucash-general-maint
gnucash-general-maint
Depends on:
Blocks:
 
 
Reported: 2018-03-28 14:52 UTC by François Guerraz
Modified: 2018-06-30 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
global options (3.50 KB, text/plain)
2018-04-01 20:04 UTC, François Guerraz
Details

Description François Guerraz 2018-03-28 14:52:51 UTC
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 20:13:30 UTC
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 10:25:49 UTC
I'm in the BST time zone, on arch linux
Comment 3 John Ralls 2018-03-30 13:46:14 UTC
That's British Standard Time?
Comment 4 François Guerraz 2018-03-30 14:13:23 UTC
It is indeed, sorry if that was ambiguous.
Comment 5 Geert Janssens 2018-03-31 13:19:10 UTC
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 13:58:50 UTC
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 Chris 2018-03-31 15:27:48 UTC
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 18:18:35 UTC
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 Chris 2018-03-31 22:24:24 UTC
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 07:33:37 UTC
Here it is, with the test case from bug 794730

https://drive.google.com/open?id=1OklRWhlCtghKBUaPa74AdS0dbfYfDstY
Comment 11 Chris 2018-04-01 15:30:37 UTC
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 19:55:26 UTC
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 20:04:44 UTC
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 20:25:45 UTC
Also I've tried with a fresh user account and the problem persists. Same with your locale.
Comment 15 Chris 2018-04-02 14:25:57 UTC
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 Chris 2018-04-05 18:24:47 UTC
Francois would you be comfortable replacing .scm files with customized debug ones?
Comment 17 François Guerraz 2018-04-05 18:38:06 UTC
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 Chris 2018-04-08 14:47:12 UTC
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 Chris 2018-04-12 07:04:04 UTC
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 08:43:55 UTC
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 Chris 2018-04-14 00:31:53 UTC
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 16:34:21 UTC
(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 16:37:57 UTC
Oh and the gsettings trick should work as well.
Comment 24 Geert Janssens 2018-04-14 16:50:35 UTC
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.
Comment 25 John Ralls 2018-06-30 00:06:11 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=794767. Please update any external references or bookmarks.