1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for activity insertions

This commit is contained in:
David Bomba 2023-11-15 13:25:34 +11:00
parent cddba28bfb
commit 5033f74639
2 changed files with 9 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class InvoicePaidActivity implements ShouldQueue
$fields->user_id = $user_id; $fields->user_id = $user_id;
$fields->invoice_id = $event->invoice->id; $fields->invoice_id = $event->invoice->id;
$fields->client_id = $event->invoice->client_id; $fields->client_id = $event->payment->client_id;
$fields->company_id = $event->invoice->company_id; $fields->company_id = $event->invoice->company_id;
$fields->activity_type_id = Activity::PAID_INVOICE; $fields->activity_type_id = Activity::PAID_INVOICE;
$fields->payment_id = $event->payment->id; $fields->payment_id = $event->payment->id;

View File

@ -62,6 +62,7 @@ class Statement
$html = new HtmlEngine($this->getInvitation()); $html = new HtmlEngine($this->getInvitation());
$variables = []; $variables = [];
$variables = $html->generateLabelsAndValues();
if($this->client->getSetting('statement_design_id') != '') { if($this->client->getSetting('statement_design_id') != '') {
@ -72,9 +73,7 @@ class Statement
return $this->templateStatement($variables); return $this->templateStatement($variables);
} }
$variables = $html->generateLabelsAndValues();
if ($this->getDesign()->is_custom) { if ($this->getDesign()->is_custom) {
$this->options['custom_partials'] = \json_decode(\json_encode($this->getDesign()->design), true); $this->options['custom_partials'] = \json_decode(\json_encode($this->getDesign()->design), true);
@ -154,11 +153,13 @@ class Statement
$statement_design_id = $this->client->getSetting('statement_design_id'); $statement_design_id = $this->client->getSetting('statement_design_id');
} }
$template = Design::where('id', $this->decodePrimaryKey($statement_design_id)) $template = Design::query()
->where('id', $this->decodePrimaryKey($statement_design_id))
->where('company_id', $this->client->company_id) ->where('company_id', $this->client->company_id)
->first(); ->first();
$ts = $template->service()->build([ $ts = $template->service();
$ts->build([
'variables' => collect([$variables]), 'variables' => collect([$variables]),
'invoices' => $this->getInvoices()->get(), 'invoices' => $this->getInvoices()->get(),
'payments' => $this->options['show_payments_table'] ? $this->getPayments()->get() : collect([]), 'payments' => $this->options['show_payments_table'] ? $this->getPayments()->get() : collect([]),
@ -166,6 +167,7 @@ class Statement
'aging' => $this->options['show_aging_table'] ? $this->getAging() : collect([]), 'aging' => $this->options['show_aging_table'] ? $this->getAging() : collect([]),
]); ]);
// $ts->overrideVariables([$variables]);
$html = $ts->getHtml(); $html = $ts->getHtml();
return $this->convertToPdf($html); return $this->convertToPdf($html);