1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for breaking change in CreateInvoicePdf

This commit is contained in:
David Bomba 2022-10-28 14:37:01 +11:00
parent 95610fd25e
commit a566d8b0a2
6 changed files with 24 additions and 16 deletions

View File

@ -122,12 +122,13 @@ class NinjaMailerJob implements ShouldQueue
->to($this->nmo->to_user->email)
->send($this->nmo->mailable);
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
->batch();
/* Count the amount of emails sent across all the users accounts */
Cache::increment($this->company->account->key);
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
->send();
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
nlog("error failed with {$e->getMessage()}");
@ -394,7 +395,7 @@ class NinjaMailerJob implements ShouldQueue
$job_failure->string_metric6 = substr($errors, 0, 150);
LightLogs::create($job_failure)
->queue();
->send();
}
public function failed($exception = null)

View File

@ -63,8 +63,15 @@ class AdjustEmailQuota implements ShouldQueue
$email_count = Cache::get($account->key);
if($email_count > 0)
LightLogs::create(new EmailCount($email_count, $account->key))->batch();
if($email_count > 0){
try{
LightLogs::create(new EmailCount($email_count, $account->key))->send();
}
catch(\Exception $e){
nlog($e->getMessage());
}
}
Cache::forget($account->key);
Cache::forget("throttle_notified:{$account->key}");

View File

@ -43,6 +43,6 @@ class QueueSize implements ShouldQueue
public function handle()
{
LightLogs::create(new QueueSizeAnalytic(Queue::size()))
->queue();
->send();
}
}

View File

@ -142,7 +142,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
$this->invitation->opened_date = now();
$this->invitation->save();
SystemLogger::dispatch($this->request,
SystemLogger::dispatchSync($this->request,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_OPENED,
SystemLog::TYPE_WEBHOOK_RESPONSE,
@ -171,7 +171,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
$this->invitation->email_status = 'delivered';
$this->invitation->save();
SystemLogger::dispatch($this->request,
SystemLogger::dispatchSync($this->request,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_DELIVERY,
SystemLog::TYPE_WEBHOOK_RESPONSE,
@ -217,9 +217,9 @@ class ProcessPostmarkWebhook implements ShouldQueue
$this->request['MessageID']
);
LightLogs::create($bounce)->batch();
LightLogs::create($bounce)->send();
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
SystemLogger::dispatchSync($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
// if(config('ninja.notification.slack'))
// $this->invitation->company->notification(new EmailBounceNotification($this->invitation->company->account))->ninja();
@ -263,9 +263,9 @@ class ProcessPostmarkWebhook implements ShouldQueue
$this->request['MessageID']
);
LightLogs::create($spam)->batch();
LightLogs::create($spam)->send();
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
SystemLogger::dispatchSync($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
if(config('ninja.notification.slack'))
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();

View File

@ -181,7 +181,7 @@ class SendRecurring implements ShouldQueue
$job_failure->string_metric6 = $exception->getMessage();
LightLogs::create($job_failure)
->queue();
->send();
nlog(print_r($exception->getMessage(), 1));
}

View File

@ -46,14 +46,14 @@ class CreateInvoicePdf implements ShouldQueue
if (isset($event->quote)) {
$event->quote->invitations->each(function ($invitation) {
// CreateEntityPdf::dispatch($invitation->load('quote', 'contact.client.company'));
(new CreateEntityPdf($invitation->load('invoice', 'contact.client.company')))->handle();
(new CreateEntityPdf($invitation->load('quote', 'contact.client.company')))->handle();
});
}
if (isset($event->credit)) {
$event->credit->invitations->each(function ($invitation) {
// CreateEntityPdf::dispatch($invitation->load('credit', 'contact.client.company'));
(new CreateEntityPdf($invitation->load('invoice', 'contact.client.company')))->handle();
(new CreateEntityPdf($invitation->load('credit', 'contact.client.company')))->handle();
});
}