mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
Add triggered actions to recurring invoices
This commit is contained in:
parent
fb7f44615d
commit
bd6e6a959a
@ -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->next_send_date = Carbon::parse($recurring_invoice->next_send_date)->startOfDay()->addSeconds($offset);
|
||||||
$recurring_invoice->save();
|
$recurring_invoice->save();
|
||||||
|
|
||||||
|
$recurring_invoice->service()
|
||||||
|
->triggeredActions($request)
|
||||||
|
->save();
|
||||||
|
|
||||||
return $this->itemResponse($recurring_invoice);
|
return $this->itemResponse($recurring_invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class StoreRecurringInvoiceRequest extends Request
|
|||||||
if (isset($input['auto_bill'])) {
|
if (isset($input['auto_bill'])) {
|
||||||
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
|
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
|
||||||
} else {
|
} 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'] = $client->getSetting('auto_bill');
|
||||||
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
|
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,20 @@ class RecurringService
|
|||||||
return $this;
|
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()
|
public function fillDefaults()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user