From: levinse Date: Wed, 27 Apr 2011 05:22:22 +0000 (+0000) Subject: taqua accountcode billing, part 1 of 2, RT12181 X-Git-Tag: freeside_2_3_0~329 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=9d5ada5763fdeca4f90a7357ab7c384b52c1c41c taqua accountcode billing, part 1 of 2, RT12181 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 61cba34da..331645ec7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2908,6 +2908,13 @@ and customer address. Include units.', }, { + 'key' => 'voip-cust_accountcode_cdr', + 'section' => 'telephony', + 'description' => 'Enable the per-customer option for CDR breakdown by accountcode.', + 'type' => 'checkbox', + }, + + { 'key' => 'voip-cust_cdr_spools', 'section' => 'telephony', 'description' => 'Enable the per-customer option for individual CDR spools.', diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 983edec46..cc0f21ffc 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -691,6 +691,7 @@ sub tables_hashref { 'classnum', 'int', 'NULL', '', '', '', 'duration', 'int', 'NULL', '', 0, '', 'phonenum', 'varchar', 'NULL', 15, '', '', + 'accountcode', 'varchar', 'NULL', 20, '', '', 'regionname', 'varchar', 'NULL', $char_d, '', '', 'detail', 'varchar', '', 255, '', '', ], diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 3fbf03bf5..ba5ca2467 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2829,6 +2829,9 @@ sub print_generic { push @{$late_sections}, @$phone_sections; push @detail_items, @$phone_lines; } + if ($conf->exists('voip-cust_accountcode_cdr') && $cust_main->accountcode_cdr) { + # XXX: do something not unlike _items_svc_phone_sections, except generate only one section + } }else{ push @sections, { 'description' => '', 'subtotal' => '' }; } @@ -4700,7 +4703,6 @@ sub _items_cust_bill_pkg { ext_description => \@d, }; } - } } # recurring or usage with recurring charge diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 791999c17..37c4a2735 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -153,8 +153,9 @@ sub insert { 'amount' => (ref($detail) ? $detail->[2] : '' ), 'classnum' => (ref($detail) ? $detail->[3] : '' ), 'phonenum' => (ref($detail) ? $detail->[4] : '' ), - 'duration' => (ref($detail) ? $detail->[5] : '' ), - 'regionname' => (ref($detail) ? $detail->[6] : '' ), + 'accountcode' => (ref($detail) ? $detail->[5] : '' ), + 'duration' => (ref($detail) ? $detail->[6] : '' ), + 'regionname' => (ref($detail) ? $detail->[7] : '' ), }; $error = $cust_bill_pkg_detail->insert; if ( $error ) { diff --git a/FS/FS/cust_bill_pkg_detail.pm b/FS/FS/cust_bill_pkg_detail.pm index 7badaa3b9..9ac164ced 100644 --- a/FS/FS/cust_bill_pkg_detail.pm +++ b/FS/FS/cust_bill_pkg_detail.pm @@ -55,6 +55,8 @@ inherits from FS::Record. The following fields are currently supported: =item phonenum - +=item accountcode - accountcode + =item detail - detail description =back @@ -137,6 +139,7 @@ sub check { || $self->ut_enum('format', [ '', 'C' ] ) || $self->ut_numbern('duration') || $self->ut_textn('regionname') + || $self->ut_textn('accountcode') || $self->ut_text('detail') || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum') || $self->$phonenum_check_method('phonenum') diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 2e165cd49..5ebe9ddc5 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -741,6 +741,7 @@ sub calc_usage { $charge, $classnum, $phonenum, + $cdr->accountcode, $seconds, $regionname, ]; @@ -752,6 +753,7 @@ sub calc_usage { $charge, $classnum, $phonenum, + $cdr->accountcode, $seconds, $regionname, ]; diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm index e3e6faaf7..d9938c79b 100644 --- a/FS/FS/part_pkg/voip_inbound.pm +++ b/FS/FS/part_pkg/voip_inbound.pm @@ -270,6 +270,7 @@ sub calc_usage { $charge, $cdr->calltypenum, #classnum $self->phonenum, + $cdr->accountcode, $seconds, '', #regionname, not set for inbound calls ]; diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 2301a0b9c..884d77078 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -460,6 +460,20 @@ %> + +% if ( $conf->exists('voip-cust_accountcode_cdr') ) { + + + accountcode_cdr eq "Y" ? 'CHECKED' : '' %> + > Breakdown CDRs by accountcode + +% } else { + +% } + Credit limit diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index efff3ed1c..c770833ec 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -238,6 +238,13 @@ Billing information % } +% if ( $conf->exists('voip-cust_accountcode_cdr') ) { + + Breakdown CDRs by accountcode + <% $cust_main->accountcode_cdr ? 'yes' : 'no' %> + +% } + % if ( $conf->exists('voip-cust_email_csv_cdr') ) { Email CDRs as CSV