Added deletedQuote subscription

This commit is contained in:
Hillel Coren 2016-12-19 20:06:30 +02:00
parent 5c891fa49e
commit 2f8344df66
2 changed files with 20 additions and 12 deletions

View File

@ -634,8 +634,6 @@ if (!defined('CONTACT_EMAIL')) {
define('EVENT_CREATE_QUOTE', 3); define('EVENT_CREATE_QUOTE', 3);
define('EVENT_CREATE_PAYMENT', 4); define('EVENT_CREATE_PAYMENT', 4);
define('EVENT_CREATE_VENDOR', 5); define('EVENT_CREATE_VENDOR', 5);
// Added new events
define('EVENT_UPDATE_QUOTE', 6); define('EVENT_UPDATE_QUOTE', 6);
define('EVENT_DELETE_QUOTE', 7); define('EVENT_DELETE_QUOTE', 7);
define('EVENT_UPDATE_INVOICE', 8); define('EVENT_UPDATE_INVOICE', 8);

View File

@ -3,6 +3,7 @@
use App\Events\InvoiceWasDeleted; use App\Events\InvoiceWasDeleted;
use App\Events\InvoiceWasUpdated; use App\Events\InvoiceWasUpdated;
use App\Events\QuoteWasUpdated; use App\Events\QuoteWasUpdated;
use App\Events\QuoteWasDeleted;
use Utils; use Utils;
use App\Models\EntityModel; use App\Models\EntityModel;
use App\Events\ClientWasCreated; use App\Events\ClientWasCreated;
@ -82,15 +83,6 @@ class SubscriptionListener
public function createdExpense(ExpenseWasCreated $event) public function createdExpense(ExpenseWasCreated $event)
{ {
}
/**
* @param QuoteWasUpdated $event
*/
public function updatedQuote(QuoteWasUpdated $event)
{
$transformer = new InvoiceTransformer($event->quote->account);
$this->checkSubscriptions(EVENT_UPDATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
} }
/** /**
@ -111,6 +103,24 @@ class SubscriptionListener
$this->checkSubscriptions(EVENT_DELETE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT); $this->checkSubscriptions(EVENT_DELETE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
} }
/**
* @param QuoteWasUpdated $event
*/
public function updatedQuote(QuoteWasUpdated $event)
{
$transformer = new InvoiceTransformer($event->quote->account);
$this->checkSubscriptions(EVENT_UPDATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
}
/**
* @param InvoiceWasDeleted $event
*/
public function deletedQuote(QuoteWasDeleted $event)
{
$transformer = new InvoiceTransformer($event->quote->account);
$this->checkSubscriptions(EVENT_DELETE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
}
/** /**
* @param $eventId * @param $eventId
* @param $entity * @param $entity