mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for updateinvoice events
This commit is contained in:
parent
dff9c9566c
commit
69a1419e9b
@ -733,7 +733,7 @@ class InvoiceController extends BaseController
|
||||
}
|
||||
break;
|
||||
case 'mark_sent':
|
||||
$invoice->service()->markSent()->save();
|
||||
$invoice->service()->markSent(true)->save();
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->itemResponse($invoice);
|
||||
|
@ -175,9 +175,9 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function markSent()
|
||||
public function markSent($fire_event = false)
|
||||
{
|
||||
$this->invoice = (new MarkSent($this->invoice->client, $this->invoice))->run();
|
||||
$this->invoice = (new MarkSent($this->invoice->client, $this->invoice))->run($fire_event);
|
||||
|
||||
$this->setExchangeRate();
|
||||
|
||||
|
@ -30,7 +30,7 @@ class MarkSent extends AbstractService
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
public function run($fire_webhook = false)
|
||||
{
|
||||
|
||||
/* Return immediately if status is not draft or invoice has been deleted */
|
||||
@ -68,6 +68,10 @@ class MarkSent extends AbstractService
|
||||
|
||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
if($fire_webhook)
|
||||
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
||||
|
||||
|
||||
return $this->invoice->fresh();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class TriggeredActions extends AbstractService
|
||||
|
||||
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true' && $this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||
$this->invoice = $this->invoice->service()->markSent()->save(); //update notification NOT sent
|
||||
$this->updated = true;
|
||||
$this->updated = false;
|
||||
}
|
||||
|
||||
if ($this->request->has('amount_paid') && is_numeric($this->request->input('amount_paid'))) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<!-- Error: {{ session('error') }} -->
|
||||
@if ($company && $company->matomo_url && $company->matomo_id)
|
||||
@if (isset($company) && $company->matomo_url && $company->matomo_id)
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
|
Loading…
Reference in New Issue
Block a user