diff options
author | jeff <jeff> | 2008-08-02 04:20:22 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-08-02 04:20:22 +0000 |
commit | efc68f41987d007de5e792b88df1c63bf3dedf4c (patch) | |
tree | c1097a43fa4b2430d938eb8e7cc0e82611fe37e6 /FS | |
parent | 6038f6fe5fe3590bcc8063f15ba8ce4cb6a985dc (diff) |
bundled package presentation improvements
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_bill.pm | 6 | ||||
-rw-r--r-- | FS/FS/cust_bill_pkg.pm | 2 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 4 | ||||
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 13 |
6 files changed, 27 insertions, 6 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 8684a5aa4..3c4c6eebe 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1893,6 +1893,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'voip-cust_cdr_squelch', + 'section' => '', + 'description' => 'Enable the per-customer option for not printing CDR on 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/Schema.pm b/FS/FS/Schema.pm index 06816effe..9a1ce9fc0 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -621,6 +621,7 @@ sub tables_hashref { 'referral_custnum', 'int', 'NULL', '', '', '', 'comments', 'text', 'NULL', '', '', '', 'spool_cdr','char', 'NULL', 1, '', '', + 'squelch_cdr','char', 'NULL', 1, '', '', 'invoice_terms', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'custnum', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 3aed5a44a..96c1db7fb 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1631,6 +1631,8 @@ L<Time::Local> and L<Date::Parse> for conversion functions. cid - +unsquelch_cdr - overrides any per customer cdr squelching when true + =cut sub print_generic { @@ -2054,6 +2056,8 @@ sub print_generic { $options{'section'} = $section if $multisection; $options{'format'} = $format; $options{'escape_function'} = $escape_function; + $options{'format_function'} = sub { () } + unless $params{unsquelch_cdr} || $cust_main->squelch_cdr ne 'Y'; foreach my $line_item ( $self->_items_pkg(%options) ) { my $detail = { @@ -2638,6 +2642,7 @@ sub _items_cust_bill_pkg { my $format = $opt{format} || ''; my $escape_function = $opt{escape_function} || sub { shift }; + my $format_function = $opt{format_function} || ''; my @b = (); foreach my $cust_bill_pkg ( @$cust_bill_pkg ) { @@ -2648,6 +2653,7 @@ sub _items_cust_bill_pkg { my %details_opt = ( 'format' => $format, 'escape_function' => $escape_function, + 'format_function' => $format_function, ); if ( $cust_bill_pkg->pkgnum > 0 ) { diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 62c0d583a..638e707c4 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -285,6 +285,8 @@ sub details { } if $format eq 'latex'; + $format_sub = $opt{format_function} if $opt{format_function}; + map { ( $_->format eq 'C' ? &{$format_sub}( $_->detail ) : &{$escape_function}( $_->detail ) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index e7235ffcc..b74c75d50 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -223,6 +223,8 @@ Card Verification Value, "CVV2" (also known as CVC2 or CID), the 3 or 4 digit nu =item spool_cdr - Enable individual CDR spooling, empty or `Y' +=item squelch_cdr - Discourage individual CDR printing, empty or `Y' + =back =head1 METHODS @@ -1530,7 +1532,7 @@ sub check { $self->payname($1); } - foreach my $flag (qw( tax spool_cdr )) { + foreach my $flag (qw( tax spool_cdr squelch_cdr )) { $self->$flag() =~ /^(Y?)$/ or return "Illegal $flag: ". $self->$flag(); $self->$flag($1); } diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index a14db2b2c..a7c1903e6 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -158,6 +158,10 @@ sub calc_usage { my $output_format = $self->option('output_format', 'Hush!') || 'simple'; + eval "use Text::CSV_XS;"; + die $@ if $@; + my $csv = new Text::CSV_XS; + foreach my $cust_svc ( grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc ) { @@ -298,7 +302,7 @@ sub calc_usage { $charge = sprintf('%.2f', $cdr->upstream_price); $charges += $charge; - + @call_details = ( #time2str("%Y %b %d - %r", $cdr->calldate_unix ), time2str("%c", $cdr->calldate_unix), #XXX this should probably be a config option dropdown so they can select US vs- rest of world dates or whatnot @@ -383,10 +387,9 @@ sub calc_usage { if ( $self->option('rating_method') eq 'upstream_simple' ) { $call_details = [ 'C', $call_details[0] ]; }else{ - $call_details = join(' - ', @call_details ); + $csv->combine(@call_details); + $call_details = [ 'C', $csv->string ]; } - warn " adding details on charge to invoice: $call_details" - if ( $DEBUG && !ref($call_details) ); warn " adding details on charge to invoice: [ ". join(', ', @{$call_details} ). " ]" if ( $DEBUG && ref($call_details) ); @@ -476,7 +479,7 @@ sub append_cust_bill_pkgs { 'quantity' => $cust_pkg->quantity, 'sdate' => $$sdate, 'edate' => $cust_pkg->bill, # already fiddled - 'itemdesc' => 'Call details', # configurable? + 'itemdesc' => 'Usage charges', # configurable? 'details' => \@details, }; |