projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 27969 - created 3 new api functions to add, edit and list advertising sources
[freeside.git]
/
FS
/
FS
/
Template_Mixin.pm
diff --git
a/FS/FS/Template_Mixin.pm
b/FS/FS/Template_Mixin.pm
index
837ef2e
..
2dcf7d0
100644
(file)
--- a/
FS/FS/Template_Mixin.pm
+++ b/
FS/FS/Template_Mixin.pm
@@
-603,6
+603,9
@@
sub print_generic {
'total_pages' => 1,
);
'total_pages' => 1,
);
+
+ #quotations have $name
+ $invoice_data{'name'} = $invoice_data{'payname'};
#localization
$invoice_data{'emt'} = sub { &$escape_function($self->mt(@_)) };
#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} );
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'}) ) {
- # continue some normalization
- $section->{'amount'} = $section->{'subtotal'}
- if $multisection;
+ $section->{'subtotal'} =
+ sprintf("$other_money_char%.2f to $other_money_char%.2f",
+ $section->{'subtotal'}[0],
+ $section->{'subtotal'}[1]
+ );
+
+ } else {
+ $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'}), '' ],
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 );
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;
# but if it's multisection, don't append to @total_items. the adjust
# section has all this stuff
push @total_items, $_ if !$multisection;
@@
-1643,24
+1668,24
@@
sub print_generic {
die "no invoice_lines() functions in template?"
if ( $format eq 'template' && !$wasfunc );
die "no invoice_lines() functions in template?"
if ( $format eq 'template' && !$wasfunc );
- if ($format eq 'template') {
+ if ( $invoice_lines ) {
+ $invoice_data{'total_pages'} = int( scalar(@buf) / $invoice_lines );
+ $invoice_data{'total_pages'}++
+ if scalar(@buf) % $invoice_lines;
+ }
- if ( $invoice_lines ) {
- $invoice_data{'total_pages'} = int( scalar(@buf) / $invoice_lines );
- $invoice_data{'total_pages'}++
- if scalar(@buf) % $invoice_lines;
+ #setup subroutine for the template
+ $invoice_data{invoice_lines} = sub {
+ my $lines = shift || scalar(@buf);
+ map {
+ scalar(@buf)
+ ? shift @buf
+ : [ '', '' ];
}
}
+ ( 1 .. $lines );
+ };
- #setup subroutine for the template
- $invoice_data{invoice_lines} = sub {
- my $lines = shift || scalar(@buf);
- map {
- scalar(@buf)
- ? shift @buf
- : [ '', '' ];
- }
- ( 1 .. $lines );
- };
+ if ($format eq 'template') {
my $lines;
my @collect;
my $lines;
my @collect;
@@
-2367,7
+2392,7
@@
sub generate_email {
=item mimebuild_pdf
Returns a list suitable for passing to MIME::Entity->build(), representing
=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
=cut
@@
-2378,7
+2403,7
@@
sub mimebuild_pdf {
'Encoding' => 'base64',
'Data' => [ $self->print_pdf(@_) ],
'Disposition' => 'attachment',
'Encoding' => 'base64',
'Data' => [ $self->print_pdf(@_) ],
'Disposition' => 'attachment',
- 'Filename' =>
'invoice-'. $self->invnum. '.pdf'
,
+ 'Filename' =>
$self->pdf_filename
,
);
}
);
}