1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

Added 'approved quote' subscription

This commit is contained in:
Hillel Coren 2017-12-31 11:01:02 +02:00
parent 5f1970a2c2
commit a77e594da0
5 changed files with 14 additions and 0 deletions

View File

@ -319,6 +319,7 @@ if (! defined('APP_NAME')) {
define('EVENT_CREATE_TASK', 18); define('EVENT_CREATE_TASK', 18);
define('EVENT_UPDATE_TASK', 19); define('EVENT_UPDATE_TASK', 19);
define('EVENT_DELETE_TASK', 20); define('EVENT_DELETE_TASK', 20);
define('EVENT_APPROVE_QUOTE', 21);
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN'); define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
define('NINJA_ACCOUNT_KEY', env('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h')); define('NINJA_ACCOUNT_KEY', env('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h'));

View File

@ -11,6 +11,7 @@ use App\Events\ExpenseWasDeleted;
use App\Events\QuoteItemsWereCreated; use App\Events\QuoteItemsWereCreated;
use App\Events\QuoteItemsWereUpdated; use App\Events\QuoteItemsWereUpdated;
use App\Events\QuoteWasDeleted; use App\Events\QuoteWasDeleted;
use App\Events\QuoteInvitationWasApproved;
use App\Events\PaymentWasCreated; use App\Events\PaymentWasCreated;
use App\Events\PaymentWasDeleted; use App\Events\PaymentWasDeleted;
use App\Events\InvoiceItemsWereCreated; use App\Events\InvoiceItemsWereCreated;
@ -132,6 +133,15 @@ class SubscriptionListener
$this->checkSubscriptions(EVENT_UPDATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT); $this->checkSubscriptions(EVENT_UPDATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
} }
/**
* @param QuoteInvitationWasApproved $event
*/
public function approvedQuote(QuoteInvitationWasApproved $event)
{
$transformer = new InvoiceTransformer($event->quote->account);
$this->checkSubscriptions(EVENT_APPROVE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
}
/** /**
* @param InvoiceWasDeleted $event * @param InvoiceWasDeleted $event
*/ */

View File

@ -108,6 +108,7 @@ class EventServiceProvider extends ServiceProvider
'App\Events\QuoteInvitationWasApproved' => [ 'App\Events\QuoteInvitationWasApproved' => [
'App\Listeners\ActivityListener@approvedQuote', 'App\Listeners\ActivityListener@approvedQuote',
'App\Listeners\NotificationListener@approvedQuote', 'App\Listeners\NotificationListener@approvedQuote',
'App\Listeners\SubscriptionListener@approvedQuote',
], ],
// Payments // Payments

View File

@ -2593,6 +2593,7 @@ $LANG = array(
'subscription_event_18' => 'Created Task', 'subscription_event_18' => 'Created Task',
'subscription_event_19' => 'Updated Task', 'subscription_event_19' => 'Updated Task',
'subscription_event_20' => 'Deleted Task', 'subscription_event_20' => 'Deleted Task',
'subscription_event_21' => 'Approved Quote',
'subscriptions' => 'Subscriptions', 'subscriptions' => 'Subscriptions',
'updated_subscription' => 'Successfully updated subscription', 'updated_subscription' => 'Successfully updated subscription',
'created_subscription' => 'Successfully created subscription', 'created_subscription' => 'Successfully created subscription',

View File

@ -38,6 +38,7 @@
trans('texts.quotes') => [ trans('texts.quotes') => [
EVENT_CREATE_QUOTE => trans('texts.subscription_event_' . EVENT_CREATE_QUOTE), EVENT_CREATE_QUOTE => trans('texts.subscription_event_' . EVENT_CREATE_QUOTE),
EVENT_UPDATE_QUOTE => trans('texts.subscription_event_' . EVENT_UPDATE_QUOTE), EVENT_UPDATE_QUOTE => trans('texts.subscription_event_' . EVENT_UPDATE_QUOTE),
EVENT_APPROVE_QUOTE => trans('texts.subscription_event_' . EVENT_APPROVE_QUOTE),
EVENT_DELETE_QUOTE => trans('texts.subscription_event_' . EVENT_DELETE_QUOTE), EVENT_DELETE_QUOTE => trans('texts.subscription_event_' . EVENT_DELETE_QUOTE),
], ],
trans('texts.tasks') => [ trans('texts.tasks') => [