1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Add triggered actions to recurring invoices

This commit is contained in:
David Bomba 2021-10-13 16:41:11 +11:00
parent fb7f44615d
commit bd6e6a959a
3 changed files with 19 additions and 1 deletions

View File

@ -210,6 +210,10 @@ class RecurringInvoiceController extends BaseController
$recurring_invoice->next_send_date = Carbon::parse($recurring_invoice->next_send_date)->startOfDay()->addSeconds($offset);
$recurring_invoice->save();
$recurring_invoice->service()
->triggeredActions($request)
->save();
return $this->itemResponse($recurring_invoice);
}

View File

@ -105,7 +105,7 @@ class StoreRecurringInvoiceRequest extends Request
if (isset($input['auto_bill'])) {
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
} else {
if ($client = Client::find($input['client_id'])) {
if (array_key_exists('client_id', $input) && $client = Client::find($input['client_id'])) {
$input['auto_bill'] = $client->getSetting('auto_bill');
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
}

View File

@ -97,6 +97,20 @@ class RecurringService
return $this;
}
public function triggeredActions($request)
{
if ($request->has('start') && $request->input('start') == 'true') {
$this->start();
}
if ($request->has('stop') && $request->input('stop') == 'true') {
$this->stop();
}
return $this;
}
public function fillDefaults()
{