Migrating data due to bug install

I have never had so many problems with an software. Opensource or not.

Every day I have new problems and I look to update it to see if the issue goes away. Sometimes it goes but creates new issues.

Some of the problems I have had so far:
-On selective invoices, the client click pay in the partial and nothing happens.
-Creating an invoice, I hit save and created a draft but nothing changes in my screen.
-Creates repeated invoices in the recurring invoicing generator.
-Process the payment on Stripe but does not apply to the invoice automatically and sometimes not at all.
-And so many other issues.

Sadly I need other staff of the business to access and have limited access to creating quotes and invoices. Otherwise, I would say never InvoiceNinja.

I am now going to start a new install because the installation is such a mess. The invoice number is already on nearly 100 and I haven’t issued 20 invoices.

Do yo have a tool to migrate the selective data between installations of IN5?

For the instance, look at this client balance.

I have only issued 1 invoice to this customer, and he paid it in full. Why is the balance -236.70?

If I find a solution that does what I need, I will happy pay for it.

Which version are you using on the invoiceninja.com? v4 or v5? I guess it is the v4.


@david any thoughts on this issue?

The migration data could appear weird if there was previous actions performed to the invoice, The migration also takes into consideration, negative payments, credits which could affect the client balance.

Hi David,

The problem was in the original installation. I have now made a new and fresh installation which I will selectively import the data.

I have written a quick and dirty PHP script to import the clients from one installation to the other one, which I am sharing below for the sake of the community

1 <?php
3 $pages=13; //In my case I had 13 pages to import since the API replies back in lots of 20 clients.
4 $secret = ‘**********’; //Same secret for both installs.
5 $tokenOld = “Your token here of the original install”;
8 function upload($payload){
9 $tokenNew = ‘Your token here of the new install’;
10 $curl = curl_init();
11 $opts = [
12 CURLOPT_URL => ‘https://new.your.url/api/v1/clients’,
15 CURLOPT_POST => true,
17 ‘Content-Type: application/json’,
18 'X-API-TOKEN: '. $tokenNew,
19 ],
20 CURLOPT_POSTFIELDS => json_encode($payload)
21 ];
22 curl_setopt_array($curl, $opts);
23 $response = curl_exec($curl);
24 }
26 for( $i=1 ; $i<=$pages ; $i++ ){
27 $curl = curl_init();
28 $url = “https://old.your.url/api/v1/clients?page=$i”;
29 $opts = [
30 CURLOPT_URL => $url,
35 ‘accept: application/json’,
36 'X-Api-Secret: '.$secret,
37 'X-Api-Token: '.$tokenOld,
38 ‘X-Requested-With: XMLHttpRequest’
39 ],
40 ];
41 curl_setopt_array($curl, $opts);
42 $response = json_decode(curl_exec($curl));
43 curl_close($curl);
44 $array = $response->data;
45 foreach($array as $client){
47 upload($client);
48 sleep(1); // Optional, just in case your server mistaken the requests as a false positive.
49 }
50 }
51 ?>

Now I will import the invoices and apply the manual payment to them. Hopefully, everything will be in order from now on.

Is there a reason you aren’t using the migration tool built into the v4 app?

I don’t believe this script will work due to differences between v4 and v5.

Hi Hillel,

I may not have made myself clear. Sorry for the confusion.

I started on Ninja v5 and the migration is from an INV5 to another INV5. I can’t migrate the whole database because it is a mess, so I going to export and import only what I want.