1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Improvements for twig

This commit is contained in:
David Bomba 2024-08-06 18:21:03 +10:00
parent 7c6732e896
commit 36fef6beb3
2 changed files with 9 additions and 1 deletions

View File

@ -59,6 +59,11 @@ class ChargeRefunded implements ShouldQueue
$payment_hash_key = $source['metadata']['payment_hash'] ?? null; $payment_hash_key = $source['metadata']['payment_hash'] ?? null;
if(is_null($payment_hash_key)){
nlog("charge.refunded not found");
return;
}
$payment_hash = PaymentHash::query()->where('hash', $payment_hash_key)->first(); $payment_hash = PaymentHash::query()->where('hash', $payment_hash_key)->first();
$company_gateway = $payment_hash->payment->company_gateway; $company_gateway = $payment_hash->payment->company_gateway;

View File

@ -124,7 +124,7 @@ class TemplateService
$this->twig->addFilter($filter); $this->twig->addFilter($filter);
$allowedTags = ['if', 'for', 'set', 'filter']; $allowedTags = ['if', 'for', 'set', 'filter'];
$allowedFilters = ['escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency', 'format_number','format_percent_number','map', 'join', 'first', 'date', 'sum', 'number_format','nl2br']; $allowedFilters = ['replace', 'escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency', 'format_number','format_percent_number','map', 'join', 'first', 'date', 'sum', 'number_format','nl2br'];
$allowedFunctions = ['range', 'cycle', 'constant', 'date',]; $allowedFunctions = ['range', 'cycle', 'constant', 'date',];
$allowedProperties = ['type_id']; $allowedProperties = ['type_id'];
$allowedMethods = ['img','t']; $allowedMethods = ['img','t'];
@ -323,6 +323,9 @@ class TemplateService
$template = $template->render($this->data); $template = $template->render($this->data);
$f = $this->document->createDocumentFragment(); $f = $this->document->createDocumentFragment();
$template = htmlspecialchars($template, ENT_XML1, 'UTF-8');
$f->appendXML(html_entity_decode($template)); $f->appendXML(html_entity_decode($template));
$replacements[] = $f; $replacements[] = $f;