1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +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;
if(is_null($payment_hash_key)){
nlog("charge.refunded not found");
return;
}
$payment_hash = PaymentHash::query()->where('hash', $payment_hash_key)->first();
$company_gateway = $payment_hash->payment->company_gateway;

View File

@ -124,7 +124,7 @@ class TemplateService
$this->twig->addFilter($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',];
$allowedProperties = ['type_id'];
$allowedMethods = ['img','t'];
@ -323,6 +323,9 @@ class TemplateService
$template = $template->render($this->data);
$f = $this->document->createDocumentFragment();
$template = htmlspecialchars($template, ENT_XML1, 'UTF-8');
$f->appendXML(html_entity_decode($template));
$replacements[] = $f;