Can't import clients.csv with 1 row

I have a csv with one row.
I only fill two columns : client_name and client_active

When I import I got the following error :

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: models/Mdl_import.php

Line Number: 384

Backtrace:

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/models/Mdl_import.php
Line: 384
Function: _error_handler

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/controllers/Import.php
Line: 82
Function: record_import_details

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/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 /home/pacificw/domains/pacificweb.ca/public_html/gestion/vendor/codeigniter/framework/system/core/Exceptions.php:271)

Filename: helpers/url_helper.php

Line Number: 564

Backtrace:

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/controllers/Import.php
Line: 105
Function: redirect

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/index.php
Line: 327
Function: require_once

I don’t understand why it failed :sob:

Can you send a csv example file, with a few fake entries, so I don’t have to create it from zero myself?

Hi musa,

Of course, I try with one entry, I keep it simple as possible but it failed.

You can download the csv from this URL

http://www.pacificweb.ca/public/clients.csv

Thanks

Thank you.
You will need to edit your file application/modules/import/models/Mdl_import.php and paste this instead: https://pastebin.com/raw/Hth6g4zr

1 Like

Hello musa, I have applied the modification but unfortunately I still have the same bug

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: models/Mdl_import.php

Line Number: 385

Backtrace:

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/models/Mdl_import.php
Line: 385
Function: _error_handler

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/controllers/Import.php
Line: 82
Function: record_import_details

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/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 /home/pacificw/domains/pacificweb.ca/public_html/gestion/vendor/codeigniter/framework/system/core/Exceptions.php:271)

Filename: helpers/url_helper.php

Line Number: 564

Backtrace:

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/application/modules/import/controllers/Import.php
Line: 105
Function: redirect

File: /home/pacificw/domains/pacificweb.ca/public_html/gestion/index.php
Line: 327
Function: require_once

Sorry I forgot to tell you to remove the extra space after “client_active” as well, first line of your csv file, at the very end.

1 Like

Flawless musa! damn space at the end grrrr :confounded:
I am moving from woocommerce to invoiceplane
Thank you very much for you support !!!