mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for previews
This commit is contained in:
parent
4daa321ecf
commit
5731763071
@ -293,9 +293,11 @@ class PreviewController extends BaseController
|
|||||||
$ts = (new TemplateService());
|
$ts = (new TemplateService());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$ts->setCompany($company)
|
$ts->setCompany($company)
|
||||||
->setTemplate($design_object)
|
->setTemplate($design_object)
|
||||||
->mock();
|
->mock();
|
||||||
|
|
||||||
} catch(SyntaxError $e) {
|
} catch(SyntaxError $e) {
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
return response()->json(['message' => 'invalid data access', 'errors' => ['design.design.body' => $e->getMessage()]], 422);
|
return response()->json(['message' => 'invalid data access', 'errors' => ['design.design.body' => $e->getMessage()]], 422);
|
||||||
|
@ -362,7 +362,7 @@ class ProcessMailgunWebhook implements ShouldQueue
|
|||||||
|
|
||||||
$bounce = new EmailBounce(
|
$bounce = new EmailBounce(
|
||||||
$this->request['event-data']['tags'][0],
|
$this->request['event-data']['tags'][0],
|
||||||
$this->request['event-data']['envelope']['sender'],
|
$this->request['event-data']['envelope']['sender'] ?? $this->request['event-data']['envelope']['from'],
|
||||||
$this->message_id
|
$this->message_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class PdfMock
|
|||||||
$pdf_config->setPdfVariables();
|
$pdf_config->setPdfVariables();
|
||||||
$pdf_config->setCurrency(Currency::find($this->settings->currency_id));
|
$pdf_config->setCurrency(Currency::find($this->settings->currency_id));
|
||||||
$pdf_config->setCountry(Country::find($this->settings->country_id ?: 840));
|
$pdf_config->setCountry(Country::find($this->settings->country_id ?: 840));
|
||||||
$pdf_config->currency_entity = $this->mock->client;
|
$pdf_config->currency_entity = $this->mock->client ?? $this->mock->vendor;
|
||||||
|
|
||||||
if(isset($this->request['design_id']) && $design = Design::withTrashed()->find($this->request['design_id'])) {
|
if(isset($this->request['design_id']) && $design = Design::withTrashed()->find($this->request['design_id'])) {
|
||||||
$pdf_config->design = $design;
|
$pdf_config->design = $design;
|
||||||
@ -171,11 +171,11 @@ class PdfMock
|
|||||||
{
|
{
|
||||||
$settings = $this->company->settings;
|
$settings = $this->company->settings;
|
||||||
|
|
||||||
match ($this->request['settings_type']) {
|
match ($this->request['settings_type'] ?? '') {
|
||||||
'group' => $settings = ClientSettings::buildClientSettings($this->company->settings, $this->request['settings']),
|
'group' => $settings = ClientSettings::buildClientSettings($this->company->settings, $this->request['settings']),
|
||||||
'client' => $settings = ClientSettings::buildClientSettings($this->company->settings, $this->request['settings']),
|
'client' => $settings = ClientSettings::buildClientSettings($this->company->settings, $this->request['settings']),
|
||||||
'company' => $settings = (object)$this->request['settings'],
|
'company' => $settings = (object)$this->request['settings'],
|
||||||
default => $settings = (object)$this->request['settings'],
|
default => $settings = (object)$this->company->settings,
|
||||||
};
|
};
|
||||||
|
|
||||||
$settings = CompanySettings::setProperties($settings);
|
$settings = CompanySettings::setProperties($settings);
|
||||||
|
@ -218,7 +218,7 @@ class TemplateService
|
|||||||
$tm = new TemplateMock($this->company);
|
$tm = new TemplateMock($this->company);
|
||||||
$tm->setSettings($this->getSettings())->init();
|
$tm->setSettings($this->getSettings())->init();
|
||||||
|
|
||||||
$this->entity = $this->company->invoices()->first() ?? $this->company->quotes()->first();
|
$this->entity = $this->company->invoices()->first() ?? $this->company->quotes()->first() ?? (new \App\Services\Pdf\PdfMock(['entity_type' => 'invoice'], $this->company))->initEntity();
|
||||||
|
|
||||||
$this->data = $tm->engines;
|
$this->data = $tm->engines;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user