From: jeff Date: Mon, 20 Jul 2009 23:01:12 +0000 (+0000) Subject: config setting to have emailed invoices include call details #5275 X-Git-Tag: root_of_svc_elec_features~996 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=5bc86917c4ce4451c124680f125bea72799f35b8 config setting to have emailed invoices include call details #5275 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 1d937b781..8ae926e6b 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2098,6 +2098,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'voip-cdr_email', + 'section' => '', + 'description' => 'Include the call details on emailed invoices even if the customer is configured for not printing them on the invoices.', + 'type' => 'checkbox', + }, + + { 'key' => 'svc_forward-arbitrary_dst', 'section' => '', 'description' => "Allow forwards to point to arbitrary strings that don't necessarily look like email addresses. Only used when using forwards for weird, non-email things.", diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index ac0280842..9937bc76d 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -605,6 +605,8 @@ sub generate_email { 'subject' => (($args{'subject'}) ? $args{'subject'} : 'Invoice'), ); + my %cdrs = ( 'unsquelch_cdr' => $conf->exists('voip-cdr_email') ); + if (ref($args{'to'}) eq 'ARRAY') { $return{'to'} = $args{'to'}; } else { @@ -643,7 +645,7 @@ sub generate_email { if ( ref($args{'print_text'}) eq 'ARRAY' ) { $data = $args{'print_text'}; } else { - $data = [ $self->print_text('', $args{'template'}) ]; + $data = [ $self->print_text('', $args{'template'}, %cdrs) ]; } } @@ -690,7 +692,11 @@ sub generate_email { ' ', ' ', ' ', - $self->print_html('', $args{'template'}, $content_id), + $self->print_html({ time => '', + template => $args{'template'}, + cid => $content_id, + %cdrs, + }), ' ', '', ], @@ -723,7 +729,7 @@ sub generate_email { $related->add_part($image); - my $pdf = build MIME::Entity $self->mimebuild_pdf('', $args{'template'}); + my $pdf = build MIME::Entity $self->mimebuild_pdf('', $args{'template'}, %cdrs); $return{'mimeparts'} = [ $related, $pdf ]; @@ -751,7 +757,7 @@ sub generate_email { #mime parts arguments a la MIME::Entity->build(). $return{'mimeparts'} = [ - { $self->mimebuild_pdf('', $args{'template'}) } + { $self->mimebuild_pdf('', $args{'template'}, %cdrs) } ]; } @@ -771,7 +777,7 @@ sub generate_email { if ( ref($args{'print_text'}) eq 'ARRAY' ) { $return{'body'} = $args{'print_text'}; } else { - $return{'body'} = [ $self->print_text('', $args{'template'}) ]; + $return{'body'} = [ $self->print_text('', $args{'template'}, %cdrs) ]; } } @@ -1611,11 +1617,12 @@ L and L for conversion functions. =cut sub print_text { - my( $self, $today, $template ) = @_; + my( $self, $today, $template, %opt ) = @_; my %params = ( 'format' => 'template' ); $params{'time'} = $today if $today; $params{'template'} = $template if $template; + $params{'unsquelch_cdr'} = $opt{'unsquelch_cdr'} if $opt{'unsquelch_cdr'}; $self->print_generic( %params ); } @@ -1636,11 +1643,12 @@ L and L for conversion functions. =cut sub print_latex { - my( $self, $today, $template ) = @_; + my( $self, $today, $template, %opt ) = @_; my %params = ( 'format' => 'latex' ); $params{'time'} = $today if $today; $params{'template'} = $template if $template; + $params{'unsquelch_cdr'} = $opt{'unsquelch_cdr'} if $opt{'unsquelch_cdr'}; $template ||= $self->_agent_template;