[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5449] trunk



Revision: 5449
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5449&view=rev
Author:   einhverfr
Date:     2013-01-01 04:29:35 +0000 (Tue, 01 Jan 2013)
Log Message:
-----------
PGNumber fixes for old framework

Modified Paths:
--------------
    trunk/LedgerSMB/PGNumber.pm
    trunk/old-handler.pl

Modified: trunk/LedgerSMB/PGNumber.pm
===================================================================
--- trunk/LedgerSMB/PGNumber.pm	2012-12-31 12:43:09 UTC (rev 5448)
+++ trunk/LedgerSMB/PGNumber.pm	2013-01-01 04:29:35 UTC (rev 5449)
@@ -187,7 +187,6 @@
 
     my $format = ($args{format}) ? $args{format}
                               : $LedgerSMB::App_State::User->{numberformat};
-
     my $places = undef;
     $places = LedgerSMB::Setting->get('decimal_places') if $args{money};
     $places = ($args{places}) ? $args{places} : $places;
@@ -196,11 +195,20 @@
     $places = 0 unless defined $places and ($places > 0);
     my $zfill = ($places > 0) ? 1 : 0;
     $dplaces = 5 unless defined $dplaces;
-    my $formatter = new Number::Format(
+    my $formatter;
+    if ($format eq '1000.00'){ # Default decimal sep, no thousands sep
+        $formatter =  new Number::Format(
+                  -decimal_fill => $zfill,
+                  -neg_format => 'x'
+        );
+    } else {
+        $formatter = new Number::Format(
                     -thousands_sep => $lsmb_formats->{$format}->{thousands_sep},
                     -decimal_point => $lsmb_formats->{$format}->{decimal_sep},
                      -decimal_fill => $zfill,
-                       -neg_format => 'x');   
+                       -neg_format => 'x'
+        );   
+    }
     $str = $formatter->format_number($str, $dplaces);
 
     my $neg_format = ($args{neg_format}) ? $args{neg_format} : 'def';

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2012-12-31 12:43:09 UTC (rev 5448)
+++ trunk/old-handler.pl	2013-01-01 04:29:35 UTC (rev 5449)
@@ -161,6 +161,7 @@
 
 # we get rid of myconfig and use User as a real object
 %myconfig = %{ LedgerSMB::User->fetch_config( $form ) };
+$LedgerSMB::App_State::User = \%myconfig;
 map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout)
   unless ( $form->{type} eq 'preferences' );
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.