projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#17599: display cancelled services from history [bug fixes, v3 merge]
[freeside.git]
/
FS
/
FS
/
cdr.pm
diff --git
a/FS/FS/cdr.pm
b/FS/FS/cdr.pm
index
5a1d8ea
..
a2b9a8c
100644
(file)
--- a/
FS/FS/cdr.pm
+++ b/
FS/FS/cdr.pm
@@
-161,6
+161,8
@@
following fields are currently supported:
=item cdrbatch
=item cdrbatch
+=item detailnum - Link to invoice detail (L<FS::cust_bill_pkg_detail>)
+
=back
=head1 METHODS
=back
=head1 METHODS
@@
-227,6
+229,7
@@
sub table_info {
'freesiderewritestatus' => 'Freeside rewrite status',
'cdrbatch' => 'Legacy batch',
'cdrbatchnum' => 'Batch',
'freesiderewritestatus' => 'Freeside rewrite status',
'cdrbatch' => 'Legacy batch',
'cdrbatchnum' => 'Batch',
+ 'detailnum' => 'Freeside invoice detail line',
},
};
},
};
@@
-338,8
+341,12
@@
sub check {
#check the foreign keys even?
#do we want to outright *reject* the CDR?
#check the foreign keys even?
#do we want to outright *reject* the CDR?
- my $error =
- $self->ut_numbern('acctid');
+ my $error = $self->ut_numbern('acctid');
+ return $error if $error;
+
+ if ( $self->freesidestatus ne 'done' ) {
+ $self->set('detailnum', ''); # can't have this on an unbilled call
+ }
#add a config option to turn these back on if someone needs 'em
#
#add a config option to turn these back on if someone needs 'em
#
@@
-352,8
+359,6
@@
sub check {
# # Telstra =1, Optus = 2, RSL COM = 3
# || $self->ut_foreign_keyn('carrierid', 'cdr_carrier', 'carrierid' )
# # Telstra =1, Optus = 2, RSL COM = 3
# || $self->ut_foreign_keyn('carrierid', 'cdr_carrier', 'carrierid' )
- return $error if $error;
-
$self->SUPER::check;
}
$self->SUPER::check;
}
@@
-541,6
+546,9
@@
sub parse_number {
my $field = $options{column} || 'dst';
my $intl = $options{international_prefix} || '011';
my $field = $options{column} || 'dst';
my $intl = $options{international_prefix} || '011';
+ # Still, don't break anyone's CDR rating if they have an empty string in
+ # there. Require an explicit statement that there's no prefix.
+ $intl = '' if lc($intl) eq 'none';
my $countrycode = '';
my $number = $self->$field();
my $countrycode = '';
my $number = $self->$field();
@@
-919,8
+927,10
@@
sub rate_prefix {
# by default, set the included minutes for this region/time to
# what's in the rate_detail
# by default, set the included minutes for this region/time to
# what's in the rate_detail
- $included_min->{$regionnum}{$ratetimenum} = $rate_detail->min_included
- unless exists $included_min->{$regionnum}{$ratetimenum};
+ if (!exists( $included_min->{$regionnum}{$ratetimenum} )) {
+ $included_min->{$regionnum}{$ratetimenum} =
+ ($rate_detail->min_included * $cust_pkg->quantity || 1);
+ }
if ( $included_min->{$regionnum}{$ratetimenum} >= $minutes ) {
$charge_sec = 0;
if ( $included_min->{$regionnum}{$ratetimenum} >= $minutes ) {
$charge_sec = 0;
@@
-1254,6
+1264,10
@@
my %export_names = (
'name' => 'Number of calls, one line per service',
'invoice_header' => 'Caller,Rate,Messages,Price',
},
'name' => 'Number of calls, one line per service',
'invoice_header' => 'Caller,Rate,Messages,Price',
},
+ 'sum_duration' => {
+ 'name' => 'Summary, one line per service',
+ 'invoice_header' => 'Caller,Rate,Calls,Minutes,Price',
+ },
'sum_duration_prefix' => {
'name' => 'Summary, one line per destination prefix',
'invoice_header' => 'Caller,Rate,Calls,Minutes,Price',
'sum_duration_prefix' => {
'name' => 'Summary, one line per destination prefix',
'invoice_header' => 'Caller,Rate,Calls,Minutes,Price',
@@
-1262,6
+1276,10
@@
my %export_names = (
'name' => 'Summary, one line per usage class',
'invoice_header' => 'Caller,Class,Calls,Price',
},
'name' => 'Summary, one line per usage class',
'invoice_header' => 'Caller,Class,Calls,Price',
},
+ 'sum_duration_accountcode' => {
+ 'name' => 'Summary, one line per accountcode',
+ 'invoice_header' => 'Caller,Rate,Calls,Minutes,Price',
+ },
);
my %export_formats = ();
);
my %export_formats = ();