mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Fixes for quote/credit events
This commit is contained in:
parent
0f393c5691
commit
6c1a189a81
@ -605,7 +605,7 @@ class CreditController extends BaseController
|
||||
// code...
|
||||
break;
|
||||
case 'mark_sent':
|
||||
$credit->service()->markSent()->save();
|
||||
$credit->service()->markSent(true)->save();
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->itemResponse($credit);
|
||||
@ -646,7 +646,7 @@ class CreditController extends BaseController
|
||||
EmailEntity::dispatch($invitation, $credit->company, 'credit');
|
||||
});
|
||||
|
||||
$credit->sendEvent(Webhook::EVENT_SENT_CREDIT, "client");
|
||||
// $credit->sendEvent(Webhook::EVENT_SENT_CREDIT, "client");
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message'=>'email sent'], 200);
|
||||
|
@ -47,12 +47,9 @@ class CreditEmailedNotification implements ShouldQueue
|
||||
foreach ($event->invitation->company->company_users as $company_user) {
|
||||
$user = $company_user->user;
|
||||
|
||||
// $notification = new EntitySentNotification($event->invitation, 'credit');
|
||||
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'credit', ['all_notifications', 'credit_sent', 'credit_sent_all', 'credit_sent_user']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false) {
|
||||
// if (($key = array_search('mail', $methods))) {
|
||||
unset($methods[$key]);
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
|
@ -28,7 +28,7 @@ class MarkSent
|
||||
$this->credit = $credit;
|
||||
}
|
||||
|
||||
public function run()
|
||||
public function run($fire_event = false)
|
||||
{
|
||||
/* Return immediately if status is not draft */
|
||||
if ($this->credit->status_id != Credit::STATUS_DRAFT) {
|
||||
@ -52,8 +52,14 @@ class MarkSent
|
||||
|
||||
event(new CreditWasMarkedSent($this->credit, $this->credit->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
$this->credit->sendEvent(Webhook::EVENT_SENT_CREDIT);
|
||||
if($fire_event) {
|
||||
|
||||
event('eloquent.updated: App\Models\Credit', $this->credit);
|
||||
$this->credit->sendEvent(Webhook::EVENT_SENT_CREDIT);
|
||||
|
||||
}
|
||||
|
||||
return $this->credit;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class MarkSent
|
||||
{
|
||||
}
|
||||
|
||||
public function run()
|
||||
public function run($first_event = false)
|
||||
{
|
||||
/* Return immediately if status is not draft */
|
||||
if ($this->quote->status_id != Quote::STATUS_DRAFT) {
|
||||
@ -47,8 +47,13 @@ class MarkSent
|
||||
|
||||
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
$this->quote->sendEvent(Webhook::EVENT_SENT_QUOTE, "client");
|
||||
if($first_event) {
|
||||
|
||||
event('eloquent.updated: App\Models\Quote', $this->quote);
|
||||
$this->quote->sendEvent(Webhook::EVENT_SENT_QUOTE, "client");
|
||||
}
|
||||
|
||||
return $this->quote;
|
||||
|
||||
}
|
||||
}
|
||||
|
18733
composer.lock
generated
Normal file
18733
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user