mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:44:28 -04:00
Simplify templateemail
This commit is contained in:
parent
760ed4d924
commit
2f6b53c02c
@ -48,7 +48,6 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
public $tries = 4; //number of retries
|
public $tries = 4; //number of retries
|
||||||
|
|
||||||
public $deleteWhenMissingModels = true;
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
/** @var null|\App\Models\Company $company **/
|
/** @var null|\App\Models\Company $company **/
|
||||||
|
@ -154,7 +154,10 @@ class TemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if(!$this->invitation)
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
if ($this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
$ubl_string = (new CreateUbl($this->invitation->invoice))->handle();
|
$ubl_string = (new CreateUbl($this->invitation->invoice))->handle();
|
||||||
|
|
||||||
if ($ubl_string) {
|
if ($ubl_string) {
|
||||||
@ -162,8 +165,9 @@ class TemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invitation->invoice) {
|
if ($this->invitation->invoice) {
|
||||||
if ($this->invitation && $this->invitation->invoice && $this->invitation->invoice->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->invitation->invoice->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
$xml_string = $this->invitation->invoice->service()->getEInvoice($this->invitation->contact);
|
$xml_string = $this->invitation->invoice->service()->getEInvoice($this->invitation->contact);
|
||||||
|
|
||||||
if ($xml_string) {
|
if ($xml_string) {
|
||||||
@ -173,7 +177,7 @@ class TemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($this->invitation->credit){
|
elseif ($this->invitation->credit){
|
||||||
if ($this->invitation && $this->invitation->credit && $this->invitation->credit->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->invitation->credit->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
$xml_string = $this->invitation->credit->service()->getECredit($this->invitation->contact);
|
$xml_string = $this->invitation->credit->service()->getECredit($this->invitation->contact);
|
||||||
|
|
||||||
if ($xml_string) {
|
if ($xml_string) {
|
||||||
@ -183,7 +187,7 @@ class TemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($this->invitation->quote){
|
elseif ($this->invitation->quote){
|
||||||
if ($this->invitation && $this->invitation->quote && $this->invitation->quote->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->invitation->quote->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
$xml_string = $this->invitation->quote->service()->getEQuote($this->invitation->contact);
|
$xml_string = $this->invitation->quote->service()->getEQuote($this->invitation->contact);
|
||||||
|
|
||||||
if ($xml_string) {
|
if ($xml_string) {
|
||||||
@ -193,7 +197,7 @@ class TemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($this->invitation->purchase_order){
|
elseif ($this->invitation->purchase_order){
|
||||||
if ($this->invitation && $this->invitation->purchase_order && $this->invitation->purchase_order->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->invitation->purchase_order->vendor->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
$xml_string = $this->invitation->purchase_order->service()->getEPurchaseOrder($this->invitation->contact);
|
$xml_string = $this->invitation->purchase_order->service()->getEPurchaseOrder($this->invitation->contact);
|
||||||
|
|
||||||
if ($xml_string) {
|
if ($xml_string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user