mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for attaching documents and pdfs
This commit is contained in:
parent
da6ccddaaf
commit
9a44561b2f
57
app/Jobs/Company/CompanyExport.php
Normal file
57
app/Jobs/Company/CompanyExport.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Jobs\Company;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CompanyExport implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $company;
|
||||
|
||||
private $export_format;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param Company $company
|
||||
* @param User $user
|
||||
* @param string $custom_token_name
|
||||
*/
|
||||
public function __construct(Company $company, $export_format = 'json')
|
||||
{
|
||||
$this->company = $company;
|
||||
$this->export_format = $export_format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return CompanyToken|null
|
||||
*/
|
||||
public function handle() : void
|
||||
{
|
||||
|
||||
MultiDB::setDb($this->company->db);
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -85,6 +85,10 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$this->nmo->mailable->replyTo($this->nmo->settings->reply_to_email, $reply_to_name);
|
||||
|
||||
}
|
||||
else {
|
||||
$this->nmo->mailable->replyTo($this->nmo->company->owner()->email, $this->nmo->company->owner()->present()->name());
|
||||
}
|
||||
|
||||
|
||||
if (strlen($this->nmo->settings->bcc_email) > 1) {
|
||||
nlog('bcc list available');
|
||||
|
@ -107,7 +107,7 @@ class TemplateEmail extends Mailable
|
||||
});
|
||||
|
||||
//conditionally attach files
|
||||
if ($settings->pdf_email_attachment !== false && ! empty($this->build_email->getAttachments())) {
|
||||
// if ($settings->pdf_email_attachment !== false && ! empty($this->build_email->getAttachments())) {
|
||||
|
||||
//hosted | plan check here
|
||||
foreach ($this->build_email->getAttachments() as $file) {
|
||||
@ -118,7 +118,7 @@ class TemplateEmail extends Mailable
|
||||
$this->attach($file['path'], ['as' => $file['name'], 'mime' => $file['mime']]);
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -415,6 +415,8 @@ class Invoice extends BaseModel
|
||||
CreateEntityPdf::dispatchNow($invitation);
|
||||
}
|
||||
|
||||
nlog($storage_path);
|
||||
|
||||
return $storage_path;
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,20 @@ class SystemHealth
|
||||
'mail_mailer' => (string)self::checkMailMailer(),
|
||||
'flutter_renderer' => (string)config('ninja.flutter_canvas_kit'),
|
||||
'jobs_pending' => (int) Queue::size(),
|
||||
'pdf_engine' => (string) self::getPdfEngine(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPdfEngine()
|
||||
{
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation'))
|
||||
return 'Invoice Ninja Hosted PDF Generator';
|
||||
elseif(config('ninja.phantomjs_pdf_generation'))
|
||||
return 'Phantom JS Web Generator';
|
||||
else
|
||||
return 'SnapPDF PDF Generator';
|
||||
}
|
||||
|
||||
public static function checkMailMailer()
|
||||
{
|
||||
return config('mail.default');
|
||||
|
Loading…
x
Reference in New Issue
Block a user