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 756416 - CSV data with Posted information will always have last invoice not posted.
CSV data with Posted information will always have last invoice not posted.
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Import - CSV
2.6.9
Other Windows
: Normal normal
: ---
Assigned To: gnucash-import-maint
gnucash-import-maint
Depends on:
Blocks:
 
 
Reported: 2015-10-12 04:41 UTC by jpliew
Modified: 2018-06-29 23:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Step by step screen shots of the symptom and testinvoice.csv (127.02 KB, application/zip)
2015-10-12 23:35 UTC, jpliew
Details

Description jpliew 2015-10-12 04:41:35 UTC
When importing data from CSV, with all posted information filled,the last record will always not be posted.

For example, if I have 10 records in the CSV, all 10 records will be successfully imported, but only 9 will be posted, and 1 unposted, despite they are all the same data (except <id>).
Comment 1 Mike Evans 2015-10-12 13:57:49 UTC
It's unclear from your report what it is you are importing, there are several CSV import functions.  It would be helpful too if you provided an example file (suitably anonymised) that causes the problem.
Comment 2 jpliew 2015-10-12 23:35:58 UTC
Created attachment 313152 [details]
Step by step screen shots of the symptom and testinvoice.csv
Comment 3 jpliew 2015-10-12 23:41:57 UTC
Hi Mike,

Sorry for being brief. I have just attached screenshots and test csv file.

Below are the steps:

1. Before-Import.png shows the total Trade Receivable of $79,553.75

2. Import-Results.png shows total 6 lines imported, with 2 invoices created. (Total 2 invoice is $100)

3. After-Import.png shows the total Trade Receivable of $79,603.75, $50 less than the expected.

4. Invoice-Posted.png shows the correctly posted invoice, which is the first invoice in the CSV file.

5. Invoice-Not-Posted.ong shows the invoice not posted, which is the last invoice in the CSV file.

6. testinvoice.csv is the test data. 

I have tried many different combinations, it is always the last invoice that is not posted.

Please let me know if you need more details, I will try my best to generate.

Thanks
Comment 4 Mike Evans 2015-10-13 14:01:48 UTC
Thanks.  I'll take a look.  In the meantime can you make sure there's a newline at the end of the last line and try importing gain.  Just open the file and hit enter at the end of the line then save.  I seem to recall this causes issues.
Comment 5 jpliew 2015-10-14 03:44:36 UTC
Hi Mike,

Tested with 1 or multiple end of line, still the last invoice not posted.

On the confirmation screen, all line items were displayed properly, so I doubt it is end of line problem, the importer managed to read all the lines and presented a valid confirmation screen and moreover the result page also confirmed that all the lines were read. I could be wrong, just a blind guess that the problem is not caused by the end of line.

If you need more testing done, please let me know.

Cheers
Comment 6 Somnath Kundu 2016-07-12 11:45:17 UTC
Hello Mike, 

It seems this bug is not yet fixed as of GnuCash 2.6.13, which I am using now. Here is a sample csv file that you can test to reveal this bug.

----------------------
PP20150531U,31/05/2015,101,4D851261KD8468768,USD 73.96 @ 61.552,31/05/2015,ProductName,project,Income:Sales:Software,1,4552.36,$,<,0,,,,31/05/2015,15/06/2015,Assets:Accounts Receivable:PayPal,USD 73.96 @ 61.552,
PP20150628U,28/06/2015,101,1RTY0204757459890,USD 36.98 @ 61.435,28/06/2015,ProductName,project,Income:Sales:Software,1,2271.85,$,<,0,,,,28/06/2015,13/07/2015,Assets:Accounts Receivable:PayPal,USD 36.98 @ 61.435,
PP20150731U,31/07/2015,101,75HG947KFJ6229345,USD 36.98 @ 61.776,31/07/2015,ProductName,project,Income:Sales:Software,1,2284.47,$,<,0,,,,31/07/2015,15/08/2015,Assets:Accounts Receivable:PayPal,USD 36.98 @ 61.776,
PP20150831U,31/08/2015,101,BGG56870T75694563,USD 36.98 @ 63.804,31/08/2015,ProductName,project,Income:Sales:Software,1,2359.47,$,<,0,,,,31/08/2015,15/09/2015,Assets:Accounts Receivable:PayPal,USD 36.98 @ 63.804,

----------------------
You need to import these Invoices against a customer with ID 101, say, "PayPal,101,Addr1,Addr2,Phone".

Thank you for your attention and time.

Regards,
Somnath
Comment 7 Mike Evans 2016-07-12 13:16:55 UTC
I forgot all about this issue, thanks for the reminder, I'll take another look.
Comment 8 Mike Evans 2016-07-12 14:22:11 UTC
Committed to maint branch and will be in the next release which scheduled for 2016-09-24

When importing the last line of the CSV the gtk_tree_model_get() never happens
and the following compare uses the previous value of new_id, which is now = id,
so the last invoice is never posted.
    
Set new_id = Null before gtk_tree_model_get() to ensure processing the last line.
Comment 9 John Ralls 2018-06-29 23:43:50 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=756416. Please update any external references or bookmarks.