mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor fixes for emails
This commit is contained in:
parent
f10c880ffb
commit
eee79c90a2
@ -18,7 +18,6 @@ use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class TemplateEmail extends Mailable
|
||||
{
|
||||
@ -111,7 +110,7 @@ class TemplateEmail extends Mailable
|
||||
if (Ninja::isHosted()) {
|
||||
$bccs = explode(',', str_replace(' ', '', $settings->bcc_email));
|
||||
$this->bcc(array_slice($bccs, 0, 2));
|
||||
//$this->bcc(reset($bccs)); //remove whitespace if any has been inserted.
|
||||
//$this->bcc(reset($bccs)); //remove whitespace if any has been inserted.
|
||||
} else {
|
||||
$this->bcc(explode(',', str_replace(' ', '', $settings->bcc_email)));
|
||||
}//remove whitespace if any has been inserted.
|
||||
@ -149,16 +148,21 @@ class TemplateEmail extends Mailable
|
||||
if ($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||
$ubl_string = (new CreateUbl($this->invitation->invoice))->handle();
|
||||
|
||||
nlog("template {$ubl_string}");
|
||||
|
||||
if ($ubl_string) {
|
||||
$this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml'));
|
||||
}
|
||||
|
||||
}
|
||||
if ($this->invitation && $this->invitation->invoice && $this->invitation->invoice->client->getSetting('enable_e_invoice') && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||
|
||||
$xinvoice_filepath = $this->invitation->invoice->service()->getEInvoice($this->invitation->contact);
|
||||
$xml_string = $this->invitation->invoice->service()->getEInvoice($this->invitation->contact);
|
||||
|
||||
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_filepath))
|
||||
$this->attach(Storage::disk(config('filesystems.default'))->path($xinvoice_filepath), ['as' => $this->invitation->invoice->getFileName("xml"), 'mime' => null]);
|
||||
nlog("template {$xml_string}");
|
||||
|
||||
if($xml_string) {
|
||||
$this->attachData($xml_string, $this->invitation->invoice->getEFileName("xml"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -237,6 +237,15 @@ class BaseModel extends Model
|
||||
return $this->numberFormatter().'.'.$extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $extension
|
||||
* @return string
|
||||
*/
|
||||
public function getEFileName($extension = 'pdf')
|
||||
{
|
||||
return ctrans("texts.e_invoice"). "_" . $this->numberFormatter().'.'.$extension;
|
||||
}
|
||||
|
||||
public function numberFormatter()
|
||||
{
|
||||
$number = strlen($this->number) >= 1 ? $this->translate_entity() . "_" . $this->number : class_basename($this) . "_" . Str::random(5);
|
||||
|
Loading…
x
Reference in New Issue
Block a user