mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for emails
This commit is contained in:
parent
3ef2591b38
commit
9874c1aee5
@ -25,7 +25,7 @@ class DocumentExport extends BaseExport
|
||||
|
||||
private $entity_transformer;
|
||||
|
||||
public $date_key = 'created_at';
|
||||
public string $date_key = 'created_at';
|
||||
|
||||
public array $entity_keys = [
|
||||
'record_type' => 'record_type',
|
||||
|
@ -25,7 +25,7 @@ class ExpenseExport extends BaseExport
|
||||
|
||||
private $expense_transformer;
|
||||
|
||||
public $date_key = 'date';
|
||||
public string $date_key = 'date';
|
||||
|
||||
public array $entity_keys = [
|
||||
'amount' => 'amount',
|
||||
|
@ -190,6 +190,12 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = RecurringInvoiceTransformer::class;
|
||||
}
|
||||
|
||||
if($entity_obj instanceof PurchaseOrder){
|
||||
$this->entity_type = PurchaseOrder::class;
|
||||
$this->entity_transformer = PurchaseOrderTransformer::class;
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
return $this->itemResponse($entity_obj->fresh());
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class SendEmailRequest extends Request
|
||||
$input = $this->all();
|
||||
|
||||
|
||||
if (Ninja::isHosted() && !auth()->user()->company()->account->account_sms_verified) {
|
||||
if (Ninja::isHosted() && !auth()->user()->account->account_sms_verified) {
|
||||
$this->error_message = ctrans('texts.authorization_sms_failure');
|
||||
|
||||
return false;
|
||||
|
@ -259,15 +259,14 @@ class EmailDefaults
|
||||
*/
|
||||
private function setAttachments(): self
|
||||
{
|
||||
$attachments = [];
|
||||
$documents = [];
|
||||
|
||||
if ($this->email->email_object->settings->document_email_attachment && $this->email->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
foreach ($this->email->company->documents as $document) {
|
||||
$attachments[] = ['file' => base64_encode($document->getFile()), 'name' => $document->name];
|
||||
}
|
||||
|
||||
$this->email->email_object->documents = array_merge($this->email->email_object->documents, $this->email->company->documents->pluck('id')->toArray());
|
||||
}
|
||||
|
||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, $attachments);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user