X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FTemplate_Mixin.pm;h=7dc813993ab69b8c2fc3452c9fd87ea51312faba;hb=f8eee0da9fb100baefa20fb8e4ef0e8a02c6382f;hp=080ab78dc787d6292ae9e4a2c4ebaaa321e512f5;hpb=1fab5627e44b8b27866df4c6a407403117f2301a;p=freeside.git diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 080ab78dc..7dc813993 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -603,6 +603,9 @@ sub print_generic { 'total_pages' => 1, ); + + #quotations have $name + $invoice_data{'name'} = $invoice_data{'payname'}; #localization $invoice_data{'emt'} = sub { &$escape_function($self->mt(@_)) }; @@ -1158,14 +1161,27 @@ sub print_generic { if ( $invoice_data{finance_section} && $section->{'description'} eq $invoice_data{finance_section} ); - $section->{'subtotal'} = $other_money_char. - sprintf('%.2f', $section->{'subtotal'}) - if $multisection; + if ( $multisection ) { + + if ( ref($section->{'subtotal'}) ) { + + $section->{'subtotal'} = + sprintf("$other_money_char%.2f to $other_money_char%.2f", + $section->{'subtotal'}[0], + $section->{'subtotal'}[1] + ); + + } else { - # continue some normalization - $section->{'amount'} = $section->{'subtotal'} - if $multisection; + $section->{'subtotal'} = $other_money_char. + sprintf('%.2f', $section->{'subtotal'}) + } + + # continue some normalization + $section->{'amount'} = $section->{'subtotal'} + + } if ( $section->{'description'} ) { push @buf, ( [ &$escape_function($section->{'description'}), '' ], @@ -1364,7 +1380,16 @@ sub print_generic { foreach ( @new_total_items ) { my ($item, $amount) = ($_->{'total_item'}, $_->{'total_amount'}); $_->{'total_item'} = &$embolden_function( $item ); - $_->{'total_amount'} = &$embolden_function( $other_money_char.$amount ); + + if ( ref($amount) ) { + $_->{'total_amount'} = &$embolden_function( + $other_money_char.$amount->[0]. ' to '. + $other_money_char.$amount->[1] + ); + } else { + $_->{'total_amount'} = &$embolden_function( $other_money_char.$amount ); + } + # but if it's multisection, don't append to @total_items. the adjust # section has all this stuff push @total_items, $_ if !$multisection; @@ -2090,6 +2115,7 @@ Returns an argument list to be passed to L. =cut use MIME::Entity; +use Encode; sub generate_email { @@ -2166,7 +2192,7 @@ sub generate_email { if $DEBUG; # 'print_text' argument is no longer used - @text = $self->print_text(\%args); + @text = map Encode::encode_utf8($_), $self->print_text(\%args); } else { @@ -2261,7 +2287,7 @@ sub generate_email { ' ', ' ', ' ', - $html, + Encode::encode_utf8($html), ' ', '', ], @@ -2367,7 +2393,7 @@ sub generate_email { =item mimebuild_pdf Returns a list suitable for passing to MIME::Entity->build(), representing -this invoice as PDF attachment. +this quotation or invoice as PDF attachment. =cut @@ -2378,7 +2404,7 @@ sub mimebuild_pdf { 'Encoding' => 'base64', 'Data' => [ $self->print_pdf(@_) ], 'Disposition' => 'attachment', - 'Filename' => 'invoice-'. $self->invnum. '.pdf', + 'Filename' => $self->pdf_filename, ); }