mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-05 05:14:37 -04:00
Fixes for mailers
This commit is contained in:
parent
ebb03e945b
commit
48c36d0004
@ -34,8 +34,8 @@ class GmailTransport extends AbstractTransport
|
|||||||
nlog("in Do Send");
|
nlog("in Do Send");
|
||||||
$message = MessageConverter::toEmail($message->getOriginalMessage());
|
$message = MessageConverter::toEmail($message->getOriginalMessage());
|
||||||
|
|
||||||
$token = $message->getHeaders()->get('GmailToken')->getValue();
|
$token = $message->getHeaders()->get('gmailtoken')->getValue();
|
||||||
$message->getHeaders()->remove('GmailToken');
|
$message->getHeaders()->remove('gmailtoken');
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$client->setClientId(config('ninja.auth.google.client_id'));
|
$client->setClientId(config('ninja.auth.google.client_id'));
|
||||||
|
@ -33,8 +33,8 @@ class Office365MailTransport extends AbstractTransport
|
|||||||
$symfony_message = MessageConverter::toEmail($message->getOriginalMessage());
|
$symfony_message = MessageConverter::toEmail($message->getOriginalMessage());
|
||||||
|
|
||||||
$graph = new Graph();
|
$graph = new Graph();
|
||||||
$token = $symfony_message->getHeaders()->get('GmailToken')->getValue();
|
$token = $symfony_message->getHeaders()->get('gmailtoken')->getValue();
|
||||||
$symfony_message->getHeaders()->remove('GmailToken');
|
$symfony_message->getHeaders()->remove('gmailtoken');
|
||||||
|
|
||||||
$graph->setAccessToken($token);
|
$graph->setAccessToken($token);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class ImportController extends Controller
|
|||||||
public function import(ImportRequest $request)
|
public function import(ImportRequest $request)
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
nlog($data);
|
|
||||||
if (empty($data['hash'])) {
|
if (empty($data['hash'])) {
|
||||||
// Create a reference
|
// Create a reference
|
||||||
$data['hash'] = $hash = Str::random(32);
|
$data['hash'] = $hash = Str::random(32);
|
||||||
@ -113,7 +113,6 @@ nlog($data);
|
|||||||
/** @var UploadedFile $file */
|
/** @var UploadedFile $file */
|
||||||
foreach ($request->files->get('files') as $entityType => $file) {
|
foreach ($request->files->get('files') as $entityType => $file) {
|
||||||
$contents = file_get_contents($file->getPathname());
|
$contents = file_get_contents($file->getPathname());
|
||||||
|
|
||||||
// Store the csv in cache with an expiry of 10 minutes
|
// Store the csv in cache with an expiry of 10 minutes
|
||||||
Cache::put($hash.'-'.$entityType, base64_encode($contents), 600);
|
Cache::put($hash.'-'.$entityType, base64_encode($contents), 600);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ class QueryLogging
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Enable query logging for development
|
// Enable query logging for development
|
||||||
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
// if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||||
return $next($request);
|
// return $next($request);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$timeStart = microtime(true);
|
$timeStart = microtime(true);
|
||||||
DB::enableQueryLog();
|
DB::enableQueryLog();
|
||||||
@ -50,8 +50,8 @@ class QueryLogging
|
|||||||
$timeEnd = microtime(true);
|
$timeEnd = microtime(true);
|
||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
|
|
||||||
nlog("Query count = {$count}");
|
// nlog("Query count = {$count}");
|
||||||
nlog($queries);
|
// nlog($queries);
|
||||||
|
|
||||||
if ($count > 175) {
|
if ($count > 175) {
|
||||||
nlog("Query count = {$count}");
|
nlog("Query count = {$count}");
|
||||||
|
@ -72,7 +72,7 @@ class CSVIngest implements ShouldQueue
|
|||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
$engine = $this->bootEngine($this->import_type);
|
$engine = $this->bootEngine();
|
||||||
|
|
||||||
foreach (['client', 'product', 'invoice', 'payment', 'vendor', 'expense'] as $entity) {
|
foreach (['client', 'product', 'invoice', 'payment', 'vendor', 'expense'] as $entity) {
|
||||||
$engine->import($entity);
|
$engine->import($entity);
|
||||||
@ -106,29 +106,23 @@ class CSVIngest implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function bootEngine(string $import_type)
|
private function bootEngine()
|
||||||
{
|
{
|
||||||
switch ($import_type) {
|
switch ($this->import_type) {
|
||||||
case 'csv':
|
case 'csv':
|
||||||
return new Csv($this->request, $this->company);
|
return new Csv($this->request, $this->company);
|
||||||
break;
|
|
||||||
case 'waveaccounting':
|
case 'waveaccounting':
|
||||||
return new Wave($this->request, $this->company);
|
return new Wave($this->request, $this->company);
|
||||||
break;
|
|
||||||
case 'invoicely':
|
case 'invoicely':
|
||||||
return new Invoicely($this->request, $this->company);
|
return new Invoicely($this->request, $this->company);
|
||||||
break;
|
|
||||||
case 'invoice2go':
|
case 'invoice2go':
|
||||||
return new Invoice2Go($this->request, $this->company);
|
return new Invoice2Go($this->request, $this->company);
|
||||||
break;
|
|
||||||
case 'zoho':
|
case 'zoho':
|
||||||
return new Zoho($this->request, $this->company);
|
return new Zoho($this->request, $this->company);
|
||||||
break;
|
|
||||||
case 'freshbooks':
|
case 'freshbooks':
|
||||||
return new Freshbooks($this->request, $this->company);
|
return new Freshbooks($this->request, $this->company);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// code...
|
nlog("could not return provider");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
$this->nmo
|
$this->nmo
|
||||||
->mailable
|
->mailable
|
||||||
->from($user->email, $user->name())
|
->from($user->email, $user->name())
|
||||||
->withSwiftMessage(function ($message) use($token) {
|
->withSymfonyMessage(function ($message) use($token) {
|
||||||
$message->getHeaders()->addTextHeader('GmailToken', $token);
|
$message->getHeaders()->addTextHeader('GmailToken', $token);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
$this->nmo
|
$this->nmo
|
||||||
->mailable
|
->mailable
|
||||||
->from($user->email, $user->name())
|
->from($user->email, $user->name())
|
||||||
->withSwiftMessage(function ($message) use($token) {
|
->withSymfonyMessage(function ($message) use($token) {
|
||||||
$message->getHeaders()->addTextHeader('GmailToken', $token);
|
$message->getHeaders()->addTextHeader('GmailToken', $token);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -134,6 +134,8 @@ class TemplateEmail extends Mailable
|
|||||||
elseif($this->invitation->credit)
|
elseif($this->invitation->credit)
|
||||||
$path = $this->client->credit_filepath($this->invitation).$this->invitation->credit->numberFormatter().'.pdf';
|
$path = $this->client->credit_filepath($this->invitation).$this->invitation->credit->numberFormatter().'.pdf';
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
|
if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
@ -127,6 +127,8 @@ class VendorTemplateEmail extends Mailable
|
|||||||
if($this->invitation->purchase_order)
|
if($this->invitation->purchase_order)
|
||||||
$path = $this->vendor->purchase_order_filepath($this->invitation).$this->invitation->purchase_order->numberFormatter().'.pdf';
|
$path = $this->vendor->purchase_order_filepath($this->invitation).$this->invitation->purchase_order->numberFormatter().'.pdf';
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
|
if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
@ -45,10 +45,7 @@ class SendEmail
|
|||||||
|
|
||||||
$this->credit->invitations->each(function ($invitation) {
|
$this->credit->invitations->each(function ($invitation) {
|
||||||
if (! $invitation->contact->trashed() && $invitation->contact->email) {
|
if (! $invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
|
EmailEntity::dispatch($invitation, $invitation->company, $this->reminder_template);
|
||||||
// $email_builder = (new CreditEmail())->build($invitation, $this->reminder_template);
|
|
||||||
// EmailCredit::dispatchNow($email_builder, $invitation, $invitation->company);
|
|
||||||
EmailEntity::dispatchSync($invitation, $invitation->company, $this->reminder_template);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -421,7 +421,8 @@ class InvoiceService
|
|||||||
try {
|
try {
|
||||||
if ($force) {
|
if ($force) {
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
CreateEntityPdf::dispatchSync($invitation);
|
// CreateEntityPdf::dispatchSync($invitation);
|
||||||
|
(new CreateEntityPdf($invitation))->handle();
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -560,7 +561,8 @@ class InvoiceService
|
|||||||
public function adjustInventory($old_invoice = [])
|
public function adjustInventory($old_invoice = [])
|
||||||
{
|
{
|
||||||
if ($this->invoice->company->track_inventory) {
|
if ($this->invoice->company->track_inventory) {
|
||||||
AdjustProductInventory::dispatchSync($this->invoice->company, $this->invoice, $old_invoice);
|
(new AdjustProductInventory($this->invoice->company, $this->invoice, $old_invoice))->handle();
|
||||||
|
// AdjustProductInventory::dispatchSync($this->invoice->company, $this->invoice, $old_invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -124,7 +124,6 @@ return [
|
|||||||
'emergency' => [
|
'emergency' => [
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
'gelf' => [
|
'gelf' => [
|
||||||
'driver' => 'custom',
|
'driver' => 'custom',
|
||||||
@ -188,5 +187,6 @@ return [
|
|||||||
'extra_prefix' => null,
|
'extra_prefix' => null,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -44,7 +44,8 @@ return [
|
|||||||
'ses' => [
|
'ses' => [
|
||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('SES_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
'sparkpost' => [
|
'sparkpost' => [
|
||||||
'secret' => env('SPARKPOST_SECRET'),
|
'secret' => env('SPARKPOST_SECRET'),
|
||||||
],
|
],
|
||||||
@ -94,7 +95,5 @@ return [
|
|||||||
'client_secret' => env('BITBUCKET_CLIENT_SECRET'),
|
'client_secret' => env('BITBUCKET_CLIENT_SECRET'),
|
||||||
'redirect' => env('BITBUCKET_OAUTH_REDIRECT'),
|
'redirect' => env('BITBUCKET_OAUTH_REDIRECT'),
|
||||||
],
|
],
|
||||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -259,7 +259,7 @@ Route::group(['middleware' => ['throttle:300,1', 'api_db', 'token_auth', 'locale
|
|||||||
Route::resource('task_scheduler', TaskSchedulerController::class)->except('edit')->parameters(['task_scheduler' => 'scheduler']);
|
Route::resource('task_scheduler', TaskSchedulerController::class)->except('edit')->parameters(['task_scheduler' => 'scheduler']);
|
||||||
|
|
||||||
Route::get('scheduler', [SchedulerController::class, 'index']);
|
Route::get('scheduler', [SchedulerController::class, 'index']);
|
||||||
Route::post('support/messages/send', [SendingController::class]);
|
Route::post('support/messages/send', SendingController::class);
|
||||||
|
|
||||||
Route::post('self-update', [SelfUpdateController::class, 'update'])->middleware('password_protected');
|
Route::post('self-update', [SelfUpdateController::class, 'update'])->middleware('password_protected');
|
||||||
Route::post('self-update/check_version', [SelfUpdateController::class, 'checkVersion']);
|
Route::post('self-update/check_version', [SelfUpdateController::class, 'checkVersion']);
|
||||||
@ -287,7 +287,7 @@ Route::group(['middleware' => ['throttle:300,1', 'api_db', 'token_auth', 'locale
|
|||||||
Route::post('settings/disable_two_factor', [TwoFactorController::class, 'disableTwoFactor']);
|
Route::post('settings/disable_two_factor', [TwoFactorController::class, 'disableTwoFactor']);
|
||||||
|
|
||||||
|
|
||||||
Route::post('verify', [TwilioController::class, 'generate'])->name('verify.generate')->middleware('throttle:5,1');
|
Route::post('verify', [TwilioController::class, 'generate'])->name('verify.generate')->middleware('throttle:100,1');
|
||||||
Route::post('verify/confirm', [TwilioController::class, 'confirm'])->name('verify.confirm');
|
Route::post('verify/confirm', [TwilioController::class, 'confirm'])->name('verify.confirm');
|
||||||
|
|
||||||
Route::resource('vendors', VendorController::class); // name = (vendors. index / create / show / update / destroy / edit
|
Route::resource('vendors', VendorController::class); // name = (vendors. index / create / show / update / destroy / edit
|
||||||
@ -333,11 +333,11 @@ Route::group(['middleware' => ['throttle:300,1', 'api_db', 'token_auth', 'locale
|
|||||||
});
|
});
|
||||||
|
|
||||||
Route::match(['get', 'post'], 'payment_webhook/{company_key}/{company_gateway_id}', PaymentWebhookController::class)
|
Route::match(['get', 'post'], 'payment_webhook/{company_key}/{company_gateway_id}', PaymentWebhookController::class)
|
||||||
->middleware(['throttle:1000,1','guest'])
|
->middleware('throttle:1000,1')
|
||||||
->name('payment_webhook');
|
->name('payment_webhook');
|
||||||
|
|
||||||
Route::match(['get', 'post'], 'payment_notification_webhook/{company_key}/{company_gateway_id}/{client}', PaymentNotificationWebhookController::class)
|
Route::match(['get', 'post'], 'payment_notification_webhook/{company_key}/{company_gateway_id}/{client}', PaymentNotificationWebhookController::class)
|
||||||
->middleware(['throttle:1000,1', 'guest'])
|
->middleware('throttle:1000,1')
|
||||||
->name('payment_notification_webhook');
|
->name('payment_notification_webhook');
|
||||||
|
|
||||||
Route::post('api/v1/postmark_webhook', [PostMarkController::class, 'webhook'])->middleware('throttle:1000,1');
|
Route::post('api/v1/postmark_webhook', [PostMarkController::class, 'webhook'])->middleware('throttle:1000,1');
|
||||||
|
@ -90,7 +90,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'domain_db','check_clie
|
|||||||
|
|
||||||
Route::get('credits/{credit_invitation}', [App\Http\Controllers\ClientPortal\CreditController::class,'show'])->name('credits.show_invitation');
|
Route::get('credits/{credit_invitation}', [App\Http\Controllers\ClientPortal\CreditController::class,'show'])->name('credits.show_invitation');
|
||||||
|
|
||||||
Route::get('client/switch_company/{contact}', [App\Http\Controllers\ClientPortal\SwitchCompanyController::class])->name('switch_company');
|
Route::get('client/switch_company/{contact}', App\Http\Controllers\ClientPortal\SwitchCompanyController::class)->name('switch_company');
|
||||||
|
|
||||||
Route::post('documents/download_multiple', [App\Http\Controllers\ClientPortal\DocumentController::class, 'downloadMultiple'])->name('documents.download_multiple');
|
Route::post('documents/download_multiple', [App\Http\Controllers\ClientPortal\DocumentController::class, 'downloadMultiple'])->name('documents.download_multiple');
|
||||||
Route::get('documents/{document}/download', [App\Http\Controllers\ClientPortal\DocumentController::class, 'download'])->name('documents.download');
|
Route::get('documents/{document}/download', [App\Http\Controllers\ClientPortal\DocumentController::class, 'download'])->name('documents.download');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user