From: ivan Date: Mon, 26 Jan 2009 02:14:04 +0000 (+0000) Subject: should fix: Argument "\\dollar 2.69" isn't numeric in sprintf at /usr/local/share... X-Git-Tag: root_of_webpay_support~102 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=be48a55bb8edc45ee38e4c9098d5d1e49a9f620b 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 --- diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 769839b30..34feb40f7 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1702,6 +1702,8 @@ unsquelch_cdr - overrides any per customer cdr squelching when true =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 @@ sub print_generic { ); 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 @@ sub print_generic { } 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, ]; }