TWIG: Filter "number_format" implemented?

Hi @david and @hillel ,

are the filters number_format and format_number yet implemented in IN’s twig?

Hi,

This may help:

No, sorry. I want to set number-formats like decimal to two digits and 1000-seperator to ‘.’ and decimal-seperator to ‘,’. There’s a locale-setting in – i think – format_number, but using both filters ‘number_format’ or ‘format_number’ just stops IN from rebuilding the pdf/html.

Understood, @david do you have any suggestions?

@Schmitti I’ve added some additional filters into the securitypolicy of twig for this, available in the next release.

1 Like

Hey, @david

Awesome, thanks!

Hey @david ,

is there a list about the available filters in Invoice Ninja? Formating date/time or numbers still does not work.

Thanks!

@Schmitti

our security policy defines the following:


        $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'];
        $allowedFunctions = ['range', 'cycle', 'constant', 'date',];
        $allowedProperties = ['type_id'];
        $allowedMethods = ['img','t'];

If you need any additional ones, let me know / add them in a PR.

1 Like

Thank you very much! This clears everything up! If there are more filters needed, I’ll write you. First I try to come along with those. :slight_smile:

@david

Somehow I’ve still have problems with the format_number-filter. Setting up to “locale=‘de’” doesn’t effect the number. Still its decimal-icon is a dot, not a comma.

Have a look:

EDIT: Ah, but I forgot that format_number(friction_digit: 4) works as exspected. Weird!