1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop

This commit is contained in:
Hillel Coren 2016-12-16 15:18:24 +02:00
commit cfe35723ea
3 changed files with 39 additions and 1 deletions

View File

@ -633,7 +633,13 @@ if (!defined('CONTACT_EMAIL')) {
define('EVENT_CREATE_INVOICE', 2);
define('EVENT_CREATE_QUOTE', 3);
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_DELETE_QUOTE', 7);
define('EVENT_UPDATE_INVOICE', 8);
define('EVENT_DELETE_INVOICE', 9);
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID');

View File

@ -1,5 +1,8 @@
<?php namespace App\Listeners;
use App\Events\InvoiceWasDeleted;
use App\Events\InvoiceWasUpdated;
use App\Events\QuoteWasUpdated;
use Utils;
use App\Models\EntityModel;
use App\Events\ClientWasCreated;
@ -79,6 +82,33 @@ class SubscriptionListener
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);
}
/**
* @param InvoiceWasUpdated $event
*/
public function updatedInvoice(InvoiceWasUpdated $event)
{
$transformer = new InvoiceTransformer($event->invoice->account);
$this->checkSubscriptions(EVENT_UPDATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
}
/**
* @param InvoiceWasDeleted $event
*/
public function deletedInvoice(InvoiceWasDeleted $event)
{
$transformer = new InvoiceTransformer($event->invoice->account);
$this->checkSubscriptions(EVENT_DELETE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
}
/**

View File

@ -36,6 +36,7 @@ class EventServiceProvider extends ServiceProvider {
'App\Events\InvoiceWasUpdated' => [
'App\Listeners\ActivityListener@updatedInvoice',
'App\Listeners\InvoiceListener@updatedInvoice',
'App\Listeners\SubscriptionListener@updatedInvoice',
],
'App\Events\InvoiceWasArchived' => [
'App\Listeners\ActivityListener@archivedInvoice',
@ -67,6 +68,7 @@ class EventServiceProvider extends ServiceProvider {
],
'App\Events\QuoteWasUpdated' => [
'App\Listeners\ActivityListener@updatedQuote',
'App\Listeners\SubscriptionListener@updatedQuote',
],
'App\Events\QuoteWasArchived' => [
'App\Listeners\ActivityListener@archivedQuote',