[freeside-commits] freeside/FS/FS cust_bill.pm,1.233,1.234

Ivan,,, ivan at wavetail.420.am
Sun Jan 25 18:14:06 PST 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv21936

Modified Files:
	cust_bill.pm 
Log Message:
should fix: Argument "\\dollar 2.69" isn't numeric in sprintf at /usr/local/share/perl/5.8.8/FS/cust_bill.pm line 2193.  Hopefully no problems with invoice with 0 tax printing :/.  RT#4681

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- cust_bill.pm	20 Jan 2009 19:35:16 -0000	1.233
+++ cust_bill.pm	26 Jan 2009 02:14:04 -0000	1.234
@@ -1702,6 +1702,8 @@
 
 =cut
 
+#what's with all the sprintf('%10.2f')'s in here?  will it cause any
+# (alignment?) problems to change them all to '%.2f' ?
 sub print_generic {
 
   my( $self, %params ) = @_;
@@ -2039,7 +2041,7 @@
                     );
   my $money_char = $money_chars{$format};
 
-  my %other_money_chars = ( 'latex'    => '\dollar ',
+  my %other_money_chars = ( 'latex'    => '\dollar ',#XXX should be a config too
                             'html'     => $conf->config('money_char') || '$',
                             'template' => '',
                           );
@@ -2172,26 +2174,36 @@
   }
 
   foreach my $tax ( $self->_items_tax ) {
-    my $total = {};
-    $total->{'total_item'} = &$escape_function($tax->{'description'});
+
     $taxtotal += $tax->{'amount'};
-    $total->{'total_amount'} = $other_money_char. $tax->{'amount'};
+
+    my $description = &$escape_function( $tax->{'description'} );
+    my $amount      = sprintf( '%.2f', $tax->{'amount'} );
+
     if ( $multisection ) {
+
       my $money = $old_latex ? '' : $money_char;
       push @detail_items, {
         ext_description => [],
         ref          => '',
         quantity     => '',
-        description  => &$escape_function($tax->{'description'}),
-        amount       => $money. $tax->{'amount'},
+        description  => $description,
+        amount       => $money. $amount,
         product_code => '',
         section      => $tax_section,
       };
-    }else{
-      push @total_items, $total;
+
+    } else {
+
+      push @total_items, {
+        'total_item'   => $description,
+        'total_amount' => $other_money_char. $amount,
+      };
+
     }
-    push @buf,[ $total->{'total_item'},
-                $money_char. sprintf("%10.2f", $total->{'total_amount'}),
+
+    push @buf,[ $description,
+                $money_char. $amount,
               ];
 
   }



More information about the freeside-commits mailing list