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

SF.net SVN: ledger-smb:[5601] trunk/LedgerSMB



Revision: 5601
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5601&view=rev
Author:   einhverfr
Date:     2013-01-17 10:11:49 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
Fixing issues formatting 1000.00 number formats values

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Payment.pm
    trunk/LedgerSMB/PGNumber.pm
    trunk/LedgerSMB/Scripts/payment.pm

Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm	2013-01-17 09:55:33 UTC (rev 5600)
+++ trunk/LedgerSMB/DBObject/Payment.pm	2013-01-17 10:11:49 UTC (rev 5601)
@@ -687,7 +687,7 @@
             $pay_amount = $self->format_amount({amount => $pay_amount, format => '1000.00'});
             my $invoice_subarray = "{$invoice_id,$pay_amount}";
             if ($invoice_subarray !~ /^\{\d+\,\-?\d*\.?\d+\}$/){
-                $self->error("Invalid subarray: $invoice_subarray");
+                die "Invalid subarray: $invoice_subarray";
             }
             $invoice_subarray =~ s/[^0123456789{},.-]//; 
 	    if ($invoice_array eq '{}'){ # Omit comma

Modified: trunk/LedgerSMB/PGNumber.pm
===================================================================
--- trunk/LedgerSMB/PGNumber.pm	2013-01-17 09:55:33 UTC (rev 5600)
+++ trunk/LedgerSMB/PGNumber.pm	2013-01-17 10:11:49 UTC (rev 5601)
@@ -187,6 +187,7 @@
 
     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;
@@ -201,6 +202,8 @@
                   -decimal_fill => $zfill,
                   -neg_format => 'x'
         );
+        $str = $formatter->format_number($str, $dplaces);
+        $str =~ s/,//g;
     } else {
         $formatter = new Number::Format(
                     -thousands_sep => $lsmb_formats->{$format}->{thousands_sep},
@@ -208,8 +211,8 @@
                      -decimal_fill => $zfill,
                        -neg_format => 'x'
         );   
+        $str = $formatter->format_number($str, $dplaces);
     }
-    $str = $formatter->format_number($str, $dplaces);
 
     my $neg_format = ($args{neg_format}) ? $args{neg_format} : 'def';
     my $fmt = ($is_neg) ? $lsmb_neg_formats->{$neg_format}->{neg}

Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm	2013-01-17 09:55:33 UTC (rev 5600)
+++ trunk/LedgerSMB/Scripts/payment.pm	2013-01-17 10:11:49 UTC (rev 5601)
@@ -54,6 +54,7 @@
 use LedgerSMB::Report::Invoices::Payments;
 use Error::Simple;
 use Error;
+use Carp::Always;
 use strict; 
 
 # CT:  A few notes for future refactoring of this code:
@@ -321,7 +322,7 @@
     } else {
         $payment->{notice} = 
            $payment->{_locale}->text('Data not saved.  Please try again.');
-        display_payments($request);
+        return display_payments($request);
     }
     
     payments($request);

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