mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add support for adding new standards to email
This commit is contained in:
parent
86039c2aed
commit
d8d70f0227
@ -158,15 +158,46 @@ class TemplateEmail extends Mailable
|
||||
}
|
||||
|
||||
}
|
||||
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)) {
|
||||
$xml_string = $this->invitation->invoice->service()->getEInvoice($this->invitation->contact);
|
||||
|
||||
if($xml_string) {
|
||||
if ($xml_string) {
|
||||
$this->attachData($xml_string, $this->invitation->invoice->getEFileName("xml"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
$xml_string = $this->invitation->credit->service()->getECredit($this->invitation->contact);
|
||||
|
||||
if ($xml_string) {
|
||||
$this->attachData($xml_string, $this->invitation->credit->getEFileName("xml"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
$xml_string = $this->invitation->quote->service()->getEQuote($this->invitation->contact);
|
||||
|
||||
if ($xml_string) {
|
||||
$this->attachData($xml_string, $this->invitation->quote->getEFileName("xml"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
$xml_string = $this->invitation->purchase_order->service()->getEPurchaseOrder($this->invitation->contact);
|
||||
|
||||
if ($xml_string) {
|
||||
$this->attachData($xml_string, $this->invitation->purchase_order->getEFileName("xml"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ use App\Jobs\Invoice\CreateUbl;
|
||||
use App\Models\Account;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Task;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -318,7 +320,7 @@ class EmailDefaults
|
||||
}
|
||||
}
|
||||
/** E-Invoice xml file */
|
||||
if ($this->email->email_object->settings->enable_e_invoice && $this->email->email_object->entity instanceof Invoice) {
|
||||
if ($this->email->email_object->settings->enable_e_invoice && ! $this->email->email_object->entity instanceof PurchaseOrder) {
|
||||
$xml_string = $this->email->email_object->entity->service()->getEInvoice();
|
||||
|
||||
if($xml_string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user