Can't import postal codes

Hey there
I’m on a self-hosted v5.1.70-C51.

I noticed a very weird behavior when importing customer details with a CSV: I tried several times (on two completely different installations), but I can’t import postal numbers, they’ll just stay blank.
I imported them as “Postal Code - Client”. Even if I add them manually in the client section, I can’t display the postal code using $client.postal_code. When I try $client_address, it displays the correct client street, but the company’s postal code and city.
Any idea how to fix that? Thanks a lot!


Thanks for reporting this!

cc @david

just to be clear, it looks like you are describing two problems?

  1. the csv import isn’t picking up the postal_code
  2. you cannot use the $client.postal_code variable to display the postal code.

#2 i’ve checked in a fix for, please confirm #1

hey David
That’s correct, apologies for mixing it up. Thank a lot for the fix!

Hi David
I still can replicate this bug on v5.2.9-C52.
I tried several times, but it still doesn’t import postal codes from a CSV file.

@david just want to make sure you saw this

1 Like

Hey @david, did you see this? :slight_smile:


Yep I see it, unfortunately I haven’t had time to look at this one yet.

1 Like

not sure how far out a fix is for this. if you are interested i can upload the tools i have made to correct the data in clients, and client_contacts.

i was missing phone, postal code, country id in clients and
fname, lname, postal code, phone, custom1, custom2, countryid from client_contacts

it’s by no means ready for prime time. i didn’t make anything to import their csv’s as i was just using phpmiadmin to do the basic importing and exporting.

i still used the import within invoice ninja to put them populate the DB.

this just matches the name with the import and client in DB and fills in what’s missing.

step 1 is just getting client id from ninja
step 2 is updating client table
step 3 is updating client contacts table
step 4 just calculates balance or invoice import lacking balance, but has amount and payment amount.
step 5 checks all invoices to be imported to make sure there is a matching client name in ninja.

step 6 isn’t done. it’ll seek out the matching invoice number and fill that info. shouldn’t take long to adapt step 2 or 3 to do this.

ill be working on getting the missing amount, payment amount and balance in the invoices table in the morning.

1 Like

can you supply a example.csv that you are importing? so i can see what ninja is looking for.

1 Like

i meant for david or hillel to send a example csv if u send it change name to john doe, 123 mainstreet, sometown, somestate.

1 Like


I believe we have sample in a test suite here:

1 Like

is there a way to refresh the caching after editing the database.invoices directly? the invoices show up properly in the customer portal but not the backend.

you’ll want to increment the updated_at column in which ever row/table you have modified this is what triggers the incremental data to be sent to the backend.

1 Like

thank you very much, i will make an edit in the backend gui and see how the updated_at changes.

i got the invoices to import correctly without entering a payment.
the problem is i see a bunch of payments generated for 0.00 for the invoices.

can the tables payments,paymenttables be emptied of the 0.00 payments generated from importing invoices.

or is there a way to stop the payment generation on invoice imports.

i have payment data that is separate and would like to retain that data.


I would assume that the import will only apply a payment if the invoice row contains some payment specific data?

V 5.2.17-C56
the csv file containing the invoices does not even contain any payment data. all unnecessary columns are removed to help with processing the CSV

invoice amount is correct and line items are added fine. there is no input to fields of: paid, date-payment or amount-payment.

i have tried with and without balance at same as amount, and no input to balance.
i have also tried inputting to “paid” with 0.00 and leaving paid blank.

the payment generated has an amount of 0.00, the invoice number is referenced, and the current date is used for payment date.


I’m going to spend some time on this, are you able to DM me a redacted copy of your .csv that you are trying to import

now i can’t seem to get logged in. and this error shows up

4 core VM runs at 25% cpu usage for a while, and i am not able to login.

TimeoutException after 0:00:30.000000: Future not completed