Merge pull request #9771 from LarsK1/feature-optional-xml-attachment

Feature: Option for xml-attachments in the e-mail
This commit is contained in:
David Bomba 2024-07-16 12:01:05 +10:00 committed by GitHub
commit c42bb6d955
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -327,12 +327,14 @@ class EmailDefaults
}
/** E-Invoice xml file */
if ($this->email->email_object->settings->enable_e_invoice) {
if ($this->email_object->settings->e_invoice_attachment ?? true){
$xml_string = $this->email->email_object->entity->service()->getEDocument();
if($xml_string) {
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($xml_string), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-e_invoice.xml"]]);
}
}
}
if (!$this->email->email_object->settings->document_email_attachment || !$this->email->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
return $this;