Importing invoices, items, and payments

I successfully imported clients, but I can’t get anything else to import.

If I import my csv files one at a time, Invoice plane just goes back to the Import window and says 0 items were imported.

![50|690x33]

If I try importing all three at once, I get

A PHP Error was encountered
Severity: Warning

Message: fopen(./uploads/import/invoices.csv): failed to open stream: Permission denied

Filename: models/Mdl_import.php

Line Number: 167

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 167
Function: fopen

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 86
Function: import_invoices

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: fgetcsv() expects parameter 1 to be resource, boolean given

Filename: models/Mdl_import.php

Line Number: 177

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 177
Function: fgetcsv

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 86
Function: import_invoices

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: fopen(./uploads/import/invoice_items.csv): failed to open stream: Permission denied

Filename: models/Mdl_import.php

Line Number: 249

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 249
Function: fopen

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 92
Function: import_invoice_items

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: fgetcsv() expects parameter 1 to be resource, boolean given

Filename: models/Mdl_import.php

Line Number: 259

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 259
Function: fgetcsv

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 92
Function: import_invoice_items

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: fopen(./uploads/import/payments.csv): failed to open stream: Permission denied

Filename: models/Mdl_import.php

Line Number: 322

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 322
Function: fopen

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 98
Function: import_payments

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: fgetcsv() expects parameter 1 to be resource, boolean given

Filename: models/Mdl_import.php

Line Number: 330

Backtrace:

File: /var/www/html/application/modules/import/models/Mdl_import.php
Line: 330
Function: fgetcsv

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 98
Function: import_payments

File: /var/www/html/index.php
Line: 327
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/codeigniter/framework/system/core/Exceptions.php:271)

Filename: helpers/url_helper.php

Line Number: 564

Backtrace:

File: /var/www/html/application/modules/import/controllers/Import.php
Line: 105
Function: redirect

File: /var/www/html/index.php
Line: 327
Function: require_once


Here are the first few lines of each:

Invoice items:

invoice_number,item_tax_rate,item_date_added,item_name,item_description,item_quantity,item_price
100,2012-02-04,Appointment,1,400
101,2012-02-04,Appointment,1,600

Invoices:

user_email,client_name,invoice_date_created,invoice_date_due,invoice_number,invoice_terms
techie.peet@gmail.com,Jan Eliasberg,2012-08-27,290,
techie.peet@gmail.com,Jan Eliasberg,2012-08-31,292,

Payments:

invoice_number,payment_method,payment_date,payment_amount,payment_note
100,Cheque,2012-02-04,400,
101,Cheque,2012-02-04,600,

Please make sure that the corresponding file is readable by the web server.

I CHMOD’ed the invoices.csv to 777 and get the same problem - I hit import, it goes back to the Import screen and reports 0 invoices were imported.

I guess there’s nothing I can do? Is importing just broken?

I think so. Ticket is open for quite a while now
https://development.invoiceplane.com/browse/IP-510

Here are the CSVs that gave me those errors:

1 Like

Thanks

If others have some CSV to upload please feel free but please DO NOT upload a file with sensitive data !!!

I will see what I can do (but can’t promise it will be done soon as I’m on holidays very soon so I don’t have much time)

Regards,

Thanks Maxime - no sensitive data in those that I uploaded. No email addresses, mailing addresses, financial information, nothing.

Thanks @peet but @Kovah deleted it before I had time to download it haha (prevention to be sure no sensitive data are uploaded I’m sure!) :stuck_out_tongue:
Can you please re-upload it ? (or edit your post)

Regards,

Ok, just looked like a lot of client information but if you state there’s no sensitive data I will restore your post.

1 Like

@peet
I made some changes and your file is importing well without any errors

Can you guys please upload more files ?

What changes did you have to make? What was wrong with my CSV files?

I have make some changes into the import process and your CSV file (at least invoices and payments) get a problem with the header (I don’t know why ? Maybe a problem with the encoding/save) which has a length (only for the first column) of 13 instead of 10 so I remade the CSV on my own with your data and it works (but changes in the code are necessary)

That’s why I need more CSV to test everything is working like expected

Can other people on here please upload your CSV files so the sample size is bigger?

I’ve pushed the fix, it will be maybe added in the next release version (v1.5.6) but it can contains bugs as I don’t have any sample data. Anyway as it doesn’t work now if it doesn’t work with the fix it won’t change anything :smiley:

Regards,

1 Like

I have just installed IP 1.5.9 - but when I press “new” on the import page, an import button is displayed with no ability to choose a file. Pressing the import button a record is displayed as if something is uploaded.

Seems to be a bug.

I am a software developer and know a bit of PHP - is there a thread or I assume bug tracker - maybe I can contribute. We are evaluating IP for the base of our company’s core functions, and work and a git repository, but I am struggling to see where the central project is located. I would like to contribute.

Any feedback on the bug (or my lack of understanding how to make this work) would be great.

1 Like

Your contribution to the project will be welcome by everyone - https://development.invoiceplane.com/secure/Dashboard.jspa

Follow the links here as well : https://invoiceplane.com/

1 Like

If you look at the code application/modules/import/controllers/Import.php you will see that that page displays a file listing from the “uploads/import” directory and displays a checkbox for you to select. It would make sense to display a message saying there were no imports found.

I have never worked with imports, but I guess that module needs a bit of love and attention.

1 Like

@shawnbure welcome, man! For version 1.5.9 (and 1.5.10 in master) base repo is invoiceplane/invoiceplane on github.
Bugtracker is on jira and general chat channels are on slack.
Howler if you need anything