mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:29:03 -05:00 
			
		
		
		
	Fixes for breaking change in CreateInvoicePdf
This commit is contained in:
		
							parent
							
								
									95610fd25e
								
							
						
					
					
						commit
						a566d8b0a2
					
				@ -122,12 +122,13 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
                ->to($this->nmo->to_user->email)
 | 
					                ->to($this->nmo->to_user->email)
 | 
				
			||||||
                ->send($this->nmo->mailable);
 | 
					                ->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 */
 | 
					            /* Count the amount of emails sent across all the users accounts */
 | 
				
			||||||
            Cache::increment($this->company->account->key);
 | 
					            Cache::increment($this->company->account->key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
 | 
				
			||||||
 | 
					                     ->send();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
 | 
					        } catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            nlog("error failed with {$e->getMessage()}");
 | 
					            nlog("error failed with {$e->getMessage()}");
 | 
				
			||||||
@ -394,7 +395,7 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
        $job_failure->string_metric6 = substr($errors, 0, 150);
 | 
					        $job_failure->string_metric6 = substr($errors, 0, 150);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        LightLogs::create($job_failure)
 | 
					        LightLogs::create($job_failure)
 | 
				
			||||||
                 ->queue();
 | 
					                 ->send();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function failed($exception = null)
 | 
					    public function failed($exception = null)
 | 
				
			||||||
 | 
				
			|||||||
@ -63,8 +63,15 @@ class AdjustEmailQuota implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $email_count = Cache::get($account->key);
 | 
					            $email_count = Cache::get($account->key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if($email_count > 0)
 | 
					            if($email_count > 0){
 | 
				
			||||||
                LightLogs::create(new EmailCount($email_count, $account->key))->batch();
 | 
					
 | 
				
			||||||
 | 
					                try{
 | 
				
			||||||
 | 
					                    LightLogs::create(new EmailCount($email_count, $account->key))->send();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch(\Exception $e){
 | 
				
			||||||
 | 
					                    nlog($e->getMessage());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Cache::forget($account->key);
 | 
					            Cache::forget($account->key);
 | 
				
			||||||
            Cache::forget("throttle_notified:{$account->key}");
 | 
					            Cache::forget("throttle_notified:{$account->key}");
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,6 @@ class QueueSize implements ShouldQueue
 | 
				
			|||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        LightLogs::create(new QueueSizeAnalytic(Queue::size()))
 | 
					        LightLogs::create(new QueueSizeAnalytic(Queue::size()))
 | 
				
			||||||
         ->queue();
 | 
					         ->send();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -142,7 +142,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
 | 
				
			|||||||
        $this->invitation->opened_date = now();
 | 
					        $this->invitation->opened_date = now();
 | 
				
			||||||
        $this->invitation->save();
 | 
					        $this->invitation->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SystemLogger::dispatch($this->request, 
 | 
					        SystemLogger::dispatchSync($this->request, 
 | 
				
			||||||
            SystemLog::CATEGORY_MAIL, 
 | 
					            SystemLog::CATEGORY_MAIL, 
 | 
				
			||||||
            SystemLog::EVENT_MAIL_OPENED, 
 | 
					            SystemLog::EVENT_MAIL_OPENED, 
 | 
				
			||||||
            SystemLog::TYPE_WEBHOOK_RESPONSE, 
 | 
					            SystemLog::TYPE_WEBHOOK_RESPONSE, 
 | 
				
			||||||
@ -171,7 +171,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
 | 
				
			|||||||
        $this->invitation->email_status = 'delivered';
 | 
					        $this->invitation->email_status = 'delivered';
 | 
				
			||||||
        $this->invitation->save();
 | 
					        $this->invitation->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SystemLogger::dispatch($this->request, 
 | 
					        SystemLogger::dispatchSync($this->request, 
 | 
				
			||||||
            SystemLog::CATEGORY_MAIL, 
 | 
					            SystemLog::CATEGORY_MAIL, 
 | 
				
			||||||
            SystemLog::EVENT_MAIL_DELIVERY, 
 | 
					            SystemLog::EVENT_MAIL_DELIVERY, 
 | 
				
			||||||
            SystemLog::TYPE_WEBHOOK_RESPONSE, 
 | 
					            SystemLog::TYPE_WEBHOOK_RESPONSE, 
 | 
				
			||||||
@ -217,9 +217,9 @@ class ProcessPostmarkWebhook implements ShouldQueue
 | 
				
			|||||||
            $this->request['MessageID']
 | 
					            $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'))
 | 
					        // if(config('ninja.notification.slack'))
 | 
				
			||||||
            // $this->invitation->company->notification(new EmailBounceNotification($this->invitation->company->account))->ninja();
 | 
					            // $this->invitation->company->notification(new EmailBounceNotification($this->invitation->company->account))->ninja();
 | 
				
			||||||
@ -263,9 +263,9 @@ class ProcessPostmarkWebhook implements ShouldQueue
 | 
				
			|||||||
            $this->request['MessageID']
 | 
					            $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'))
 | 
					        if(config('ninja.notification.slack'))
 | 
				
			||||||
            $this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
 | 
					            $this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
 | 
				
			||||||
 | 
				
			|||||||
@ -181,7 +181,7 @@ class SendRecurring implements ShouldQueue
 | 
				
			|||||||
        $job_failure->string_metric6 = $exception->getMessage();
 | 
					        $job_failure->string_metric6 = $exception->getMessage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        LightLogs::create($job_failure)
 | 
					        LightLogs::create($job_failure)
 | 
				
			||||||
                 ->queue();
 | 
					                 ->send();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        nlog(print_r($exception->getMessage(), 1));
 | 
					        nlog(print_r($exception->getMessage(), 1));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -46,14 +46,14 @@ class CreateInvoicePdf implements ShouldQueue
 | 
				
			|||||||
        if (isset($event->quote)) {
 | 
					        if (isset($event->quote)) {
 | 
				
			||||||
            $event->quote->invitations->each(function ($invitation) {
 | 
					            $event->quote->invitations->each(function ($invitation) {
 | 
				
			||||||
                // CreateEntityPdf::dispatch($invitation->load('quote', 'contact.client.company'));
 | 
					                // 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)) {
 | 
					        if (isset($event->credit)) {
 | 
				
			||||||
            $event->credit->invitations->each(function ($invitation) {
 | 
					            $event->credit->invitations->each(function ($invitation) {
 | 
				
			||||||
//                CreateEntityPdf::dispatch($invitation->load('credit', 'contact.client.company'));
 | 
					//                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();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user