1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #7680 from turbo124/v5-develop

Fixes for mailer
This commit is contained in:
David Bomba 2022-07-25 15:38:32 +10:00 committed by GitHub
commit 2a33432988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 80 additions and 13 deletions

View File

@ -81,15 +81,16 @@ class InvitationController extends Controller
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
$invitation = $entity_obj::withTrashed()
->with($entity)
->where('key', $invitation_key)
->whereHas($entity, function ($query) {
$query->where('is_deleted',0);
})
// ->whereHas($entity, function ($query) {
// $query->where('is_deleted',0);
// })
->with('contact.client')
->first();
if(!$invitation)
return abort(404,'The resource is no longer available.');
if($invitation->{$entity}->is_deleted)
return $this->render('generic.not_available', ['account' => $invitation->company->account, 'company' => $invitation->company]);
/* 12/01/2022 Clean up an edge case where if the contact is trashed, restore if a invitation comes back. */
if($invitation->contact->trashed())

View File

@ -330,8 +330,14 @@ class NinjaMailerJob implements ShouldQueue
return true;
/* If the account is verified, we allow emails to flow */
if(Ninja::isHosted() && $this->company->account && $this->company->account->is_verified_account)
if(Ninja::isHosted() && $this->company->account && $this->company->account->is_verified_account) {
/* Continue to analyse verified accounts in case they later start sending poor quality emails*/
if(class_exists(\Modules\Admin\Jobs\Account\EmailQuality::class))
(new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
return false;
}
/* Ensure the user has a valid email address */
if(!str_contains($this->nmo->to_user->email, "@"))

View File

@ -44,9 +44,6 @@ class UploadAvatar implements ShouldQueue
$path = Storage::putFile($this->directory, new File(sys_get_temp_dir().'/'.$tmp_file));
// info($path);
// info($tmp_file);
$url = Storage::url($path);
//return file path

View File

@ -35,7 +35,7 @@ class VersionCheck implements ShouldQueue
*/
public function handle()
{
$version_file = trim(file_get_contents(config('ninja.version_url')));
$version_file = trim(@file_get_contents(config('ninja.version_url')));
nlog("latest version = {$version_file}");

View File

@ -13,6 +13,7 @@ namespace App\Models\Presenters;
use App\Models\Country;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
/**
* Class CompanyPresenter.
@ -46,6 +47,24 @@ class CompanyPresenter extends EntityPresenter
}
public function logoDocker($settings = null)
{
if (! $settings) {
$settings = $this->entity->settings;
}
$basename = basename($this->settings->company_logo);
$logo = Storage::get("{$this->company_key}/{$basename}");
if(!$logo)
return $this->logo($settings);
return "data:image/png;base64, ". base64_encode($logo);
}
/**
* Test for using base64 encoding
*/
@ -56,7 +75,7 @@ class CompanyPresenter extends EntityPresenter
}
if(config('ninja.is_docker') || config('ninja.local_download'))
return $this->logo($settings);
return $this->logoDocker($settings);
$context_options =array(
"ssl"=>array(

View File

@ -148,6 +148,17 @@ class PaymentIntentWebhook implements ShouldQueue
}
SystemLogger::dispatch(
['response' => $this->stripe_request, 'data' => []],
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_SUCCESS,
SystemLog::TYPE_STRIPE,
null,
$company,
);
}
private function updateCreditCardPayment($payment_hash, $client)

View File

@ -540,7 +540,7 @@ class HtmlEngine
/*Payment Aliases*/
$data['$paymentLink'] = &$data['$payment_link'];
$data['$payment_url'] = &$data['$payment_link'];
$data['$portalButton'] = &$data['$paymentLink'];
$data['$portalButton'] = &$data['$portal_button'];
$data['$dir'] = ['value' => in_array(optional($this->client->language())->locale, ['ar', 'he']) ? 'rtl' : 'ltr', 'label' => ''];
$data['$dir_text_align'] = ['value' => in_array(optional($this->client->language())->locale, ['ar', 'he']) ? 'right' : 'left', 'label' => ''];

View File

@ -4728,6 +4728,8 @@ $LANG = array(
'received' => 'Received',
'converted_to_expense' => 'Successfully converted to expense',
'converted_to_expenses' => 'Successfully converted to expenses',
'entity_removed' => 'This document has been removed, please contact the vendor for further information',
'entity_removed_title' => 'Document no longer available',
);
return $LANG;

View File

@ -0,0 +1,31 @@
@extends('portal.ninja2020.layout.clean')
@section('meta_title', ctrans('texts.error'))
@section('body')
<div class="flex h-screen">
<div class="m-auto md:w-1/2 lg:w-1/2">
<div class="flex flex-col items-center">
@if($account && !$account->isPaid())
<div>
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}"
class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
</div>
@elseif(isset($company) && !is_null($company))
<div>
<img src="{{ $company->present()->logo() }}"
class="mx-auto border-b border-gray-100 h-18 pb-4" alt="{{ $company->present()->name() }} logo">
</div>
@endif
<h1 class="text-center text-3xl mt-10">{{ ctrans("texts.entity_removed_title") }}</h1>
<p class="text-center opacity-75 mt-10">{{ ctrans('texts.entity_removed') }}</p>
</div>
</div>
</div>
@stop
@push('footer')
@endpush