1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00

Fixes for subscription cron where URL/REST method is not set

This commit is contained in:
David Bomba 2023-01-18 13:24:08 +11:00
parent dedc1f5774
commit 55fec84e1d
2 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,7 @@ class SubscriptionCron
$invoices = Invoice::where('is_deleted', 0) $invoices = Invoice::where('is_deleted', 0)
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0) ->where('balance', '>', 0)
->where('is_proforma',0)
->whereDate('due_date', '<=', now()->addDay()->startOfDay()) ->whereDate('due_date', '<=', now()->addDay()->startOfDay())
->whereNull('deleted_at') ->whereNull('deleted_at')
->whereNotNull('subscription_id') ->whereNotNull('subscription_id')
@ -74,6 +75,7 @@ class SubscriptionCron
$invoices = Invoice::where('is_deleted', 0) $invoices = Invoice::where('is_deleted', 0)
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0) ->where('balance', '>', 0)
->where('is_proforma',0)
->whereDate('due_date', '<=', now()->addDay()->startOfDay()) ->whereDate('due_date', '<=', now()->addDay()->startOfDay())
->whereNull('deleted_at') ->whereNull('deleted_at')
->whereNotNull('subscription_id') ->whereNotNull('subscription_id')

View File

@ -27,6 +27,9 @@ trait SubscriptionHooker
'X-Requested-With' => 'XMLHttpRequest', 'X-Requested-With' => 'XMLHttpRequest',
]; ];
if(!isset($subscription->webhook_configuration['post_purchase_url']) && !isset($subscription->webhook_configuration['post_purchase_rest_method']))
return;
if (count($subscription->webhook_configuration['post_purchase_headers']) >= 1) { if (count($subscription->webhook_configuration['post_purchase_headers']) >= 1) {
$headers = array_merge($headers, $subscription->webhook_configuration['post_purchase_headers']); $headers = array_merge($headers, $subscription->webhook_configuration['post_purchase_headers']);
} }