cronjob set after first expired recurring invoice

Hi

I have for example this recurring invoice: http://screenshot.s.emp.re/0T0J2a1X3a1y
Next invoice was on 3th of February, but I just set the cronjob today.

Will that still generate the invoice for the 3th of this month?
And if not, how to correct?

Thx a lot,
Kristof Bernaert

No, it would probably use today’s date. I think you’d need to manually correct the invoice.

So the cronjob runs only on the date equal to the recurring date of an recurring invoice? Right?
Does the Cronjob only looks at the date or also the time?

The cron will send any invoices that need be sent by today, it will send past invoices which should have already been sent.

It only looks at the date.

the cron only sends? or also generates and then sends the new invoice?

seems the cron is only doing the sending of an already existing new created recurring invoice: “2017-02-13 Running SendRecurringInvoices…”

how is the recurring invoice created? Manually?

The cron creates and sends the invoice.

I have for example this: http://screenshot.s.emp.re/0f2v1b1n1r2t

I just ran the cron successfully, but no invoice is created …

Is the invoice still a draft?

No: http://screenshot.s.emp.re/0I1D1V3p353w

Not sure, is your timezone correct on /settings/localization

Yes. Also when I see the cronlog, I see the cron executed successfully

What’s the full output of the cron?

Feb 13 14:46:02 com-linssh013.srv.combell-ops.net CRON daemon: Executing (12825) ‘/usr/bin/php /data/sites/web/itwebofficenetyyy/subsites/production-iwo/beach.sempre.blue/www/artisan ninja:send-invoices’
Feb 13 14:46:02 com-linssh013.srv.combell-ops.net CRON daemon: 1 processes running
Feb 13 14:46:06 com-linssh013.srv.combell-ops.net CRON daemon: 2017-02-13 Running SendRecurringInvoices…
Feb 13 14:46:07 com-linssh013.srv.combell-ops.net CRON daemon: Executed (12825) ‘/usr/bin/php /data/sites/web/itwebofficenetyyy/subsites/production-iwo/beach.sempre.blue/www/artisan ninja:send-invoices’

Is that all of the output? I’d expect to see how many invoices the script found.

https://github.com/invoiceninja/invoiceninja/blob/master/app/Console/Commands/SendRecurringInvoices.php#L64

You may want to echo the where SQL and try to run it manually against your db.

SELECT * FROM invoices WHERE is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND is_public IS TRUE AND frequency_id > 0 AND start_date <= 20170213 AND (end_date IS NULL OR end_date >= 20170213)

This Query resulted in all (monthly & yearly) recurring invoices.

(how is distinction made between monthly recurring and yearly?)

The frequency_id designates monthly versus yearly invoices.

Is there more to the output? Maybe try running the artisan command manually from the command line.

executed from command line: ‘artisan ninja:send-invoices’

nothing happens, without any output, nor error messages

Try: php artisan ninja:send-invoices from the root folder of the application.

That worked!
Output: http://screenshot.s.emp.re/3e2T1R1D2m30

The invoices are created but remain draft and are not sent.

Are there any errors in your logs in storage/logs/laravel-error.log