mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Reducing the quantity of jobs dispatched
This commit is contained in:
parent
681fc47a68
commit
1de91c9e33
@ -1 +1 @@
|
||||
5.5.70
|
||||
5.5.71
|
@ -73,19 +73,15 @@ class CreateEntityPdf implements ShouldQueue
|
||||
$this->invitation = $invitation;
|
||||
|
||||
if ($invitation instanceof InvoiceInvitation) {
|
||||
// $invitation->load('contact.client.company','invoice.client','invoice.user.account');
|
||||
$this->entity = $invitation->invoice;
|
||||
$this->entity_string = 'invoice';
|
||||
} elseif ($invitation instanceof QuoteInvitation) {
|
||||
// $invitation->load('contact.client.company','quote.client','quote.user.account');
|
||||
$this->entity = $invitation->quote;
|
||||
$this->entity_string = 'quote';
|
||||
} elseif ($invitation instanceof CreditInvitation) {
|
||||
// $invitation->load('contact.client.company','credit.client','credit.user.account');
|
||||
$this->entity = $invitation->credit;
|
||||
$this->entity_string = 'credit';
|
||||
} elseif ($invitation instanceof RecurringInvoiceInvitation) {
|
||||
// $invitation->load('contact.client.company','recurring_invoice');
|
||||
$this->entity = $invitation->recurring_invoice;
|
||||
$this->entity_string = 'recurring_invoice';
|
||||
}
|
||||
|
@ -19,25 +19,16 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ClientLedgerBalanceUpdate implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $tries = 1;
|
||||
|
||||
public $company;
|
||||
|
||||
public $client;
|
||||
|
||||
public $deleteWhenMissingModels = true;
|
||||
|
||||
public function __construct(Company $company, Client $client)
|
||||
{
|
||||
$this->company = $company;
|
||||
$this->client = $client;
|
||||
}
|
||||
public function __construct(public Company $company, public Client $client)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
@ -71,4 +62,11 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
|
||||
$company_ledger->save();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function middleware()
|
||||
{
|
||||
return [(new WithoutOverlapping($this->client->id))->dontRelease()];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,9 +56,5 @@ class QuoteWorkflowSettings implements ShouldQueue
|
||||
$this->quote->service()->sendEmail($invitation->contact);
|
||||
});
|
||||
}
|
||||
|
||||
// if ($this->client->getSetting('auto_archive_quote')) {
|
||||
// $this->base_repository->archive($this->quote);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ class CreditCreatedNotification implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 10;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
@ -64,10 +66,8 @@ class CreditCreatedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
// $first_notification_sent = false;
|
||||
}
|
||||
|
||||
/* Override the methods in the Notification Class */
|
||||
|
@ -62,14 +62,10 @@ class CreditEmailedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
// $first_notification_sent = false;
|
||||
}
|
||||
|
||||
// $notification->method = $methods;
|
||||
|
||||
// $user->notify($notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class InvoiceCreatedNotification implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 5;
|
||||
public $delay = 7;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -70,7 +70,7 @@ class InvoiceCreatedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -24,7 +24,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 5;
|
||||
public $delay = 10;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -68,7 +68,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -26,6 +26,8 @@ class InvoiceFailedEmailNotification
|
||||
{
|
||||
use UserNotifies, Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $delay = 7;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
@ -60,7 +62,7 @@ class InvoiceFailedEmailNotification
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
$first_notification_sent = false;
|
||||
}
|
||||
|
@ -57,10 +57,5 @@ class InvoicePaidActivity implements ShouldQueue
|
||||
$event->invoice->subscription->service()->planPaid($event->invoice);
|
||||
}
|
||||
|
||||
// try {
|
||||
// $event->invoice->service()->touchPdf();
|
||||
// } catch (\Exception $e) {
|
||||
// nlog(print_r($e->getMessage(), 1));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class InvitationViewedListener implements ShouldQueue
|
||||
unset($methods[$key]);
|
||||
|
||||
$nmo->to_user = $company_user->user;
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ class PaymentEmailedActivity implements ShouldQueue
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$payment = $event->payment;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class PaymentNotification implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 5;
|
||||
public $delay = 20;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
@ -75,7 +75,7 @@ class PaymentNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class PurchaseOrderAcceptedListener implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -25,6 +25,8 @@ class PurchaseOrderCreatedListener implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 7;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
@ -69,7 +71,7 @@ class PurchaseOrderCreatedListener implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -68,7 +68,7 @@ class PurchaseOrderEmailedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -23,7 +23,7 @@ class QuoteApprovedNotification implements ShouldQueue
|
||||
{
|
||||
use UserNotifies;
|
||||
|
||||
public $delay = 5;
|
||||
public $delay = 8;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -66,7 +66,7 @@ class QuoteApprovedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -70,7 +70,7 @@ class QuoteCreatedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
/* This prevents more than one notification being sent */
|
||||
$first_notification_sent = false;
|
||||
|
@ -54,8 +54,6 @@ class QuoteEmailedNotification implements ShouldQueue
|
||||
foreach ($event->invitation->company->company_users as $company_user) {
|
||||
$user = $company_user->user;
|
||||
|
||||
// $notification = new EntitySentNotification($event->invitation, 'quote');
|
||||
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent', 'quote_sent_all', 'quote_sent_user']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false) {
|
||||
@ -63,14 +61,10 @@ class QuoteEmailedNotification implements ShouldQueue
|
||||
|
||||
$nmo->to_user = $user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
// $first_notification_sent = false;
|
||||
}
|
||||
|
||||
// $notification->method = $methods;
|
||||
|
||||
// $user->notify($notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use stdClass;
|
||||
use App\Models\Payment;
|
||||
|
||||
class EntityPaidObject
|
||||
{
|
||||
@ -29,7 +30,7 @@ class EntityPaidObject
|
||||
|
||||
public $settings;
|
||||
|
||||
public function __construct($payment)
|
||||
public function __construct(public Payment $payment)
|
||||
{
|
||||
$this->payment = $payment;
|
||||
$this->company = $payment->company;
|
||||
|
@ -323,7 +323,7 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
$invoice_list = '<br><br>';
|
||||
|
||||
foreach ($this->payment->invoices as $invoice) {
|
||||
$invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} - ".Number::formatMoney($invoice->pivot->amount, $this->client).'<br>';
|
||||
$invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'<br>';
|
||||
}
|
||||
|
||||
return $invoice_list;
|
||||
|
@ -74,6 +74,8 @@ class CompanyGateway extends BaseModel
|
||||
// const TYPE_WEPAY = 309;
|
||||
// const TYPE_PAYFAST = 310;
|
||||
// const TYPE_PAYTRACE = 311;
|
||||
// const TYPE_MOLLIE = 312;
|
||||
// const TYPE_EWAY = 313;
|
||||
// const TYPE_FORTE = 314;
|
||||
|
||||
public $gateway_consts = [
|
||||
@ -87,6 +89,8 @@ class CompanyGateway extends BaseModel
|
||||
'8fdeed552015b3c7b44ed6c8ebd9e992' => 309,
|
||||
'd6814fc83f45d2935e7777071e629ef9' => 310,
|
||||
'bbd736b3254b0aabed6ad7fda1298c88' => 311,
|
||||
'1bd651fb213ca0c9d66ae3c336dc77e7' => 312,
|
||||
'944c20175bbe6b9972c05bcfe294c2c7' => 313,
|
||||
'kivcvjexxvdiyqtj3mju5d6yhpeht2xs' => 314,
|
||||
'65faab2ab6e3223dbe848b1686490baz' => 320,
|
||||
'b9886f9257f0c6ee7c302f1c74475f6c' => 321,
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Events\Credit\CreditWasUpdated;
|
||||
use App\Jobs\Entity\CreateEntityPdf;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\Inviteable;
|
||||
@ -44,38 +43,6 @@ class CreditInvitation extends BaseModel
|
||||
return self::class;
|
||||
}
|
||||
|
||||
// public function getSignatureDateAttribute($value)
|
||||
// {
|
||||
// if (!$value) {
|
||||
// return (new Carbon($value))->format('Y-m-d');
|
||||
// }
|
||||
// return $value;
|
||||
// }
|
||||
|
||||
// public function getSentDateAttribute($value)
|
||||
// {
|
||||
// if (!$value) {
|
||||
// return (new Carbon($value))->format('Y-m-d');
|
||||
// }
|
||||
// return $value;
|
||||
// }
|
||||
|
||||
// public function getViewedDateAttribute($value)
|
||||
// {
|
||||
// if (!$value) {
|
||||
// return (new Carbon($value))->format('Y-m-d');
|
||||
// }
|
||||
// return $value;
|
||||
// }
|
||||
|
||||
// public function getOpenedDateAttribute($value)
|
||||
// {
|
||||
// if (!$value) {
|
||||
// return (new Carbon($value))->format('Y-m-d');
|
||||
// }
|
||||
// return $value;
|
||||
// }
|
||||
|
||||
public function entityType()
|
||||
{
|
||||
return Credit::class;
|
||||
@ -129,7 +96,6 @@ class CreditInvitation extends BaseModel
|
||||
$storage_path = Storage::url($this->credit->client->quote_filepath($this).$this->credit->numberFormatter().'.pdf');
|
||||
|
||||
if (! Storage::exists($this->credit->client->credit_filepath($this).$this->credit->numberFormatter().'.pdf')) {
|
||||
event(new CreditWasUpdated($this->credit, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
(new CreateEntityPdf($this))->handle();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,6 @@ class QuoteInvitation extends BaseModel
|
||||
$storage_path = Storage::url($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf');
|
||||
|
||||
if (! Storage::exists($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf')) {
|
||||
event(new QuoteWasUpdated($this->quote, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
(new CreateEntityPdf($this))->handle();
|
||||
}
|
||||
|
||||
|
@ -407,12 +407,10 @@ class EventServiceProvider extends ServiceProvider
|
||||
],
|
||||
InvoiceWasUpdated::class => [
|
||||
UpdateInvoiceActivity::class,
|
||||
CreateInvoicePdf::class,
|
||||
],
|
||||
InvoiceWasCreated::class => [
|
||||
CreateInvoiceActivity::class,
|
||||
InvoiceCreatedNotification::class,
|
||||
// CreateInvoicePdf::class,
|
||||
],
|
||||
InvoiceWasPaid::class => [
|
||||
InvoicePaidActivity::class,
|
||||
@ -451,7 +449,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
InvitationViewedListener::class,
|
||||
],
|
||||
PaymentWasEmailed::class => [
|
||||
PaymentEmailedActivity::class,
|
||||
// PaymentEmailedActivity::class,
|
||||
],
|
||||
PaymentWasEmailedAndFailed::class => [
|
||||
// PaymentEmailFailureActivity::class,
|
||||
|
@ -23,7 +23,6 @@ use Illuminate\Queue\SerializesModels;
|
||||
class BankMatchingService implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public function __construct(public $company_id, public $db)
|
||||
{
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ class ApplyPayment
|
||||
->updateBalance($this->amount_applied * -1)
|
||||
->updatePaidToDate($this->amount_applied)
|
||||
->updateStatus()
|
||||
->touchPdf()
|
||||
->save();
|
||||
|
||||
$this->credit
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.5.70',
|
||||
'app_tag' => '5.5.70',
|
||||
'app_version' => '5.5.71',
|
||||
'app_tag' => '5.5.71',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
Loading…
Reference in New Issue
Block a user