is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#995 closed bug (fixed)

It's not possible to specify to not use no thousands separator in number_format plugin

Reported by: mike Owned by:
Priority: low Milestone: Jelix 1.1.4
Component: jelix:plugins:tpl Version: 1.1.3
Severity: minor Keywords: number_format, jtpl_plugin
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description (last modified by laurentj)

If we don't need a thousands separator, we should not want the default one... If I try to do something like I think :

// function jtpl_modifier_common_number_format($number, $decimals=0, $dec_point=false, $thousands_sep=false)
{$myvalue|number_format:2, false, ''}

It doesn't work since '' is considered as a false value

We just have to change the test '===' instead of '==', in order to know if it's exactly a boolean false value or an empty string. The patch is just that !

    if ($dec_point === false) {
        $dec_point = jLocale::get('jelix~format.decimal_point');
    if ($thousands_sep === false) {
        $thousands_sep = jLocale::get('jelix~format.thousands_sep');

Change History (2)

comment:1 Changed 12 years ago by laurentj

  • Component changed from jelix to jelix:plugins:tpl
  • Description modified (diff)
  • Priority changed from normal to low
  • review set to review+
  • Severity changed from normal to minor

I'm not sure that giving as decimal point is a good idea. So the "===" for $dec_point is bad.

However, this is ok for $thousands_sep. R+ for only this if statement.

comment:2 Changed 12 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.