summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-04-27 05:22:22 +0000
committerlevinse <levinse>2011-04-27 05:22:22 +0000
commit9d5ada5763fdeca4f90a7357ab7c384b52c1c41c (patch)
tree76c8d3a3bae3cb2b963a67b2f24d8c4ff2918ed2
parent69a17ed7c31d23670f715ad639ab16b12392dcc1 (diff)
taqua accountcode billing, part 1 of 2, RT12181
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/Schema.pm1
-rw-r--r--FS/FS/cust_bill.pm4
-rw-r--r--FS/FS/cust_bill_pkg.pm5
-rw-r--r--FS/FS/cust_bill_pkg_detail.pm3
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm2
-rw-r--r--FS/FS/part_pkg/voip_inbound.pm1
-rw-r--r--httemplate/edit/cust_main/billing.html14
-rw-r--r--httemplate/view/cust_main/billing.html7
9 files changed, 41 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 61cba34..331645e 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 983edec..cc0f21f 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 3fbf03b..ba5ca24 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 791999c..37c4a27 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 7badaa3..9ac164c 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 2e165cd..5ebe9dd 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 e3e6faa..d9938c7 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 2301a0b..884d770 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -460,6 +460,20 @@
%>
</TD>
</TR>
+
+% if ( $conf->exists('voip-cust_accountcode_cdr') ) {
+ <TR>
+ <TD COLSPAN="2">
+ <INPUT TYPE="checkbox"
+ NAME="accountcode_cdr"
+ VALUE="Y"
+ <% $cust_main->accountcode_cdr eq "Y" ? 'CHECKED' : '' %>
+ > Breakdown CDRs by accountcode</TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="accountcode_cdr" VALUE="<% $cust_main->accountcode_cdr %>">
+% }
+
<TR>
<TD ALIGN="right" WIDTH="200">Credit limit </TD>
<TD WIDTH="408">
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index efff3ed..c770833 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -238,6 +238,13 @@ Billing information
</TR>
% }
+% if ( $conf->exists('voip-cust_accountcode_cdr') ) {
+ <TR>
+ <TD ALIGN="right">Breakdown CDRs by accountcode</TD>
+ <TD BGCOLOR="#ffffff"><% $cust_main->accountcode_cdr ? 'yes' : 'no' %></TD>
+ </TR>
+% }
+
% if ( $conf->exists('voip-cust_email_csv_cdr') ) {
<TR>
<TD ALIGN="right">Email&nbsp;CDRs&nbsp;as&nbsp;CSV</TD>