summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2009-07-20 23:01:12 +0000
committerjeff <jeff>2009-07-20 23:01:12 +0000
commit5bc86917c4ce4451c124680f125bea72799f35b8 (patch)
treeb5feaf9f7fb91d48820f5ea0a05185b96a0e1f1b
parent87a986f35b347affed5f1e1ff5c5c7c59ccd4ad1 (diff)
config setting to have emailed invoices include call details #5275
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cust_bill.pm22
2 files changed, 22 insertions, 7 deletions
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 {
' </title>',
' </head>',
' <body bgcolor="#e8e8e8">',
- $self->print_html('', $args{'template'}, $content_id),
+ $self->print_html({ time => '',
+ template => $args{'template'},
+ cid => $content_id,
+ %cdrs,
+ }),
' </body>',
'</html>',
],
@@ -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<Time::Local> and L<Date::Parse> 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<Time::Local> and L<Date::Parse> 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;