Stopping Reoccurring Invoices

v5.0.41-C35

When I Create a Reoccurring Invoice, if I try and edit it (for eg from monthly to daily)
500: Server Error

If I try and delete it:
500: Server Error

And the bad part, If I logout and try and login:
500: Server Error

And then im completely locked out of I.N

Looking in storage/logs/laravel.log it is throwing an error:

[2020-12-30 08:34:16] production.ERROR: Call to a member function copy() on null {“userId”:1,“exception”:"[object] (Error(code: 0): Call to a member function copy() on null at /var/www/html/ninja/app/Models/RecurringInvoice.php:376)

Tried reinstalling and same result.

Hey there, thanks for reporting this to us.

@david any idea on this one?

I’ll look into this.

fix is in the v5-develop branch

Thanks David. I reinstalled v5.0.41-C35 on develop branch and confirmed following changes were present in InvoiceMigrationRepository.php

if($model instanceof RecurringInvoice)
$lcfirst_resource_id = ‘recurring_invoice_id’;

Still breaking for me.

Throwing same error:

production.ERROR: Call to a member function copy() on null {“userId”:1,“exception”:"[object] (Error(code: 0): Call to a member function copy() on null at /var/www/html/ninja/app/Models/RecurringInvoice.php:376)

Update as of v5.0.44-C37 testing:

On reoccurring invoices i can edit them and delete them now which would break things before.

But one issue still remains:
If i start the cycle, when i click stop it says “Successfully stopped reoccurring invoice” but it doesn’t look like it actually stopped it. Also the option to stop the reoccuring invoice is still there and you can click it again and it says “Successfully stopped reoccurring invoice”

@peterjm

Do you still see recurring invoices fire after you stop them?

Ill test this and see if they are actually stopped or its just cosmetic that the stop button doesn’t change back to start. I started 2 reoccurring daily invoice jobs and stopped one of them.

Heres a picture of one of the menu’s after I clicked stop and a message popped up saying it was successfully stopped.

  • Peter

@david
So although the 500 errors don’t show up anymore and it lets you delete / modify / start the reoccurring invoices now, i don’t think they are actually firing. Ive tried a couple of times after rebuilding the server and if i set to daily interval and click start, after a few days there are still no invoices. Im currently on v5.0.47-C38
Is there any other troubleshooting I can do for you?

Hi @peterjm, a couple of things to check.

  1. Have you configured the scheduler to run in the cron ( under the web user) ?
  2. Are there any records in the jobs table in the database.
  1. Cron tab file looks like default and i dont see any cron jobs?

  2. No records in jobs table that i can see. I see other records to do with emailing etc… but no change when i press start. The status in the GUI says ‘pending’.

I setup cron job and reoccurring invoices do seem to fire now (Testing in v5.0.53-C39) but when i click stop it still says ‘active’ in the GUI?
Ill see if the reoccuring invoice i clicked stop on fires again tomorrow on a daily job im testing with and let you know.

Hey there… David did some work that I think is related to this here:

https://github.com/invoiceninja/invoiceninja/issues/4814.

Can you please wait for the new release or opt-in in the v5-develop & see if it works?

Thanks!

@david @ben

Yes fixed now! It lets you click stop and changes status to ‘paused’.

Thanks David / Ben!

1 Like