mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Updates for mailable
This commit is contained in:
parent
95271bf090
commit
6cd7235b41
@ -11,36 +11,37 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\DataMapper\Analytics\AccountDeleted;
|
use App\Utils\Ninja;
|
||||||
use App\DataMapper\CompanySettings;
|
|
||||||
use App\Http\Requests\Company\CreateCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\DefaultCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\DestroyCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\EditCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\ShowCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\StoreCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\UpdateCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\UploadCompanyRequest;
|
|
||||||
use App\Jobs\Company\CreateCompany;
|
|
||||||
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
|
||||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
|
||||||
use App\Mail\Company\CompanyDeleted;
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyUser;
|
use App\Models\CompanyUser;
|
||||||
use App\Repositories\CompanyRepository;
|
|
||||||
use App\Transformers\CompanyTransformer;
|
|
||||||
use App\Transformers\CompanyUserTransformer;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use App\Utils\Traits\Uploadable;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\Uploadable;
|
||||||
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
|
use App\DataMapper\CompanySettings;
|
||||||
|
use App\Jobs\Company\CreateCompany;
|
||||||
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Mail\Company\CompanyDeleted;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Turbo124\Beacon\Facades\LightLogs;
|
use Turbo124\Beacon\Facades\LightLogs;
|
||||||
|
use App\Repositories\CompanyRepository;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
|
use App\Transformers\CompanyTransformer;
|
||||||
|
use App\DataMapper\Analytics\AccountDeleted;
|
||||||
|
use App\Transformers\CompanyUserTransformer;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
||||||
|
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||||
|
use App\Http\Requests\Company\EditCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\ShowCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\StoreCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\CreateCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\UpdateCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\UploadCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\DefaultCompanyRequest;
|
||||||
|
use App\Http\Requests\Company\DestroyCompanyRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyController.
|
* Class CompanyController.
|
||||||
@ -486,6 +487,12 @@ class CompanyController extends BaseController
|
|||||||
$company_user->forceDelete();
|
$company_user->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
Storage::disk(config('filesystems.default'))->deleteDirectory($company->company_key);
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
$account->delete();
|
$account->delete();
|
||||||
|
|
||||||
if (Ninja::isHosted()) {
|
if (Ninja::isHosted()) {
|
||||||
@ -494,7 +501,10 @@ class CompanyController extends BaseController
|
|||||||
|
|
||||||
LightLogs::create(new AccountDeleted())
|
LightLogs::create(new AccountDeleted())
|
||||||
->increment()
|
->increment()
|
||||||
->queue();
|
->batch();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$company_id = $company->id;
|
$company_id = $company->id;
|
||||||
|
|
||||||
@ -511,6 +521,12 @@ class CompanyController extends BaseController
|
|||||||
$nmo->to_user = auth()->user();
|
$nmo->to_user = auth()->user();
|
||||||
(new NinjaMailerJob($nmo, true))->handle();
|
(new NinjaMailerJob($nmo, true))->handle();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Storage::disk(config('filesystems.default'))->deleteDirectory($company->company_key);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$company->delete();
|
$company->delete();
|
||||||
|
|
||||||
//If we are deleting the default companies, we'll need to make a new company the default.
|
//If we are deleting the default companies, we'll need to make a new company the default.
|
||||||
|
@ -77,7 +77,7 @@ class CreateAccount
|
|||||||
$sp794f3f->hosted_company_count = config('ninja.quotas.free.max_companies');
|
$sp794f3f->hosted_company_count = config('ninja.quotas.free.max_companies');
|
||||||
$sp794f3f->account_sms_verified = true;
|
$sp794f3f->account_sms_verified = true;
|
||||||
|
|
||||||
if (in_array($this->getDomain($this->request['email']), ['givmail.com','yopmail.com','gmail.com', 'hotmail.com', 'outlook.com', 'yahoo.com', 'aol.com', 'mail.ru','brand-app.biz','proton.me','ema-sofia.eu'])) {
|
if (in_array($this->getDomain($this->request['email']), ['givmail.com','yopmail.com','gmail.com', 'hotmail.com', 'outlook.com', 'yahoo.com', 'aol.com', 'mail.ru','brand-app.biz','proton.me','ema-sofia.eu', 'mail.com'])) {
|
||||||
$sp794f3f->account_sms_verified = false;
|
$sp794f3f->account_sms_verified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +168,11 @@ class EmailDefaults
|
|||||||
*/
|
*/
|
||||||
private function setBody(): self
|
private function setBody(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->template == 'email.template.custom') {
|
||||||
|
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, $this->email->email_object->settings->email_style_custom));
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->email->email_object->body) {
|
if ($this->email->email_object->body) {
|
||||||
// A Custom Message has been set in the email screen.
|
// A Custom Message has been set in the email screen.
|
||||||
return $this;
|
return $this;
|
||||||
@ -179,10 +184,6 @@ class EmailDefaults
|
|||||||
$this->email->email_object->body = EmailTemplateDefaults::getDefaultTemplate($this->email->email_object->email_template_body, $this->locale);
|
$this->email->email_object->body = EmailTemplateDefaults::getDefaultTemplate($this->email->email_object->email_template_body, $this->locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->template == 'email.template.custom') {
|
|
||||||
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, $this->email->email_object->settings->email_style_custom));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class EmailMailable extends Mailable
|
|||||||
* @return \Illuminate\Mail\Mailables\Envelope
|
* @return \Illuminate\Mail\Mailables\Envelope
|
||||||
*/
|
*/
|
||||||
public function envelope()
|
public function envelope()
|
||||||
{nlog($this->email_object->cc);
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: $this->email_object->subject,
|
subject: $this->email_object->subject,
|
||||||
tags: [$this->email_object->company_key],
|
tags: [$this->email_object->company_key],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user