Recurring invoices not being sent (yet?)

Hi,

I just created my first bunch of recurring invoices. They are all sitting pretty in Invoice Ninja with status “Pending”. Running the cron job manually doesn’t find any recurring invoices though. The time zone is NZDT (New Zealand); UTC is 13 hrs behind.

www-data@w9:~$ date
Wed Dec 5 12:26:08 NZDT 2018

www-data@w9:~$ /usr/bin/php /var/www/clients.omiha.com/artisan ninja:send-invoices
Tue, 04 Dec 2018 23:26:16 +0000 Running SendRecurringInvoices…
Tue, 04 Dec 2018 23:26:16 +0000 0 recurring invoice(s) found
Tue, 04 Dec 2018 23:26:16 +0000 0 recurring expenses(s) found
Tue, 04 Dec 2018 23:26:16 +0000 Done
www-data@w9:~$

MariaDB [invoiceninja]> select start_date, last_sent_date from invoices;
±-----------±---------------+
| start_date | last_sent_date |
±-----------±---------------+
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2019-10-01 | NULL |
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2018-12-05 | NULL |
| 2019-02-01 | NULL |
| NULL | 2018-12-04 |
±-----------±---------------+
11 rows in set (0.00 sec)

I have specified the correct time zone (Pacific/Auckland) in both /etc/php/7.0/cli/php.ini and /etc/php/7.0/apache2/php.ini. I’ve also selected the correct time zone in Settings - Localization.

I expect that this all will work in the afternoon but wonder how I can tell php and/or artisan to use the local time instead of UTC as presumably that is why the recurring invoices haven’t been found yet.

Any suggestions?

Jan

Were the invoices sent, I think the app expects the servers to be UTC.

Hi Hillel,

Thanks for the reply.

The invoices were sent in the afternoon as expected. The server’s hardware clock is set to UTC but of course the local time depends on the time zone. Maybe something for the wish list? Easy enough to work around it but there may be other parts of the software where an accurate local time is more important.

regards,
Jan

Dear Hillel:

Once before, recurring used to work perfectly. Is the timezone really what causes recurring invoicing to not work? Current I am using self-hosted v4.5.23 and invoices do not send automatically. They wouldn’t send on the prior version either, v4.5.21 (I think). I will attempt changing the timezone to UTC but not sure if that’s the issue since I continue to get the following error when manually activating the cron job:

Thu, 04 Mar 2021 15:38:58 +0000 Running SendRecurringInvoices…

In Account.php line 1126:

Unparenthesized a ? b : c ?: d is deprecated. Use either (a ? b : c) ?: d or a ? b : (c ?: d)

I will report back after changing the timezone to UTC and checking the cron job again.

Thanks,
Calvin

Hi,

It looks like you may be using PHP 7.4 for the CLI, changing to PHP 7.3 should help.

FYI… Self-Hosted version v4.5.23 - Setting PHP Timezone to UTC does not work. Still received the same error when manually running cronjob to test Send Recurring Invoices. This is in a shared hosting environment.

Thu, 04 Mar 2021 16:08:31 +0000 Running SendRecurringInvoices…

In Account.php line 1126:

Unparenthesized a ? b : c ?: d is deprecated. Use either (a ? b : c) ?: d or a ? b : (c ?: d)

@hillel Thank you for the feedback. Though my application is using PHP 7.3, the overall server is using PHP 7.4. We’ll make the change for the overall server setting to PHP 7.3 and report back.

Thanks,
Calvin