mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #8601 from LarsK1/v5-develop
Fixes for duplicated XInvoice file attachments
This commit is contained in:
commit
c743017749
@ -168,7 +168,7 @@ class EmailDefaults
|
|||||||
*/
|
*/
|
||||||
private function setBody(): self
|
private function setBody(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strlen($this->email->email_object->body) > 3) {
|
if (strlen($this->email->email_object->body) > 3) {
|
||||||
// A Custom Message has been set in the email screen.
|
// A Custom Message has been set in the email screen.
|
||||||
// return $this;
|
// return $this;
|
||||||
@ -181,7 +181,7 @@ class EmailDefaults
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->email->email_object->text_body = strip_tags($this->email->email_object->body);
|
$this->email->email_object->text_body = strip_tags($this->email->email_object->body);
|
||||||
|
|
||||||
if ($this->template == 'email.template.custom') {
|
if ($this->template == 'email.template.custom') {
|
||||||
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, str_replace(["\r","\n"], "", $this->email->email_object->settings->email_style_custom)));
|
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, str_replace(["\r","\n"], "", $this->email->email_object->settings->email_style_custom)));
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ class EmailDefaults
|
|||||||
|
|
||||||
$this->email->email_object->subject = strtr($this->email->email_object->subject, $this->email->email_object->variables);
|
$this->email->email_object->subject = strtr($this->email->email_object->subject, $this->email->email_object->variables);
|
||||||
|
|
||||||
|
|
||||||
//06-06-2023 ensure we do not parse markdown in custom templates
|
//06-06-2023 ensure we do not parse markdown in custom templates
|
||||||
if ($this->template != 'custom' && $this->template != 'email.template.custom') {
|
if ($this->template != 'custom' && $this->template != 'email.template.custom') {
|
||||||
$this->email->email_object->body = $this->parseMarkdownToHtml($this->email->email_object->body);
|
$this->email->email_object->body = $this->parseMarkdownToHtml($this->email->email_object->body);
|
||||||
@ -303,17 +303,6 @@ class EmailDefaults
|
|||||||
$this->email->email_object->entity instanceof Quote ||
|
$this->email->email_object->entity instanceof Quote ||
|
||||||
$this->email->email_object->entity instanceof Credit)) {
|
$this->email->email_object->entity instanceof Credit)) {
|
||||||
$pdf = ((new CreateRawPdf($this->email->email_object->invitation, $this->email->company->db))->handle());
|
$pdf = ((new CreateRawPdf($this->email->email_object->invitation, $this->email->company->db))->handle());
|
||||||
if ($this->email->email_object->settings->enable_e_invoice && $this->email->email_object->entity instanceof Invoice) {
|
|
||||||
|
|
||||||
$xinvoice_path = $this->email->email_object->entity->service()->getEInvoice();
|
|
||||||
|
|
||||||
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_path))
|
|
||||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode(Storage::get($xinvoice_path)), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-xinvoice.xml"]]);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
|
|
||||||
}
|
|
||||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
|
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user